diff wrapper.sh @ 62:4262e880472d draft

Uploaded
author davidvanzessen
date Fri, 25 Mar 2016 04:39:18 -0400
parents 8bb4d6009e08
children a7381fd96dad
line wrap: on
line diff
--- a/wrapper.sh	Fri Mar 18 08:17:08 2016 -0400
+++ b/wrapper.sh	Fri Mar 25 04:39:18 2016 -0400
@@ -14,6 +14,7 @@
 mkdir $outdir
 
 echo "---------------- read parameters ----------------"
+echo "---------------- read parameters ----------------" > $output
 
 echo "unpacking IMGT file"
 
@@ -42,6 +43,7 @@
 echo "${BLASTN_DIR}"
 
 echo "identification ($method)"
+echo "identification ($method)" >> $output
 
 echo "blast or custom"
 
@@ -64,10 +66,12 @@
 fi
 
 echo "---------------- merge_and_filter.r ----------------"
+echo "---------------- merge_and_filter.r ----------------" >> $output
 
 Rscript $dir/merge_and_filter.r $PWD/summary.txt $PWD/sequences.txt $PWD/mutationanalysis.txt $PWD/mutationstats.txt $PWD/hotspots.txt $outdir/identified_genes.txt $outdir/merged.txt $outdir/unmatched.txt $method $functionality $unique ${filter_unique}
 
 echo "---------------- mutation_analysis.r ----------------"
+echo "---------------- mutation_analysis.r ----------------" >> $output
 
 genes="ca,ca1,ca2,cg,cg1,cg2,cg3,cg4,cm"
 echo "R mutation analysis"
@@ -79,11 +83,13 @@
 
 
 echo "---------------- mutation_analysis.py ----------------"
+echo "---------------- mutation_analysis.py ----------------" >> $output
 
 python $dir/mutation_analysis.py --input $outdir/merged.txt --genes $genes --includefr1 "${include_fr1}" --output $outdir/hotspot_analysis.txt
 echo "R AA histogram"
 
 echo "---------------- aa_histogram.r ----------------"
+echo "---------------- aa_histogram.r ----------------" >> $output
 
 Rscript $dir/aa_histogram.r $outdir/aa_mutations.txt $outdir/aa_histogram.png 2>&1
 
@@ -92,7 +98,21 @@
 funcs=(sum mean median)
 
 
-echo "<html><center><h1>$title</h1></center>" >> $output
+echo "<html><center><h1>$title</h1></center>" > $output
+
+#display the matched/unmatched for clearity
+
+matched_count="`cat $outdir/merged.txt | tail -n +2 | wc -l`"
+unmatched_count="`cat $outdir/unmatched.txt | tail -n +2 | wc -l`"
+total_count=$((matched_count + unmatched_count))
+perc_count=$((unmatched_count / total_count * 100))
+perc_count=`bc -l <<< "scale=2; ${unmatched_count} / ${total_count} * 100"`
+perc_count=`bc -l <<< "scale=2; (${unmatched_count} / ${total_count} * 100 ) / 1"`
+
+echo "<center><h2>Total: ${total_count}</h2></center>" >> $output
+echo "<center><h2>Matched: ${matched_count} Unmatched: ${unmatched_count}</h2></center>" >> $output
+echo "<center><h2>Percentage unmatched: ${perc_count}</h2></center>" >> $output
+
 echo "---------------- main tables ----------------"
 for func in ${funcs[@]}
 do