# HG changeset patch # User davidvanzessen # Date 1456826807 18000 # Node ID a4317b006d70fd6d3fa84321721c7abe6743eef0 # Parent 0d5add1a9800f95d7d1a11aa5617dbf088fd1b2c Uploaded diff -r 0d5add1a9800 -r a4317b006d70 aa_histogram.r --- a/aa_histogram.r Tue Mar 01 04:53:06 2016 -0500 +++ b/aa_histogram.r Tue Mar 01 05:06:47 2016 -0500 @@ -5,22 +5,30 @@ input = args[1] outfile = args[2] +print("---------------- read input ----------------") + dat = read.table(input, sep="\t", fill=T, header=T, quote="") - +print("---------------- as numeric ----------------") mutations.at.position = as.numeric(dat[1,]) aa.at.position = as.numeric(dat[2,]) +print("---------------- freq data.frame ----------------") + dat_freq = mutations.at.position / aa.at.position dat_dt = data.frame(i=1:length(dat_freq), freq=dat_freq) +print("---------------- weird stuff ----------------") + options(width=220) print(dat[,20:40]) print(dat_dt) #need this or it will fail???? +print("---------------- plot ----------------") + m = ggplot(dat_dt, aes(x=i, y=freq)) + theme(axis.text.x = element_text(angle = 90, hjust = 1)) m = m + geom_histogram(stat="identity", colour = "black", fill = "darkgrey", alpha=0.8) + scale_x_continuous(breaks=1:length(dat_freq), labels=1:length(dat_freq)) m = m + annotate("segment", x = 0.5, y = -0.05, xend=26.5, yend=-0.05, colour="darkgreen", size=1) + annotate("text", x = 13, y = -0.1, label="FR1")