SNPRelate: how to give specific color to a population in PCA plot
1
1
Entering edit mode
9.1 years ago
kumar.vinod81 ▴ 330

I am using SNPRelate for PCA analysis. Its using default color for different populations but I want to color them according to me. Plotting commands are like this:

> plot(tab$EV2, tab$EV1, col=as.integer(tab$pop),cex=1.2,pch=20,
+ xlab="eigenvector 2", ylab="eigenvector 1")
> legend("topleft", legend=levels(tab$pop), cex=1,pch=20, col=1:nlevels(tab$pop))

Head of the input file is like this:

sample.id   pop         EV1         EV2
1        A1 POP_I -0.10172849  0.03619405
2        A2 POP_I -0.15951814  0.08234857
3        A3 POP_I -0.15632495  0.08180843
4        A4 POP_I -0.09679447  0.07981108
5        A5 POP_I  0.11362360 -0.03186038
6        A6 POP_I  0.05594095 -0.05498351

Any idea about it?

SNPRelate • 3.1k views
ADD COMMENT
2
Entering edit mode
9.1 years ago

I think you want to use R's palette command.

ADD COMMENT
0
Entering edit mode

How we can label the samples in this PCA plot?

ADD REPLY

Login before adding your answer.

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