R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(SNPRelate)
Loading required package: gdsfmt
SNPRelate -- supported by Streaming SIMD Extensions 2 (SSE2)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/SNPRelate/snpgdsIBDSelection.Rd_%03d_medium.png", width=480, height=480)
> ### Name: snpgdsIBDSelection
> ### Title: Get a table of IBD coefficients
> ### Aliases: snpgdsIBDSelection
> ### Keywords: GDS GWAS
>
> ### ** 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)
IBD analysis (PLINK method of moment) on SNP genotypes:
Excluding 365 SNPs on non-autosomes
Excluding 563 SNPs (monomorphic: TRUE, < MAF: NaN, or > missing rate: NaN)
Working space: 93 samples, 8160 SNPs
using 1 (CPU) core
PLINK IBD: the sum of all selected genotypes (0, 1 and 2) = 755648
Wed Jul 6 05:34:44 2016 (internal increment: 65536)
[>.................................................] 0%, ETC: NA [==================================================] 100%, completed
Wed Jul 6 05:34:44 2016 Done.
> 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
> # 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
>
>
>
>
>
> dev.off()
null device
1
>