Mercurial > repos > miller-lab > genome_diversity
annotate population_structure.r @ 27:8997f2ca8c7a
Update to Miller Lab devshed revision bae0d3306d3b
author | Richard Burhans <burhans@bx.psu.edu> |
---|---|
date | Mon, 15 Jul 2013 10:47:35 -0400 |
parents | 2c498d40ecde |
children |
rev | line source |
---|---|
0 | 1 library(RColorBrewer) |
2 | |
3 args = commandArgs(trailingOnly=TRUE) | |
4 q_file = args[[1]] | |
5 output_file = args[[2]] | |
6 populations = args[[3]] | |
7 | |
8 tbl <- read.table(q_file) | |
9 | |
10 if ( populations >= 3 && populations <= 12 ) { | |
11 colors = brewer.pal(populations, 'Paired') | |
12 } else { | |
13 colors = rainbow(populations) | |
14 } | |
15 | |
16 pdf(file=output_file, onefile=TRUE, width=7, height=3) | |
17 barplot(t(as.matrix(tbl)), col=colors, xlab="Individual #", ylab="Ancestry", border=NA) | |
18 | |
19 dev.off() |