How to project a new vector onto PCA space using snpgdsPCA( )?
2
0
Entering edit mode
@cff7e13e
Last seen 2.7 years ago
United States

Similar as this question: https://stats.stackexchange.com/questions/2592/how-to-project-a-new-vector-onto-pca-space

Simple question. How would we project a new vector onto PCA space using snpgdsPCA( ), given that there is no option to return the variant weights in snpgdsPCA( )? Is there anyway to infer the weights in R? I see the option need.genmat returns the covariance matrix – maybe this can be used to infer variant weights?

Note, other packages have an option to return weights like plink and prcomp, so this is not an uncommon request.

SNPRelate • 1.2k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 3 hours ago
United States

The help page for snpgdsPCA says it returns the eigenvectors.

ADD COMMENT
0
Entering edit mode
@stephanie-m-gogarten-5121
Last seen 4 months ago
University of Washington

You can use the functions snpgdsSNPLoading and snpgdsPCASampLoading to project new samples onto existing PCA eigenvectors. From the man page for snpgdsPCASampLoading:

# first PCA
pca <- snpgdsPCA(genofile, eigen.cnt=8)
snp_load <- snpgdsPCASNPLoading(pca, genofile)

# calculate sample eigenvectors from SNP loadings
samp_load <- snpgdsPCASampLoading(snp_load, genofile, sample.id=sample.id)
ADD COMMENT

Login before adding your answer.

Traffic: 627 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6