plotting PCA PLINK eigenvec output in R
2
0
Entering edit mode
3.8 years ago

I have obtained two files .eigenvec and .eigenval after executing the command --pca on PLINK 1.9. now how can i plot PCA in R package. is there any tutorial? any script

PCA plink • 6.9k views
ADD COMMENT
0
Entering edit mode

I modified your question title so as to distinguish this from any standard PCA analysis.

ADD REPLY
3
Entering edit mode
3.8 years ago
samuelandjw ▴ 260
ret_pca=read.table("pca.eigenvec")
plot(ret_pca$PC1,ret_pca$PC2)
ADD COMMENT
0
Entering edit mode

it give me error Error in read.table(plink2.eigenvec) : object 'plink2.eigenvec' not found

plot(ret_pca$PC1,ret_pca$PC2)

ADD REPLY
0
Entering edit mode

plink2.eigenvec should be quoted as a string.

ADD REPLY
0
Entering edit mode
3.8 years ago

A bit more elaborate: see Step 11 from my tutorial Produce PCA bi-plot for 1000 Genomes Phase III - Version 2

biplot-new

Kevin

ADD COMMENT
0
Entering edit mode

i have no PED data. how can i use this script for plotting PCA

read in the PED data

PED <- read.table('20130606_g1k.ped', header = TRUE, skip = 0, sep = '\t') PED <- PED[which(PED$Individual.ID %in% rownames(eigenvec)), ] PED <- PED[match(rownames(eigenvec), PED$Individual.ID),] all(PED$Individual.ID == rownames(eigenvec)) == TRUE [1] TRUE

ADD REPLY

Login before adding your answer.

Traffic: 2291 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