snpgdsIBDSelection: Get a table of IBD coefficients

View source: R/IBD.R

snpgdsIBDSelectionR Documentation

Get a table of IBD coefficients

Description

Return a data frame with IBD coefficients.

Usage

snpgdsIBDSelection(ibdobj, kinship.cutoff=NaN, samp.sel=NULL)

Arguments

ibdobj

an object of snpgdsIBDClass returned by snpgdsIBDMLE or snpgdsIBDMoM

kinship.cutoff

select the individual pairs with kinship coefficients >= kinship.cutoff; no filter if kinship.cutoff = NaN

samp.sel

a logical vector or integer vector to specify selection of samples

Value

Return a data.frame:

ID1

the id of the first individual

ID2

the id of the second individual

k0

the probability of sharing ZERO alleles

k1

the probability of sharing ONE alleles

kinship

kinship coefficient

Author(s)

Xiuwen Zheng

See Also

snpgdsIBDMLE, snpgdsIBDMoM, snpgdsIBDKING

Examples

# open an example dataset (HapMap)
genofile <- snpgdsOpen(snpgdsExampleFileName())

# YRI population
YRI.id <- read.gdsn(index.gdsn(genofile, "sample.id"))[
    read.gdsn(index.gdsn(genofile, "sample.annot/pop.group"))=="YRI"]
pibd <- snpgdsIBDMoM(genofile, sample.id=YRI.id)
flag <- lower.tri(pibd$k0)
plot(NaN, xlim=c(0,1), ylim=c(0,1), xlab="k0", ylab="k1")
lines(c(0,1), c(1,0), col="red", lty=3)
points(pibd$k0[flag], pibd$k1[flag])

# close the genotype file
snpgdsClose(genofile)

# IBD coefficients
dat <- snpgdsIBDSelection(pibd, 1/32)
head(dat)
#       ID1     ID2          k0        k1    kinship
# 1 NA19152 NA19154 0.010749154 0.9892508 0.24731271
# 2 NA19152 NA19093 0.848207777 0.1517922 0.03794806
# 3 NA19139 NA19138 0.010788047 0.9770181 0.25035144
# 4 NA19139 NA19137 0.012900661 0.9870993 0.24677483
# 5 NA18912 NA18914 0.008633077 0.9913669 0.24784173
# 6 NA19160 NA19161 0.008635754 0.9847777 0.24948770

zhengxwen/SNPRelate documentation built on Nov. 19, 2024, 1:02 p.m.