reconstruct: Pedigree reconstruction

Description Usage Arguments Details Value Examples

View source: R/reconstruct.R

Description

Reconstruct the most likely pedigree from genotype data.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
reconstruct(
  x,
  ids,
  extra = "parents",
  alleleMatrix = NULL,
  loci = NULL,
  pedlist = NULL,
  inferPO = FALSE,
  sex = NULL,
  age = NULL,
  knownPO = NULL,
  allKnown = FALSE,
  notPO = NULL,
  noChildren = NULL,
  connected = TRUE,
  linearInb = TRUE,
  maxLinearInb = NULL,
  sexSymmetry = TRUE,
  sortResults = TRUE,
  founderInb = 0,
  verbose = TRUE
)

Arguments

x

A pedtools::ped object or a list of such.

ids

A vector of ID labels from x. By default, the genotyped members of x are used.

extra

Either the word "parents", or a nonnegative integer. See details.

alleleMatrix

A matrix with two columns for each marker.

loci

A list of marker attributes.

pedlist

A list of pedigrees. If NULL, buildPeds() is used to generate a list.

inferPO

A logical. If TRUE, an initial stage of pairwise IBD estimation is done, in order to infer certain parent-child pairs, as well as certain non-parent-child pairs. When this option is used, arguments to knownPO and notPO are ignored.

sex

A vector of the same length as labs, with entries 1 (male) or 2 (female).

age

A numeric or character vector. If numeric, and age[i] < age[j], then individual i will not be an ancestor of individual j. The numbers themselves are irrelevant, only the partial ordering. Note that no interpretation is made about individuals of equal age.

Alternatively age may be a character vector of inequalities, e.g., age = c("1>2", "1>3"). This syntax allows finer control than the numeric version.

knownPO

A list of vectors of length 2, containing the ID labels of pairs known to be parent-offspring. By default, both directions are considered; use age to force a specific direction.

allKnown

A logical. If TRUE, no other pairs than knownPO will be assigned as parent-offspring. If FALSE (default), all pairs except those in notPO are treated as potential parent-offspring.

notPO

A list of vectors of length 2, containing the ID labels of pairs known not to be parent-offspring.

noChildren

A vector of ID labels, indicating individuals without children of their own.

connected

A logical. If TRUE (default), only connected pedigrees are returned.

linearInb

Either TRUE (allow any linear inbreeding), FALSE (disallow linear inbreeding) or a nonnegative integer indicating the maximum separation linearly related spouses. For example, linearInb = 1 allows mating between parent and child, but not between grandparent and grandchild (or more distant).

maxLinearInb

Deprecated; replaced by linearInb.

sexSymmetry

A logical. If TRUE (default), pedigrees which are equal except for the gender distribution of the added parents, are regarded as equivalent, and only one of each equivalence class is returned. Example: paternal vs. maternal half sibs.

sortResults

A logical. If TRUE, the output is sorted so that the most likely pedigree comes first.

founderInb

A number in the interval [0,1], used as background inbreeding level in all founders.

verbose

A logical.

Details

The parameter extra controls which of two algorithms are used to create the pedigree list.

If extra is a nonnegative integer, it determines the number of extra individuals allowed in the iterative pedigree construction. These extras start off with undetermined sex, meaning that both males and females are used. It should be noted that the final pedigrees may contain additional extras, since missing parents are added at the end.

If extra is the word "parents", the algorithm is not iterative. It first generates all directed acyclic graphs between the original individuals. Then their parents are added and merged in all possible ways. This option has the advantage of not requiring an explicit/ad hoc number of "extras", but works best in smaller cases.

Value

An object of class pedrec, which is essentially list with the following entries:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#-----------------
# Example 1: Trio
#-----------------

data(trioData)

x = as.ped(trioData, locusAttributes = "snp-12")
summary(x)

res = reconstruct(x, inferPO = TRUE, age = "1 > 2", linearInb = FALSE)

# Plot most likely pedigrees
plot(res, top = 6)


### Alternative workflow: Extract data manually...
als  = getAlleles(x)
loci = getLocusAttributes(x)
sex  = getSex(x)

# ...and then reconstruct
res2 = reconstruct(alleleMatrix = als, loci = loci, sex = sex,
                   inferPO = TRUE, age = "1 > 2", linearInb = FALSE)

stopifnot(identical(res, res2))

#--------------------
# Example 2: Siblings
#--------------------

ids = c("s1", "s2")
y = nuclearPed(children = ids)

# Simulate data
y = forrel::markerSim(y, N = 50, ids = ids, seed = 123)

# Reconstruct and plot
res3 = reconstruct(y, connected = FALSE)
res3
plot(res3)

pedbuildr documentation built on March 16, 2021, 9:07 a.m.