Learn R Programming

forrel (version 1.1.0)

Familias2ped: Convert Familias objects to ped format

Description

Familias is a widely used software for forensic kinship computations, which also features an accompanying R package (also called Familias). The function documented here converts pedigrees and marker data from the R version of Familias to pedtools::ped() format, used by forrel. This may be of interest for specialized computations not implemented in Familias, e.g. conditional simulations. Note: For importing ".fam" files created by (the stand-alone) Familias, see readFam().

Usage

Familias2ped(familiasped, datamatrix, loci, matchLoci = FALSE)

readFamiliasLoci(loci)

Arguments

familiasped

A FamiliasPedigree object or a list of such.

datamatrix

A data frame with two columns per marker (one for each allele) and one row per individual.

loci

A FamiliasLocus object or a list of such.

matchLoci

A logical. If TRUE, the column names of datamatrix must be found either within names(loci) or within the name entries of loci. The column names of datamatrix are assumed to come in pairs with suffixes ".1" and ".2", e.g. "TH01.1", "TH01.2", etc. If FALSE (the default) it is assumed that the loci correspond to the (pairs of) columns in datamatrix sequentially.

Value

A ped object, or a list of such.

Details

The Familias program represents pedigrees and marker data in a way that differs from the ped format in several ways, mostly because of the latter's stricter definition of a pedigree. A ped object always represent a connected pedigree, and each member must have either 0 or 2 parents. None of this is required by FamiliasPedigree objects. The conversion function Familias2ped takes care of all potential differences: It converts each Familias pedigree into a list of connected ped objects, adding missing parents where needed.

References

Familias is freely available from https://familias.name.

See Also

readFam()

Examples

Run this code
# NOT RUN {
famPed = structure(
  list(id = c('mother', 'daughter', 'AF'),
       findex = c(0, 3, 0),
       mindex = c(0, 1, 0),
       sex = c('female', 'female', 'male')),
  class = "FamiliasPedigree")

datamatrix = data.frame(
  M1.1 = c(NA, 8, NA),
  M1.2 = c(NA, 9.3, NA),
  row.names = famPed$id)

famLoc = structure(
  list(locusname = "M1",
       alleles = c("8" = 0.2, "9" = 0.5, "9.3" = 0.3)),
  class = "FamiliasLocus")

Familias2ped(famPed, datamatrix, loci = famLoc, matchLoci = TRUE)


# }

Run the code above in your browser using DataLab