changeset 105:e4957ad476a2 draft

Uploaded
author davidvanzessen
date Thu, 23 Jun 2016 03:58:03 -0400
parents 603a10976e9c
children 074ae1e30e8f
files aa_histogram.r tmp/igat.r wrapper.sh
diffstat 3 files changed, 20 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/aa_histogram.r	Wed Jun 22 10:07:28 2016 -0400
+++ b/aa_histogram.r	Thu Jun 23 03:58:03 2016 -0400
@@ -20,20 +20,8 @@
 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 ----------------")
 
-#also need these two, I don't even know...
-print(paste("dat_freq", length(dat_freq)))
-print(paste("dat_dt", nrow(dat_dt)))
-
 m = ggplot(dat_dt, aes(x=i, y=freq)) + theme(axis.text.x = element_text(angle = 90, hjust = 1))
 m = m + geom_bar(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")
@@ -45,9 +33,7 @@
 
 print("---------------- write/print ----------------")
 
-print("writing dat_dt") #need this
 write.table(dat_dt, paste(dirname(outfile), "/aa_histogram_", gene, ".txt", sep=""), sep="\t",quote=F,row.names=F,col.names=T)
-print("writing png") #also need this, file is haunted
 png(filename=outfile, width=1280, height=720)
 print(m)
 dev.off()
--- a/tmp/igat.r	Wed Jun 22 10:07:28 2016 -0400
+++ b/tmp/igat.r	Thu Jun 23 03:58:03 2016 -0400
@@ -13,14 +13,14 @@
 merged = merged[!grepl("unmatched", merged$best_match),]
 
 for(f in list.files(imgt.dir, pattern="*.txt$")){
-	print(paste("filtering", f))
+	#print(paste("filtering", f))
 	path = paste(imgt.dir, f, sep="")
 	dat = read.table(path, header=T, sep="\t", fill=T, quote="", stringsAsFactors=F)
 	
 	dat = dat[dat$Sequence.ID %in% merged$Sequence.ID,]
 	
-	if(nrow(dat) > 0 &  "FR1.IMGT" %in% colnames(dat)){
-		dat$FR1.IMGT = ""
+	if(nrow(dat) > 0 & grepl("^8_", f)){ #change the FR1 columns to 0 in the "8_..." file
+		dat[,grepl("^FR1", names(dat))] = 0
 	}
 	
 	write.table(dat, path, quote=F, sep="\t", row.names=F, col.names=T)
--- a/wrapper.sh	Wed Jun 22 10:07:28 2016 -0400
+++ b/wrapper.sh	Thu Jun 23 03:58:03 2016 -0400
@@ -146,11 +146,23 @@
 python $dir/mutation_analysis.py --input $outdir/merged.txt --genes $classes --includefr1 "${include_fr1}" --output $outdir/hotspot_analysis.txt
 
 echo "---------------- aa_histogram.r ----------------"
-echo "---------------- aa_histogram.r ----------------<br />" >> $output
+echo "---------------- aa_histogram.r ----------------<br />" >> $log
 
 Rscript $dir/aa_histogram.r $outdir/aa_mutations.txt $outdir/aa_histogram.png "" 2>&1
+
+echo "---------------- aa_histogram.r ca ----------------"
+echo "---------------- aa_histogram.r ca ----------------<br />" >> $log
+
 Rscript $dir/aa_histogram.r $outdir/aa_mutations_ca.txt $outdir/aa_histogram_ca.png "ca" 2>&1
+
+echo "---------------- aa_histogram.r cg ----------------"
+echo "---------------- aa_histogram.r cg ----------------<br />" >> $log
+
 Rscript $dir/aa_histogram.r $outdir/aa_mutations_cg.txt $outdir/aa_histogram_cg.png "cg" 2>&1
+
+echo "---------------- aa_histogram.r cm ----------------"
+echo "---------------- aa_histogram.r cm ----------------<br />" >> $log
+
 Rscript $dir/aa_histogram.r $outdir/aa_mutations_cm.txt $outdir/aa_histogram_cm.png "cm" 2>&1
 
 genes=(ca ca1 ca2 cg cg1 cg2 cg3 cg4 cm)
@@ -367,10 +379,10 @@
 
 echo "</table>" >> $outdir/base_overview.html
 
+mv $log $outdir/log.html
+
+cp $outdir/index.html $log
+
 echo "---------------- Done! ----------------"
 echo "---------------- Done! ----------------<br />" >> $log
 
-mv $log $outdir/log.html
-
-mv $outdir/index.html $log
-