This is a test version of Biostars. For the public version, visit https://www.biostars.org.
plotting PCA PLINK eigenvec output in R

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

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

2 answers

ret_pca=read.table("pca.eigenvec")
plot(ret_pca$PC1,ret_pca$PC2)

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

plot(ret_pca$PC1,ret_pca$PC2)

plink2.eigenvec should be quoted as a string.

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

biplot-new

Kevin

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

Log in to answer this question.