-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalysis_bstat_hack.R
20 lines (15 loc) · 1.26 KB
/
analysis_bstat_hack.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require("ggplot2");
options <- commandArgs(trailingOnly = TRUE)
thirty <- read.table(options[1], header=F, col.names=c(rep('',2),'ac_bin_min','ac_bin_max','snps','indel'), colClasses=c(rep('NULL',2),rep('numeric',4)));
thirty$coverage <- '30x';
fifteen <- read.table(options[2], header=F, col.names=c(rep('',2),'ac_bin_min','ac_bin_max','snps','indel'), colClasses=c(rep('NULL',2),rep('numeric',4)));
fifteen$coverage <- '15x';
covdata <-rbind(fifteen, thirty);
covdata$ac_bin <- paste(covdata$ac_bin_min,covdata$ac_bin_max, sep="-");
palette <- c("#0072B2", "#D55E00");
order <- c("1-1","2-2","3-20","21-NA");
names <- c("Singletons","Doubletons","3-20","21+");
hist_plot <- ggplot(data=covdata, aes(x=ac_bin, y=snps, fill=coverage)) + geom_bar(position="dodge",stat="identity") + scale_fill_manual(values=palette) + scale_y_log10(name="Variants") + scale_x_discrete(name="Allele Count", limits = order, labels = names);
ggsave(filename=options[3],plot=hist_plot);
hist_indel_plot <- ggplot(data=covdata, aes(x=ac_bin, y=indel, fill=coverage)) + geom_bar(position="dodge",stat="identity") + scale_fill_manual(values=palette) + scale_y_log10(name="Variants") + scale_x_discrete(name="Allele Count", limits = order, labels = names);
ggsave(filename=options[4],plot=hist_indel_plot);