Mercurial > repos > davidvanzessen > shm_csr
diff aa_histogram.r @ 39:a24f8c93583a draft
Uploaded
author | davidvanzessen |
---|---|
date | Thu, 22 Dec 2016 09:39:27 -0500 |
parents | 80c4eebf7bc9 |
children | 1cf60ae234b4 |
line wrap: on
line diff
--- a/aa_histogram.r Tue Dec 20 09:03:15 2016 -0500 +++ b/aa_histogram.r Thu Dec 22 09:39:27 2016 -0500 @@ -15,9 +15,12 @@ absent.aa.by.id = read.table(absent.aa.by.id.file, sep="\t", fill=T, header=T, quote="") for(gene in genes){ + graph.title = paste(gene, "AA mutation frequency") if(gene == ""){ mutations.by.id.gene = mutations.by.id[!grepl("unmatched", mutations.by.id$best_match),] absent.aa.by.id.gene = absent.aa.by.id[!grepl("unmatched", absent.aa.by.id$best_match),] + + graph.title = "AA mutation frequency all" } else { mutations.by.id.gene = mutations.by.id[grepl(paste("^", gene, sep=""), mutations.by.id$best_match),] absent.aa.by.id.gene = absent.aa.by.id[grepl(paste("^", gene, sep=""), absent.aa.by.id$best_match),] @@ -33,6 +36,7 @@ dat_freq = mutations.at.position / aa.at.position dat_freq[is.na(dat_freq)] = 0 dat_dt = data.frame(i=1:length(dat_freq), freq=dat_freq) + print("---------------- plot ----------------") @@ -43,7 +47,7 @@ m = m + annotate("segment", x = 38.5, y = -0.05, xend=55.5, yend=-0.05, colour="darkgreen", size=1) + annotate("text", x = 47, y = -0.1, label="FR2") m = m + annotate("segment", x = 55.5, y = -0.07, xend=65.5, yend=-0.07, colour="darkblue", size=1) + annotate("text", x = 60.5, y = -0.15, label="CDR2") m = m + annotate("segment", x = 65.5, y = -0.05, xend=104.5, yend=-0.05, colour="darkgreen", size=1) + annotate("text", x = 85, y = -0.1, label="FR3") - m = m + expand_limits(y=c(-0.1,1)) + xlab("AA position") + ylab("Frequency") + ggtitle(paste(gene, "AA mutation frequency")) + m = m + expand_limits(y=c(-0.1,1)) + xlab("AA position") + ylab("Frequency") + ggtitle(graph.title) m = m + theme(panel.background = element_rect(fill = "white", colour="black"), panel.grid.major.y = element_line(colour = "black"), panel.grid.major.x = element_blank()) #m = m + scale_colour_manual(values=c("black"))