How to order Admixture (ancestry) plot in R
1
3
Entering edit mode
7.9 years ago
beausoleilmo ▴ 600

I created an ancestry plot in R from an Admixture analysis. But my order in is very bizarre.

This is the command I used for the plot (with K = 4):

tbl = read.table("~/path-to/my_admixture_analysis.4.Q")
 ord = tbl[order(tbl$V1,tbl$V2,tbl$V3,tbl$V4),]
 bp = barplot(t(as.matrix(ord)), 
              space = c(0.2),
              col=rainbow(4),
              xlab="Individual #", 
              ylab="Ancestry",
              border=NA)

As you can see, the purple bar is not lining properly and a couple of other bars are not OK. How can I fix that?

enter image description here

ADMIXTURE R q plot • 9.2k views
ADD COMMENT
0
Entering edit mode
7.9 years ago
Joseph Hughes ★ 3.0k

Have you tried the R package PopHelper. I'm not involved in the tool development but looks good for what you are doing.

ADD COMMENT

Login before adding your answer.

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