How to add legend in Adegenet at R
0
0
Entering edit mode
3.7 years ago
Kumar ▴ 170

Hi, I have converted .raw of my vcf genotype file using PLINK. Now I am trying to make PCA plot using Adegenet at R. I have got the PCA plot but not able to add legend of the phenotype file in the plot. Please let me know how to add legend in the PCA plot. Here is my script.

library(adegenet)
Ass<-read.PLINK(file="E:/work/rw.raw", parallel=FALSE)
names(Ass)
pca2 <-glPca(Ass)
#Write number of PCs to be retained(e.g.10)
scatter(pca2, posi="bottomright")
#Get pca scorers and eigenvalues
as.matrix(pca2$eig)
as.matrix(pca2$scores)
#Plot PCA with color
myCol <-colorplot(pca2$scores,pca2$scores, trans=TRUE, cex=4)
abline(h=0, v=0, col="grey")
add.scatter.eig(pca2$eig[1:71],2,1,2, posi="bottomright", inset=.04, ratio=.25)
GWAS SNPs R • 808 views
ADD COMMENT

Login before adding your answer.

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