Description Usage Arguments Value Author(s) References See Also Examples
To calculate the SNP correlations between eigenvactors and SNP genotypes
1 | snpgdsPCACorr(pcaobj, gdsobj, snp.id=NULL, eig.which=NULL, num.thread=1, verbose=TRUE)
|
pcaobj |
the |
gdsobj |
a GDS file object ( |
snp.id |
a vector of snp id specifying selected SNPs; if NULL, all SNPs are used |
eig.which |
a vector of integers, to specify which eigenvectors to be used |
num.thread |
the number of CPU cores used |
verbose |
if TRUE, show information |
Return a list:
sample.id |
the sample ids used in the analysis |
snp.id |
the SNP ids used in the analysis |
snpcorr |
a matrix of correlation coefficients, "# of eigenvectors" x "# of SNPs" |
Xiuwen Zheng
Patterson N, Price AL, Reich D (2006) Population structure and eigenanalysis. PLoS Genetics 2:e190.
snpgdsPCA
, snpgdsPCASampLoading
, snpgdsPCASNPLoading
1 2 3 4 5 6 7 8 9 10 11 | # open an example dataset (HapMap)
genofile <- openfn.gds(snpgdsExampleFileName())
# get chromosome index
chr <- read.gdsn(index.gdsn(genofile, "snp.chromosome"))
RV <- snpgdsPCA(genofile)
CORR <- snpgdsPCACorr(RV, genofile, eig.which=1:4)
plot(abs(CORR$snpcorr[3,]), xlab="SNP Index", ylab="PC 3", col=chr)
# close the genotype file
closefn.gds(genofile)
|
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'.
Principal Component Analysis (PCA) on genotypes:
Excluding 365 SNPs on non-autosomes
Excluding 1 SNP (monomorphic: TRUE, MAF: NaN, missing rate: NaN)
Working space: 279 samples, 8,722 SNPs
using 1 (CPU) core
PCA: the sum of all selected genotypes (0,1,2) = 2446510
CPU capabilities: Double-Precision SSE2
Thu Dec 7 09:09:34 2017 (internal increment: 408)
[..................................................] 0%, ETC: ---
[==================================================] 100%, completed in 0s
Thu Dec 7 09:09:34 2017 Begin (eigenvalues and eigenvectors)
Thu Dec 7 09:09:34 2017 Done.
Hint: it is suggested to call `snpgdsOpen' to open a SNP GDS file instead of `openfn.gds'.
SNP Correlation:
Working space: 279 samples, 9088 SNPs
using 1 (CPU) core
using the top 4 eigenvectors
Correlation: the sum of all selected genotypes (0,1,2) = 2553065
Thu Dec 7 09:09:34 2017 (internal increment: 3288)
[..................................................] 0%, ETC: ---
[==================================================] 100%, completed in 0s
Thu Dec 7 09:09:34 2017 Done.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.