findPattern: Find specific IBD patterns

View source: R/findPattern.R

findPatternR Documentation

Find specific IBD patterns

Description

Find segments satisfying a particular pattern of IBD sharing, in a list of IBD simulations.

Usage

findPattern(sims, pattern, merge = TRUE, cutoff = 0)

Arguments

sims

A genomeSim object, or a list of such. Typically made by ibdsim().

pattern

A named list of vectors containing ID labels. Allowed names are autozygous, heterozygous, carriers, noncarriers.

merge

A logical, indicating if adjacent segments should be merged. Default: TRUE.

cutoff

A non-negative number. Segments shorter than this are excluded from the output. Default: 0.

Details

For each simulation, this function extracts the subset of rows satisfying the allele sharing specified by pattern. That is, segments where, for some allele,

  • all of pattern$autozygous are autozygous

  • all of pattern$heterozygous have exactly one copy

  • all of pattern$carriers have at least one copy

  • none of pattern$noncarriers carry the allele.

Value

A matrix (if sims is a single genomeSim object), or a list of matrices.

See Also

segmentStats()

Examples

x = nuclearPed(3)
s = ibdsim(x, N = 1, map = uniformMap(M = 1), seed = 1729)
s1 = s[[1]]

# Segments where some allele is shared by 3 and 4, but not 5
pattern = list(carriers = 3:4, noncarriers = 5)
findPattern(s1, pattern)

# Exclude segments less than 7 cM
findPattern(s1, pattern, cutoff = 7)

# Visual confirmation:
haploDraw(x, s1, margin = c(5,3,3,3))


ibdsim2 documentation built on June 8, 2022, 1:07 a.m.