# HG changeset patch # User davidvanzessen # Date 1490703936 14400 # Node ID 1cf60ae234b4e39fed603282f5f53d398a7f42e5 # Parent b8ac74723ab0cf991053ea251ec9dbe9efa7675a Uploaded diff -r b8ac74723ab0 -r 1cf60ae234b4 aa_histogram.r --- 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) } diff -r b8ac74723ab0 -r 1cf60ae234b4 pattern_plots.r --- 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 @@ + diff -r b8ac74723ab0 -r 1cf60ae234b4 shm_csr.r --- 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),] diff -r b8ac74723ab0 -r 1cf60ae234b4 wrapper.sh --- 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 "Download data" >> $output done -echo "
" >> $output -echo "
" >> $output -echo "
" >> $output +echo "
" >> $output +echo "
" >> $output +echo "
" >> $output echo "
" >> $output cat $dir/shm_overview.htm >> $output echo "" >> $output #SHM overview tab end @@ -307,15 +308,15 @@ echo "---------------- images ----------------" echo "---------------- images ----------------
" >> $log -echo "
" >> $output +echo "
" >> $output if [ -a $outdir/scatter.png ] then - echo "
" >> $output + echo "
" >> $output fi if [ -a $outdir/frequency_ranges.png ] then - echo "
" >> $output + echo "

" >> $output fi echo "
" >> $output @@ -334,14 +335,14 @@ if [ -e $outdir/transitions_heatmap_${gene}.png ] then - echo "" >> $output + echo "" >> $output else echo "" >> $output fi if [ -e $outdir/transitions_stacked_${gene}.png ] then - echo "" >> $output + echo "" >> $output else echo "" >> $output fi @@ -365,8 +366,8 @@ echo "" >> $output echo "

All

" >> $output -echo "" >> $output -echo "" >> $output +echo "" >> $output +echo "" >> $output echo "" >> $output echo "" >> $output first="true" @@ -394,27 +395,27 @@ if [ -e $outdir/aa_histogram.png ] then - echo "
" >> $output + echo "
" >> $output fi if [ -e $outdir/aa_histogram_IGA.png ] then - echo "
" >> $output + echo "
" >> $output fi if [ -e $outdir/aa_histogram_IGG.png ] then - echo "
" >> $output + echo "
" >> $output fi if [ -e $outdir/aa_histogram_IGM.png ] then - echo "
" >> $output + echo "
" >> $output fi if [ -e $outdir/aa_histogram_IGE.png ] then - echo "
" >> $output + echo "
" >> $output fi @@ -521,11 +522,11 @@ if [ -e $outdir/IGA.png ] then - echo "
" >> $output + echo "
" >> $output fi if [ -e $outdir/IGG.png ] then - echo "
" >> $output + echo "
" >> $output fi echo "
" >> $output
To