Mercurial > repos > davidvanzessen > mutation_analysis
diff wrapper.sh @ 102:e6bc976760d4 draft
Uploaded
author | davidvanzessen |
---|---|
date | Tue, 21 Jun 2016 03:32:50 -0400 |
parents | 3cffb8a38bb1 |
children | 603a10976e9c |
line wrap: on
line diff
--- a/wrapper.sh Fri Jun 17 08:31:20 2016 -0400 +++ b/wrapper.sh Tue Jun 21 03:32:50 2016 -0400 @@ -3,8 +3,9 @@ dir="$(cd "$(dirname "$0")" && pwd)" input=$1 method=$2 -output=$3 +log=$3 #becomes the main html page at the end outdir=$4 +output="$outdir/index.html" #copied to $log location at the end title=$5 include_fr1=$6 functionality=$7 @@ -17,7 +18,7 @@ mkdir $outdir echo "---------------- read parameters ----------------" -echo "---------------- read parameters ----------------<br />" > $output +echo "---------------- read parameters ----------------<br />" > $log echo "unpacking IMGT file" @@ -56,7 +57,7 @@ echo "${BLASTN_DIR}" echo "---------------- identification ($method) ----------------" -echo "---------------- identification ($method) ----------------<br />" >> $output +echo "---------------- identification ($method) ----------------<br />" >> $log if [[ "${method}" == "custom" ]] ; then python $dir/gene_identification.py --input $PWD/summary.txt --output $outdir/identified_genes.txt @@ -73,12 +74,12 @@ fi echo "---------------- merge_and_filter.r ----------------" -echo "---------------- merge_and_filter.r ----------------<br />" >> $output +echo "---------------- merge_and_filter.r ----------------<br />" >> $log 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/before_unique_filter.txt $outdir/unmatched.txt $method $functionality $unique ${filter_unique} ${class_filter} 2>&1 echo "---------------- creating new IMGT zip ----------------" -echo "---------------- creating new IMGT zip ----------------<br />" >> $output +echo "---------------- creating new IMGT zip ----------------<br />" >> $log mkdir $outdir/new_IMGT @@ -132,7 +133,7 @@ cd $tmp echo "---------------- mutation_analysis.r ----------------" -echo "---------------- mutation_analysis.r ----------------<br />" >> $output +echo "---------------- mutation_analysis.r ----------------<br />" >> $log classes="ca,ca1,ca2,cg,cg1,cg2,cg3,cg4,cm,unmatched" echo "R mutation analysis" @@ -140,7 +141,7 @@ echo "---------------- mutation_analysis.py ----------------" -echo "---------------- mutation_analysis.py ----------------<br />" >> $output +echo "---------------- mutation_analysis.py ----------------<br />" >> $log python $dir/mutation_analysis.py --input $outdir/merged.txt --genes $classes --includefr1 "${include_fr1}" --output $outdir/hotspot_analysis.txt @@ -154,7 +155,7 @@ funcs=(sum mean median) echo "---------------- sequence_overview.r ----------------" -echo "---------------- sequence_overview.r ----------------" >> $output +echo "---------------- sequence_overview.r ----------------<br />" >> $log mkdir $outdir/sequence_overview @@ -168,7 +169,6 @@ echo "<tr><td>$ID</td><td>$seq</td><td>$class</td><td>$A</td><td>$C</td><td>$G</td><td>$T</td></tr>" >> $outdir/base_overview.html done < $outdir/sequence_overview/ntoverview.txt - echo "<html><center><h1>$title</h1></center>" > $output #display the matched/unmatched for clearity @@ -185,10 +185,12 @@ echo "<center><h2>Percentage unmatched: ${perc_count}</h2></center>" >> $output echo "---------------- main tables ----------------" +echo "---------------- main tables ----------------<br />" >> $log for func in ${funcs[@]} do echo "---------------- $func table ----------------" + echo "---------------- $func table ----------------<br />" >> $log cat $outdir/mutations_${func}.txt $outdir/hotspot_analysis_${func}.txt > $outdir/data_${func}.txt @@ -218,6 +220,7 @@ done echo "---------------- download links ----------------" +echo "---------------- download links ----------------<br />" >> $log echo "<a href='unmatched.txt'>unmatched</a><br />" >> $output @@ -247,6 +250,7 @@ echo "---------------- images ----------------" +echo "---------------- images ----------------<br />" >> $log echo "<img src='all.png'/><br />" >> $output echo "<a href='all.txt'>download data</a><br />" >> $output @@ -297,44 +301,67 @@ echo "</html>" >> $output echo "---------------- baseline ----------------" +echo "---------------- baseline ----------------<br />" >> $log tmp="$PWD" mkdir $outdir/baseline mkdir $outdir/baseline/ca_cg_cm -cd $outdir/baseline/ca_cg_cm -bash $dir/tmp/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT.txz "ca_cg_cm" "$dir/tmp/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline.pdf" "Sequence.ID" "$outdir/baseline.txt" +if [[ $(wc -l < $outdir/new_IMGT/1_Summary.txt) -gt "1" ]]; then + cd $outdir/baseline/ca_cg_cm + bash $dir/tmp/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT.txz "ca_cg_cm" "$dir/tmp/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline.pdf" "Sequence.ID" "$outdir/baseline.txt" +else + echo "No sequences" > "$outdir/baseline.txt" +fi mkdir $outdir/baseline/ca -cd $outdir/baseline/ca -bash $dir/tmp/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_ca.txz "ca" "$dir/tmp/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_ca.pdf" "Sequence.ID" "$outdir/baseline_ca.txt" +if [[ $(wc -l < $outdir/new_IMGT_ca/1_Summary.txt) -gt "1" ]]; then + cd $outdir/baseline/ca + bash $dir/tmp/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_ca.txz "ca" "$dir/tmp/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_ca.pdf" "Sequence.ID" "$outdir/baseline_ca.txt" +else + echo "No ca sequences" > "$outdir/baseline_ca.txt" +fi mkdir $outdir/baseline/cg -cd $outdir/baseline/cg -bash $dir/tmp/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_cg.txz "cg" "$dir/tmp/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_cg.pdf" "Sequence.ID" "$outdir/baseline_cg.txt" +if [[ $(wc -l < $outdir/new_IMGT_cg/1_Summary.txt) -gt "1" ]]; then + cd $outdir/baseline/cg + bash $dir/tmp/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_cg.txz "cg" "$dir/tmp/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_cg.pdf" "Sequence.ID" "$outdir/baseline_cg.txt" +else + echo "No cg sequences" > "$outdir/baseline_cg.txt" +fi mkdir $outdir/baseline/cm -cd $outdir/baseline/cm -bash $dir/tmp/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_cm.txz "cm" "$dir/tmp/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_cm.pdf" "Sequence.ID" "$outdir/baseline_cm.txt" +if [[ $(wc -l < $outdir/new_IMGT_cm/1_Summary.txt) -gt "1" ]]; then + cd $outdir/baseline/cm + bash $dir/tmp/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_cm.txz "cm" "$dir/tmp/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_cm.pdf" "Sequence.ID" "$outdir/baseline_cm.txt" +else + echo "No cm sequences" > "$outdir/baseline_cm.txt" +fi cd $tmp -#optional output for naive - echo "---------------- naive_output.r ----------------" +echo "---------------- naive_output.r ----------------<br />" >> $log if [[ "$naive_output" != "None" ]] then echo "---------------- imgt_loader.r ----------------" + echo "---------------- imgt_loader.r ----------------<br />" >> $log #python $dir/imgt_loader.py --summ $PWD/summary.txt --aa $PWD/aa.txt --junction $PWD/junction.txt --output $naive_output Rscript --verbose $dir/imgt_loader.r $PWD/summary.txt $PWD/aa.txt $PWD/junction.txt $outdir/loader_output.txt 2>&1 echo "---------------- naive_output.r ----------------" + echo "---------------- naive_output.r ----------------<br />" >> $log Rscript $dir/naive_output.r $outdir/loader_output.txt $outdir/merged.txt ${naive_output_ca} ${naive_output_cg} ${naive_output_cm} $outdir/ntoverview.txt $outdir/ntsum.txt 2>&1 fi echo "</table>" >> $outdir/base_overview.html echo "---------------- Done! ----------------" +echo "---------------- Done! ----------------<br />" >> $log +mv $log $outdir/log.html + +mv $outdir/index.html $log +