findPattern: Find specific IBD patterns

Description Usage Arguments Details Value Examples

View source: R/findPattern.R

Description

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

Usage

1
findPattern(sims, pattern)

Arguments

sims

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

pattern

A list of two vectors names carriers and noncarriers.

Details

For each simulation, this function extracts the subset of rows satisfying the allele sharing specified by pattern. That is, segments where some allele occur in all of pattern$carriers, but in none of pattern$noncarriers.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

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

ibdsim2 documentation built on Nov. 13, 2020, 5:06 p.m.