Description Usage Arguments Details Value Author(s) References Examples
View source: R/SNPRelate_Main.r
To calculate an individual inbreeding coefficient using SNP genotype data
1 2 | snpgdsIndInbCoef(x, p, method = c("mom.weir", "mom.visscher", "mle"),
reltol=.Machine$double.eps^0.75)
|
x |
SNP genotypes |
p |
allele frequencies |
method |
see details |
reltol |
relative convergence tolerance used in MLE; the algorithm stops if it is unable to reduce the value of log likelihood by a factor of $reltol * (abs(log likelihood with the initial parameters) + reltol)$ at a step. |
The method
can be:
"mom.weir": a modified Visscher's estimator, proposed by Bruce Weir;
"mom.visscher": Visscher's estimator described in Yang et al. (2010);
"mle": the maximum likelihood estimation.
Return estimated inbreeding coefficient.
Xiuwen Zheng
Yang J, Benyamin B, McEvoy BP, Gordon S, Henders AK, Nyholt DR, Madden PA, Heath AC, Martin NG, Montgomery GW, Goddard ME, Visscher PM. 2010. Common SNPs explain a large proportion of the heritability for human height. Nat Genet. 42(7):565-9. Epub 2010 Jun 20.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # open an example dataset (HapMap)
genofile <- openfn.gds(snpgdsExampleFileName())
chr1 <- read.gdsn(index.gdsn(genofile, "snp.id"))[
read.gdsn(index.gdsn(genofile, "snp.chromosome"))==1]
chr1idx <- match(chr1, read.gdsn(index.gdsn(genofile, "snp.id")))
AF <- snpgdsSNPRateFreq(genofile)
g <- read.gdsn(index.gdsn(genofile, "genotype"), start=c(1,1), count=c(-1,1))
snpgdsIndInbCoef(g[chr1idx], AF$AlleleFreq[chr1idx], method="mom.weir")
snpgdsIndInbCoef(g[chr1idx], AF$AlleleFreq[chr1idx], method="mom.visscher")
snpgdsIndInbCoef(g[chr1idx], AF$AlleleFreq[chr1idx], method="mle")
# close the genotype file
closefn.gds(genofile)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.