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, unit = "mb")

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.

unit

The unit of cutoff: either "mb" or "cm".

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)

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

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

# Visual confirmation:
haploDraw(x, s)


ibdsim2 documentation built on Aug. 17, 2023, 5:17 p.m.