Learn R Programming

paramlink (version 0.8-3)

linkdat.utils: linkdat utilities

Description

Utility functions for 'linkdat' objects

Usage

spouses(x, id, original.id)

offspring(x, id, original.id)

descendants(x, id, original.id)

pedigreeLoops(x)

breakLoops(x, loop_breakers)

tieLoops(x)

## S3 method for class 'linkdat':
all.equal(target, current, ...)

Arguments

x
a linkdat object
id
an integer, the ID of an individual.
original.id
A logical indicating whether 'id' refers to the original ID label or the internal labeling.
loop_breakers
A vector with IDs of the loop breaker individuals.
target, current
Two linkdat objects to be compared.
...
Not used.

Value

  • For spouses(x, id), an integer vector containing the ID's of all pedigree members sharing offspring with id. For offspring(x,id), a vector containing the ID's of the offspring (i.e. children) of individual id. For descendants(x,id), a vector containing the ID's of all descendants (i.e. children, grandchildren, a.s.o.) of individual id. For pedigreeLoops, a list containing all loops found in the pedigree. Each loop is represented as a list with elements 'top', a 'bottom' individual, 'pathA' (individuals forming a path from top to bottom) and 'pathB' (creating a different path from top to bottom, with no individuals in common with pathA). For breakLoops, a linkdat object in which the indicated loop breakers are duplicated. The returned object will also have a non-null loop_breakers entry, namely a matrix with the IDs of the original loop breakers in the first column and the duplicates in the second. For tieLoops, a linkdat object in which any duplicated individuals (as given in the x$loop_breakers entry) are merged. Ideally, tieLoops(breakLoops(x, loop_breakers)) should return x for any linkdat object x.

Examples

Run this code
p = cbind(ID=2:9, FID=c(0,0,2,0,4,4,0,2), MID=c(0,0,3,0,5,5,0,8), 
        SEX=c(1,2,1,2,1,2,2,2), AFF=c(2,1,2,1,2,1,1,2))
x = linkdat(p)

desc = descendants(x, 2)
spous = spouses(x, 2)
offs = offspring(x, 2)
stopifnot(setequal(spous, c(3,8)), setequal(offs, c(4,9)), setequal(desc, c(4,6,7,9)))

# Creating a loop and detecting it with 'pedigreeLoops' 
#(note that we get two loops, one for each inbred child):
loopx = addOffspring(x, father=4, mother=9, noffs=2)
lps = pedigreeLoops(loopx)
stopifnot(lps[[1]]$top == 2, setequal(sapply(lps, '[[', 'bottom'), 10:11))

# We add genotypes for a single SNP marker and compute the LOD score under a dominant model. We break the loop by duplicating individual 9:
loopx = setMarkers(loopx, cbind(1,c(2,1,2,1,2,1,1,2,1,1)))
loopx = setModel(loopx, 1)
loopfree = breakLoops(loopx, 9)
stopifnot(all.equal(loopx, tieLoops(loopfree)))
score = lod(loopfree, theta=0.1)
stopifnot(round(score, 3) == 1.746)

Run the code above in your browser using DataLab