Question: GWAS, eigenvec in R
0
gravatar for whateverer
4 months ago by
whateverer0
whateverer0 wrote:

Hi All,

I know that a lot of people asked about plink PCA and eigenvec, but i am a basic learner and have a difficulty understanding what they mean exactly.. Hope there is an angel to HELP me!

I have done plink PCA and am trying to make a graph in R by eigenvec file

raw-GWA-data.hapmap3r2.pruned.eigenvec

1 1 2 0.00675506 -0.00102713 0.000255009 0.00506672 0.00518335 2 2 1 0.00787777 -0.000930726 -0.00106701 -0.000330665 0.00495431 3 3 2 0.00746506 -0.00135015 0.00066044 -0.00368828 -0.00336739 4 4 2 0.00790253 -0.000707524 0.00284133 -0.00700586 0.000281037 5 5 2 0.00755939 -0.000803938 0.000926113 -0.000723133 0.00029433 6 6 2 0.00773069 -0.000876533 -0.00459124 -0.00200765 -0.001773 7 7 2 0.00795287 -0.00143945 -0.00331132 -0.00125819 -0.00366881 8 8 2 0.00761576 -0.00143091 0.00179961 0.00132296 0.0060271 9 9 2 0.00773385 -0.000960629 6.92423E-05 0.00292627 -0.000748113 10 10 2 0.00753494 -0.00101162 0.000936778 0.00199789 -0.000327348 ... 2395

and this is the script that i wrote

data=read.table("raw-GWA-data.hapmap3r2.pruned.eigenvec",h=F,skip=1) cont=which(data$V3=="1") case=which(data$V3=="2") CEU=which(data$V3=="3") CHB=which(data$V3=="4") JPT=which(data$V3=="5") YRI=which(data$V3=="6") pdf("pca-ancestry-plot.pdf") plot(0,0,pch="",xlim=c(-0.1,0.05),ylim=c(-0.05,0.1),xlab="principal component 1", ylab="principal component 2") points(data$V4[JPT],data$V5[JPT],pch=20,col="PURPLE") points(data$V4[CHB],data$V5[CHB],pch=20,col="PURPLE") points(data$V4[YRI],data$V5[YRI],pch=20,col="GREEN") points(data$V4[CEU],data$V5[CEU],pch=20,col="RED") par(cex=0.5) points(data$V4[cont],data$V5[cont],pch="+",col="BLACK") points(data$V4[case],data$V5[case],pch="+",col="BLACK") abline(h=0.072,col="gray32",lty=2) dev.off() quit() n

After this, I got a pdf file. It doesn't show the points though; only have x,y axises/names(principal components)

How could i get the right result....?

Thank you.

gwas r program eigenvec • 201 views
ADD COMMENTlink modified 4 months ago • written 4 months ago by whateverer0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 946 users visited in the last hour