This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How can I create more accurate admixture plot like this?

enter image description here

enter image description here

I made simple vcf file processing as

plink --vcf Asp_multicall2.vcf.gz --double-id --allow-extra-chr \
--set-missing-var-ids @:# \
--set-missing-var-ids @:# \

for K in 1 2 3 4 5
do
  admixture --cv plink.bed $K | tee log${K}.out
done

As you can see, they grouped six kind of individual strains. But I want to observe every strain individual's result like below. From what stage should I adjust the command? Or suggest me the best way for this kind of data.

admixture vcf plink

1 answer

Hi there!

There's a way to do this with R. In ADMIXTURE v1.3 manual, they provide an example code for the exact graphic you want.

"The Q estimates are output as a simple matrix, so it is easy to make figures like Figure 1 from our paper using the read.table and plot commands in R. To make the stacked bar-charts that you may have seen elsewhere, use the barplot command. For example, assuming we have the file hapmap3.3.Q to analyze, the following R commands"

tbl = read.table("hapmap3.3.Q")
barplot(t(as.matrix(tbl)), col = rainbow(3), xlab = "Individual #", ylab = "Ancestry", border = NA)

You can do it also with ggplot2, as shown by Luis Darcy Verde Arregoitia.

Log in to answer this question.