How to do pca plot from .eigenvec files from Plink in R
0
0
Entering edit mode
3.8 years ago

I created eigenvec from plink from 8 samples got the following data,

AEBAN1 AEBAN1 0.233739 -0.462444 0.0588818 0.761738 0.141378 0.011553 0.00395623 -0.3573

AEBAN2 AEBAN2 0.227559 -0.0351801 -0.156163 -0.385497 0.814224 -0.0290638 0.00406695 -0.331907

AEBAN3 AEBAN3 -0.451765 0.0376304 0.00883375 0.015282 -0.0234585 -0.619909 -0.538497 -0.345493

AEBAN4 AEBAN4 -0.437627 0.0529541 0.00309719 -0.00807711 0.00933802 0.772843 -0.297348 -0.346142

AEBAN5 AEBAN5 0.225645 -0.412089 -0.526555 -0.355258 -0.496482 0.00371485 0.011119 -0.359398

AEBAN6 AEBAN6 -0.485645 0.0443476 0.012694 0.0095609 -0.00710413 -0.131822 0.788241 -0.350968

AECHN1 AECHN1 0.358227 0.779759 -0.2212 0.234503 -0.149197 -0.00757617 0.00995189 -0.370556

AECHN2 AECHN2 0.287892 -0.0296534 0.803559 -0.299262 -0.218194 -0.000227609 0.00513988 -0.365155

eigenvalue: 0.968773 0.727803 0.683851 0.660557 0.649325 0.427786 0.318728 -0.509643

Then by using the above data how to create PCA plots?

R GWAs Plink • 1.5k views
ADD COMMENT
0
Entering edit mode

I tried to create PCA by using below R script

eigen <- data.frame(read.table("plink.eigenvec", header=FALSE, skip=0, sep=" ")) rownames(eigen) <- eigen[,2] eigen <- eigen[,3:ncol(eigen)] summary(eigen) proportionvariances <- ((apply(eigen, 1, sd)^2) / (sum(apply(eigen, 1, sd)^2)))*100 plot(eigen[,1], eigen[,2])

How to add colors to samples after this script?

ADD REPLY

Login before adding your answer.

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