snpgdsIBDSelection: Get a table of IBD coefficients

Description Usage Arguments Value Author(s) See Also Examples

View source: R/IBD.r

Description

Return a data frame with IBD coefficients.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# open an example dataset (HapMap)
genofile <- openfn.gds(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
closefn.gds(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

Example output

Loading required package: gdsfmt
SNPRelate -- supported by Streaming SIMD Extensions 2 (SSE2)
Hint: it is suggested to call `snpgdsOpen' to open a SNP GDS file instead of `openfn.gds'.
IBD analysis (PLINK method of moment) on genotypes:
Excluding 365 SNPs on non-autosomes
Excluding 563 SNPs (monomorphic: TRUE, MAF: NaN, missing rate: NaN)
Working space: 93 samples, 8,160 SNPs
    using 1 (CPU) core
PLINK IBD:    the sum of all selected genotypes (0,1,2) = 755648
Thu Dec  7 09:07:47 2017    (internal increment: 39424)

[..................................................]  0%, ETC: ---    
[==================================================] 100%, completed in 0s
Thu Dec  7 09:07:47 2017    Done.
      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

SNPRelate documentation built on May 2, 2019, 4:56 p.m.