Mercurial > repos > davidvanzessen > shm_csr
changeset 42:1cf60ae234b4 draft
Uploaded
author | davidvanzessen |
---|---|
date | Tue, 28 Mar 2017 08:25:36 -0400 |
parents | b8ac74723ab0 |
children | 77a7ac76c7b9 |
files | aa_histogram.r pattern_plots.r shm_csr.r wrapper.sh |
diffstat | 4 files changed, 42 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/aa_histogram.r Tue Mar 14 09:30:16 2017 -0400 +++ b/aa_histogram.r Tue Mar 28 08:25:36 2017 -0400 @@ -64,4 +64,6 @@ png(filename=paste(outdir, "/aa_histogram_", gene, ".png", sep=""), width=1280, height=720) print(m) dev.off() + + ggsave(paste(outdir, "/aa_histogram_", gene, ".pdf", sep=""), m, width=14, height=7) }
--- a/pattern_plots.r Tue Mar 14 09:30:16 2017 -0400 +++ b/pattern_plots.r Tue Mar 28 08:25:36 2017 -0400 @@ -9,21 +9,22 @@ plot1.path = args[2] plot1.png = paste(plot1.path, ".png", sep="") plot1.txt = paste(plot1.path, ".txt", sep="") +plot1.pdf = paste(plot1.path, ".pdf", sep="") plot2.path = args[3] plot2.png = paste(plot2.path, ".png", sep="") plot2.txt = paste(plot2.path, ".txt", sep="") +plot2.pdf = paste(plot2.path, ".pdf", sep="") plot3.path = args[4] plot3.png = paste(plot3.path, ".png", sep="") plot3.txt = paste(plot3.path, ".txt", sep="") +plot3.pdf = paste(plot3.path, ".pdf", sep="") clean.output = args[5] dat = read.table(input.file, header=F, sep=",", quote="", stringsAsFactors=F, fill=T, row.names=1) - - classes = c("IGA", "IGA1", "IGA2", "IGG", "IGG1", "IGG2", "IGG3", "IGG4", "IGM", "IGE") xyz = c("x", "y", "z") new.names = c(paste(rep(classes, each=3), xyz, sep="."), paste("un", xyz, sep="."), paste("all", xyz, sep=".")) @@ -63,6 +64,8 @@ print(p) dev.off() +ggsave(plot1.pdf, p) + data2 = dat[c(1, 5:8),] data2 = data2[,names(data2)[grepl("\\.x", names(data2))]] @@ -100,6 +103,8 @@ print(p) dev.off() +ggsave(plot2.pdf, p) + data3 = dat[c(5, 6, 8, 17:20),] data3 = data3[,names(data3)[grepl("\\.x", names(data3))]] names(data3) = gsub(".x", "", names(data3)) @@ -138,6 +143,7 @@ print(p) dev.off() +ggsave(plot3.pdf, p) @@ -169,3 +175,4 @@ +
--- a/shm_csr.r Tue Mar 14 09:30:16 2017 -0400 +++ b/shm_csr.r Tue Mar 28 08:25:36 2017 -0400 @@ -307,11 +307,16 @@ #p = p + scale_colour_manual(values=c("A" = "black", "G" = "black", "C" = "black", "T" = "black")) print(p) dev.off() + + ggsave(paste("transitions_stacked_", name, ".pdf", sep="")) + png(filename=paste("transitions_heatmap_", name, ".png", sep="")) p = ggplot(transition2, aes(factor(reorder(variable, -order.y)), factor(reorder(id, -order.x)))) + geom_tile(aes(fill = value)) + scale_fill_gradient(low="white", high="steelblue") #heatmap p = p + xlab("To base") + ylab("From Base") + ggtitle("Heatmap transition information") + theme(panel.background = element_rect(fill = "white", colour="black"), text = element_text(size=16, colour="black")) print(p) dev.off() + + ggsave(paste("transitions_heatmap_", name, ".pdf", sep="")) } else { #print("No data to plot") } @@ -394,6 +399,8 @@ png(filename="IGA.png") print(pc) dev.off() + + ggsave("IGA.pdf", pc) } print("Plotting IGG piechart") @@ -415,6 +422,8 @@ png(filename="IGG.png") print(pc) dev.off() + + ggsave("IGG.pdf", pc) } print("Plotting scatterplot") @@ -436,6 +445,8 @@ print(p) dev.off() +ggsave("scatter.pdf", p) + write.table(dat[,c("Sequence.ID", "best_match", "VRegionMutations", "VRegionNucleotides", "percentage_mutations")], "scatter.txt", sep="\t",quote=F,row.names=F,col.names=T) print("Plotting frequency ranges plot") @@ -460,6 +471,8 @@ print(p) dev.off() +ggsave("frequency_ranges.pdf", p) + frequency_bins_data_by_class = frequency_bins_data frequency_bins_data_by_class = frequency_bins_data_by_class[order(frequency_bins_data_by_class$best_match_class, frequency_bins_data_by_class$frequency_bins),]
--- a/wrapper.sh Tue Mar 14 09:30:16 2017 -0400 +++ b/wrapper.sh Tue Mar 28 08:25:36 2017 -0400 @@ -187,6 +187,7 @@ Rscript $dir/aa_histogram.r $outdir/aa_id_mutations.txt $outdir/absent_aa_id.txt "IGA,IGG,IGM,IGE" $outdir/ 2>&1 if [ -e "$outdir/aa_histogram_.png" ]; then mv $outdir/aa_histogram_.png $outdir/aa_histogram.png + mv $outdir/aa_histogram_.pdf $outdir/aa_histogram.pdf mv $outdir/aa_histogram_.txt $outdir/aa_histogram.txt mv $outdir/aa_histogram_absent_.txt $outdir/aa_histogram_absent.txt mv $outdir/aa_histogram_count_.txt $outdir/aa_histogram_count.txt @@ -297,9 +298,9 @@ #echo "<a href='data_${func}.txt'>Download data</a>" >> $output done -echo "<img src='aid_motives.png' /><br />" >> $output -echo "<img src='relative_mutations.png' /><br />" >> $output -echo "<img src='abolute_mutations.png' /><br />" >> $output +echo "<a href='aid_motives.pdf'><img src='aid_motives.png' /></a><br />" >> $output +echo "<a href='relative_mutations.pdf'><img src='relative_mutations.png' /></a><br />" >> $output +echo "<a href='abolute_mutations.pdf'><img src='abolute_mutations.png' /></a><br />" >> $output echo "<br />" >> $output cat $dir/shm_overview.htm >> $output echo "</div>" >> $output #SHM overview tab end @@ -307,15 +308,15 @@ echo "---------------- images ----------------" echo "---------------- images ----------------<br />" >> $log -echo "<div class='tabbertab' title='SHM Frequency' style='width: 3000px;'>" >> $output +echo "<div class='tabbertab' title='SHM Frequency' style='width: 3000px;'></a>" >> $output if [ -a $outdir/scatter.png ] then - echo "<img src='scatter.png'/><br />" >> $output + echo "<a href='scatter.pdf'><img src='scatter.png'/><br />" >> $output fi if [ -a $outdir/frequency_ranges.png ] then - echo "<img src='frequency_ranges.png'/><br />" >> $output + echo "<a href='frequency_ranges.pdf'><img src='frequency_ranges.png'/></a><br />" >> $output fi echo "<br />" >> $output @@ -334,14 +335,14 @@ if [ -e $outdir/transitions_heatmap_${gene}.png ] then - echo "<td><img src='transitions_heatmap_${gene}.png' /></td>" >> $output + echo "<td><a href='transitions_heatmap_${gene}.pdf'><img src='transitions_heatmap_${gene}.png' /></a></td>" >> $output else echo "<td></td>" >> $output fi if [ -e $outdir/transitions_stacked_${gene}.png ] then - echo "<td><img src='transitions_stacked_${gene}.png' /></td>" >> $output + echo "<td><a href='transitions_stacked_${gene}.pdf'><img src='transitions_stacked_${gene}.png' /></a></td>" >> $output else echo "<td></td>" >> $output fi @@ -365,8 +366,8 @@ echo "<tr>" >> $output echo "<td><h1>All</h1></td>" >> $output -echo "<td><img src='transitions_heatmap_all.png' /></td>" >> $output -echo "<td><img src='transitions_stacked_all.png' /></td>" >> $output +echo "<td><a href='transitions_heatmap_all.pdf'><img src='transitions_heatmap_all.png' /></a></td>" >> $output +echo "<td><a href='transitions_stacked_all.pdf'><img src='transitions_stacked_all.png' /></a></td>" >> $output echo "<td><table style='border-left-width: 1;' class='pure-table transition-table pure-table-bordered'>" >> $output echo "<tr><td></td><td colspan="5"><center>To</center></td></tr>" >> $output first="true" @@ -394,27 +395,27 @@ if [ -e $outdir/aa_histogram.png ] then - echo "<img src='aa_histogram.png'/><br />" >> $output + echo "<a href='aa_histogram.pdf'><img src='aa_histogram.png'/></a><br />" >> $output fi if [ -e $outdir/aa_histogram_IGA.png ] then - echo "<img src='aa_histogram_IGA.png'/><br />" >> $output + echo "<a href='aa_histogram_IGA.pdf'><img src='aa_histogram_IGA.png'/></a><br />" >> $output fi if [ -e $outdir/aa_histogram_IGG.png ] then - echo "<img src='aa_histogram_IGG.png'/><br />" >> $output + echo "<a href='aa_histogram_IGG.pdf'><img src='aa_histogram_IGG.png'/></a><br />" >> $output fi if [ -e $outdir/aa_histogram_IGM.png ] then - echo "<img src='aa_histogram_IGM.png'/><br />" >> $output + echo "<a href='aa_histogram_IGM.pdf'><img src='aa_histogram_IGM.png'/></a><br />" >> $output fi if [ -e $outdir/aa_histogram_IGE.png ] then - echo "<img src='aa_histogram_IGE.png'/><br />" >> $output + echo "<a href='aa_histogram_IGE.pdf'><img src='aa_histogram_IGE.png'/></a><br />" >> $output fi @@ -521,11 +522,11 @@ if [ -e $outdir/IGA.png ] then - echo "<img src='IGA.png'/><br />" >> $output + echo "<a href='IGA.pdf'><img src='IGA.png'/></a><br />" >> $output fi if [ -e $outdir/IGG.png ] then - echo "<img src='IGG.png'/><br />" >> $output + echo "<a href='IGG.pdf'><img src='IGG.png'/></a><br />" >> $output fi echo "<br />" >> $output