diff wrapper.sh @ 5:012a738edf5a draft

Uploaded
author davidvanzessen
date Tue, 01 Nov 2016 10:15:37 -0400
parents 477e95b098fd
children 2ddb9a21f635
line wrap: on
line diff
--- a/wrapper.sh	Mon Oct 31 05:05:26 2016 -0400
+++ b/wrapper.sh	Tue Nov 01 10:15:37 2016 -0400
@@ -16,6 +16,7 @@
 filter_unique=${12}
 class_filter=${13}
 empty_region_filter=${14}
+fast=${15}
 mkdir $outdir
 
 tar -xzf $dir/style.tar.gz -C $outdir
@@ -62,101 +63,112 @@
 
 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} ${empty_region_filter} 2>&1
 
-echo "---------------- creating new IMGT zips ----------------"
-echo "---------------- creating new IMGT zips ----------------<br />" >> $log
+if [[ "$fast" == "no" ]] ; then
 
-mkdir $outdir/new_IMGT
+	echo "---------------- creating new IMGT zips ----------------"
+	echo "---------------- creating new IMGT zips ----------------<br />" >> $log
+
+	mkdir $outdir/new_IMGT
 
-cat `find $PWD/files/ -name "1_*"` > "$outdir/new_IMGT/1_Summary.txt"
-cat `find $PWD/files/ -name "2_*"` > "$outdir/new_IMGT/2_IMGT-gapped-nt-sequences.txt"
-cat `find $PWD/files/ -name "3_*"` > "$outdir/new_IMGT/3_Nt-sequences.txt"
-cat `find $PWD/files/ -name "4_*"` > "$outdir/new_IMGT/4_IMGT-gapped-AA-sequences.txt"
-cat `find $PWD/files/ -name "5_*"` > "$outdir/new_IMGT/5_AA-sequences.txt"
-cat `find $PWD/files/ -name "6_*"` > "$outdir/new_IMGT/6_Junction.txt"
-cat `find $PWD/files/ -name "7_*"` > "$outdir/new_IMGT/7_V-REGION-mutation-and-AA-change-table.txt"
-cat `find $PWD/files/ -name "8_*"` > "$outdir/new_IMGT/8_V-REGION-nt-mutation-statistics.txt"
-cat `find $PWD/files/ -name "9_*"` > "$outdir/new_IMGT/9_V-REGION-AA-change-statistics.txt"
-cat `find $PWD/files/ -name "10_*"` > "$outdir/new_IMGT/10_V-REGION-mutation-hotspots.txt"
+	cat `find $PWD/files/ -name "1_*"` > "$outdir/new_IMGT/1_Summary.txt"
+	cat `find $PWD/files/ -name "2_*"` > "$outdir/new_IMGT/2_IMGT-gapped-nt-sequences.txt"
+	cat `find $PWD/files/ -name "3_*"` > "$outdir/new_IMGT/3_Nt-sequences.txt"
+	cat `find $PWD/files/ -name "4_*"` > "$outdir/new_IMGT/4_IMGT-gapped-AA-sequences.txt"
+	cat `find $PWD/files/ -name "5_*"` > "$outdir/new_IMGT/5_AA-sequences.txt"
+	cat `find $PWD/files/ -name "6_*"` > "$outdir/new_IMGT/6_Junction.txt"
+	cat `find $PWD/files/ -name "7_*"` > "$outdir/new_IMGT/7_V-REGION-mutation-and-AA-change-table.txt"
+	cat `find $PWD/files/ -name "8_*"` > "$outdir/new_IMGT/8_V-REGION-nt-mutation-statistics.txt"
+	cat `find $PWD/files/ -name "9_*"` > "$outdir/new_IMGT/9_V-REGION-AA-change-statistics.txt"
+	cat `find $PWD/files/ -name "10_*"` > "$outdir/new_IMGT/10_V-REGION-mutation-hotspots.txt"
 
-mkdir $outdir/new_IMGT_IGA
-cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA
+	mkdir $outdir/new_IMGT_IGA
+	cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA
 
-mkdir $outdir/new_IMGT_IGA1
-cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA1
+	mkdir $outdir/new_IMGT_IGA1
+	cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA1
 
-mkdir $outdir/new_IMGT_IGA2
-cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA2
+	mkdir $outdir/new_IMGT_IGA2
+	cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA2
 
-mkdir $outdir/new_IMGT_IGG
-cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG
+	mkdir $outdir/new_IMGT_IGG
+	cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG
 
-mkdir $outdir/new_IMGT_IGG1
-cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG1
+	mkdir $outdir/new_IMGT_IGG1
+	cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG1
 
-mkdir $outdir/new_IMGT_IGG2
-cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG2
+	mkdir $outdir/new_IMGT_IGG2
+	cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG2
 
-mkdir $outdir/new_IMGT_IGG3
-cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG3
+	mkdir $outdir/new_IMGT_IGG3
+	cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG3
 
-mkdir $outdir/new_IMGT_IGG4
-cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG4
+	mkdir $outdir/new_IMGT_IGG4
+	cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG4
+
+	mkdir $outdir/new_IMGT_IGM
+	cp $outdir/new_IMGT/* $outdir/new_IMGT_IGM
 
-mkdir $outdir/new_IMGT_IGM
-cp $outdir/new_IMGT/* $outdir/new_IMGT_IGM
+	mkdir $outdir/new_IMGT_IGE
+	cp $outdir/new_IMGT/* $outdir/new_IMGT_IGE
 
-Rscript $dir/new_imgt.r $outdir/new_IMGT/ $outdir/merged.txt "-" 2>&1
+	Rscript $dir/new_imgt.r $outdir/new_IMGT/ $outdir/merged.txt "-" 2>&1
+
+	Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA/ $outdir/merged.txt "IGA" 2>&1
+	Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA1/ $outdir/merged.txt "IGA1" 2>&1
+	Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA2/ $outdir/merged.txt "IGA2" 2>&1
 
-Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA/ $outdir/merged.txt "IGA" 2>&1
-Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA1/ $outdir/merged.txt "IGA1" 2>&1
-Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA2/ $outdir/merged.txt "IGA2" 2>&1
+	Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG/ $outdir/merged.txt "IGG" 2>&1
+	Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG1/ $outdir/merged.txt "IGG1" 2>&1
+	Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG2/ $outdir/merged.txt "IGG2" 2>&1
+	Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG3/ $outdir/merged.txt "IGG3" 2>&1
+	Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG4/ $outdir/merged.txt "IGG4" 2>&1
 
-Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG/ $outdir/merged.txt "IGG" 2>&1
-Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG1/ $outdir/merged.txt "IGG1" 2>&1
-Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG2/ $outdir/merged.txt "IGG2" 2>&1
-Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG3/ $outdir/merged.txt "IGG3" 2>&1
-Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG4/ $outdir/merged.txt "IGG4" 2>&1
+	Rscript $dir/new_imgt.r $outdir/new_IMGT_IGM/ $outdir/merged.txt "IGM" 2>&1
 
-Rscript $dir/new_imgt.r $outdir/new_IMGT_IGM/ $outdir/merged.txt "IGM" 2>&1
+	Rscript $dir/new_imgt.r $outdir/new_IMGT_IGE/ $outdir/merged.txt "IGE" 2>&1
 
 
-tmp="$PWD"
-cd $outdir/new_IMGT/ #tar weirdness...
-tar -cJf ../new_IMGT.txz *
+	tmp="$PWD"
+	cd $outdir/new_IMGT/ #tar weirdness...
+	tar -cJf ../new_IMGT.txz *
 
-cd $outdir/new_IMGT_IGA/
-tar -cJf ../new_IMGT_IGA.txz *
+	cd $outdir/new_IMGT_IGA/
+	tar -cJf ../new_IMGT_IGA.txz *
 
-cd $outdir/new_IMGT_IGA1/
-tar -cJf ../new_IMGT_IGA1.txz *
+	cd $outdir/new_IMGT_IGA1/
+	tar -cJf ../new_IMGT_IGA1.txz *
 
-cd $outdir/new_IMGT_IGA2/
-tar -cJf ../new_IMGT_IGA2.txz *
+	cd $outdir/new_IMGT_IGA2/
+	tar -cJf ../new_IMGT_IGA2.txz *
 
-cd $outdir/new_IMGT_IGG/
-tar -cJf ../new_IMGT_IGG.txz *
+	cd $outdir/new_IMGT_IGG/
+	tar -cJf ../new_IMGT_IGG.txz *
 
-cd $outdir/new_IMGT_IGG1/
-tar -cJf ../new_IMGT_IGG1.txz *
+	cd $outdir/new_IMGT_IGG1/
+	tar -cJf ../new_IMGT_IGG1.txz *
 
-cd $outdir/new_IMGT_IGG2/
-tar -cJf ../new_IMGT_IGG2.txz *
+	cd $outdir/new_IMGT_IGG2/
+	tar -cJf ../new_IMGT_IGG2.txz *
+
+	cd $outdir/new_IMGT_IGG3/
+	tar -cJf ../new_IMGT_IGG3.txz *
 
-cd $outdir/new_IMGT_IGG3/
-tar -cJf ../new_IMGT_IGG3.txz *
+	cd $outdir/new_IMGT_IGG4/
+	tar -cJf ../new_IMGT_IGG4.txz *
+
+	cd $outdir/new_IMGT_IGM/
+	tar -cJf ../new_IMGT_IGM.txz *
 
-cd $outdir/new_IMGT_IGG4/
-tar -cJf ../new_IMGT_IGG4.txz *
+	cd $outdir/new_IMGT_IGE/
+	tar -cJf ../new_IMGT_IGE.txz *
 
-cd $outdir/new_IMGT_IGM/
-tar -cJf ../new_IMGT_IGM.txz *
-
-cd $tmp
+	cd $tmp
+fi
 
 echo "---------------- shm_csr.r ----------------"
 echo "---------------- shm_csr.r ----------------<br />" >> $log
 
-classes="IGA,IGA1,IGA2,IGG,IGG1,IGG2,IGG3,IGG4,IGM,unmatched"
+classes="IGA,IGA1,IGA2,IGG,IGG1,IGG2,IGG3,IGG4,IGM,IGE,unmatched"
 echo "R mutation analysis"
 Rscript $dir/shm_csr.r $outdir/merged.txt $classes $outdir ${empty_region_filter} 2>&1
 
@@ -168,13 +180,13 @@
 echo "---------------- aa_histogram.r ----------------"
 echo "---------------- aa_histogram.r ----------------<br />" >> $log
 
-Rscript $dir/aa_histogram.r $outdir/aa_id_mutations.txt $outdir/absent_aa_id.txt "IGA,IGG,IGM" $outdir/ 2>&1
+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_.txt $outdir/aa_histogram.txt
 fi
 
-genes=(IGA IGA1 IGA2 IGG IGG1 IGG2 IGG3 IGG4 IGM)
+genes=(IGA IGA1 IGA2 IGG IGG1 IGG2 IGG3 IGG4 IGM IGE)
 
 funcs=(sum mean median)
 funcs=(sum)
@@ -247,14 +259,14 @@
 		tmp=`cat $outdir/unmatched_${func}_n.txt`
 		echo "<th><a href='unmatched.txt'>unmatched (N = ${unmatched_count})</a></th><tr></thead>" >> $output
 
-		while IFS=, read name cax cay caz ca1x ca1y ca1z ca2x ca2y ca2z cgx cgy cgz cg1x cg1y cg1z cg2x cg2y cg2z cg3x cg3y cg3z cg4x cg4y cg4z cmx cmy cmz unx uny unz allx ally allz
+		while IFS=, read name cax cay caz ca1x ca1y ca1z ca2x ca2y ca2z cgx cgy cgz cg1x cg1y cg1z cg2x cg2y cg2z cg3x cg3y cg3z cg4x cg4y cg4z cmx cmy cmz cex cey cez unx uny unz allx ally allz 
 		do
 			if [ "$name" == "FR R/S (ratio)" ] || [ "$name" == "CDR R/S (ratio)" ] ; then #meh
-				echo "<tr><td>$name</td><td>${cax}/${cay} (${caz})</td><td>${ca1x}/${ca1y} (${ca1z})</td><td>${ca2x}/${ca2y} (${ca2z})</td><td>${cgx}/${cgy} (${cgz})</td><td>${cg1x}/${cg1y} (${cg1z})</td><td>${cg2x}/${cg2y} (${cg2z})</td><td>${cg3x}/${cg3y} (${cg3z})</td><td>${cg4x}/${cg4y} (${cg4z})</td><td>${cmx}/${cmy} (${cmz})</td><td>${allx}/${ally} (${allz})</td><td>${unx}/${uny} (${unz})</td></tr>" >> $output
+				echo "<tr><td>$name</td><td>${cax}/${cay} (${caz})</td><td>${ca1x}/${ca1y} (${ca1z})</td><td>${ca2x}/${ca2y} (${ca2z})</td><td>${cgx}/${cgy} (${cgz})</td><td>${cg1x}/${cg1y} (${cg1z})</td><td>${cg2x}/${cg2y} (${cg2z})</td><td>${cg3x}/${cg3y} (${cg3z})</td><td>${cg4x}/${cg4y} (${cg4z})</td><td>${cmx}/${cmy} (${cmz})</td><td>${cex}/${cey} (${cez})</td><td>${allx}/${ally} (${allz})</td><td>${unx}/${uny} (${unz})</td></tr>" >> $output
 			elif [ "$name" == "Median of Number of Mutations (%)" ] ; then
-				echo "<tr><td>$name</td><td>${caz}%</td><td>${ca1z}%</td><td>${ca2z}%</td><td>${cgz}%</td><td>${cg1z}%</td><td>${cg2z}%</td><td>${cg3z}%</td><td>${cg4z}%</td><td>${cmz}%</td><td>${allz}%</td><td>${unz}%</td></tr>" >> $output
+				echo "<tr><td>$name</td><td>${caz}%</td><td>${ca1z}%</td><td>${ca2z}%</td><td>${cgz}%</td><td>${cg1z}%</td><td>${cg2z}%</td><td>${cg3z}%</td><td>${cg4z}%</td><td>${cmz}%</td><td>${cez}%</td><td>${allz}%</td><td>${unz}%</td></tr>" >> $output
 			else
-				echo "<tr><td>$name</td><td>${cax}/${cay} (${caz}%)</td><td>${ca1x}/${ca1y} (${ca1z}%)</td><td>${ca2x}/${ca2y} (${ca2z}%)</td><td>${cgx}/${cgy} (${cgz}%)</td><td>${cg1x}/${cg1y} (${cg1z}%)</td><td>${cg2x}/${cg2y} (${cg2z}%)</td><td>${cg3x}/${cg3y} (${cg3z}%)</td><td>${cg4x}/${cg4y} (${cg4z}%)</td><td>${cmx}/${cmy} (${cmz}%)</td><td>${allx}/${ally} (${allz}%)</td><td>${unx}/${uny} (${unz}%)</td></tr>" >> $output
+				echo "<tr><td>$name</td><td>${cax}/${cay} (${caz}%)</td><td>${ca1x}/${ca1y} (${ca1z}%)</td><td>${ca2x}/${ca2y} (${ca2z}%)</td><td>${cgx}/${cgy} (${cgz}%)</td><td>${cg1x}/${cg1y} (${cg1z}%)</td><td>${cg2x}/${cg2y} (${cg2z}%)</td><td>${cg3x}/${cg3y} (${cg3z}%)</td><td>${cg4x}/${cg4y} (${cg4z}%)</td><td>${cmx}/${cmy} (${cmz}%)</td><td>${cex}/${cey} (${cez}%)</td><td>${allx}/${ally} (${allz}%)</td><td>${unx}/${uny} (${unz}%)</td></tr>" >> $output
 			fi
 		done < $outdir/data_${func}.txt
 		
@@ -262,7 +274,7 @@
 		tmp=`cat $outdir/all_${func}_n.txt`
 		echo "<th><a href='matched_all_${func}.txt'>all (N = $tmp)</a></th>" >> $output
 		
-		while IFS=, read name cax cay caz ca1x ca1y ca1z ca2x ca2y ca2z cgx cgy cgz cg1x cg1y cg1z cg2x cg2y cg2z cg3x cg3y cg3z cg4x cg4y cg4z cmx cmy cmz unx uny unz allx ally allz
+		while IFS=, read name cax cay caz ca1x ca1y ca1z ca2x ca2y ca2z cgx cgy cgz cg1x cg1y cg1z cg2x cg2y cg2z cg3x cg3y cg3z cg4x cg4y cg4z cmx cmy cmz cex cey cez unx uny unz allx ally allz
 		do
 			if [ "$name" == "FR R/S (ratio)" ] || [ "$name" == "CDR R/S (ratio)" ] ; then #meh
 				echo "<tr><td>$name</td><td>${allx}/${ally}</td></tr>" >> $output
@@ -381,46 +393,48 @@
 
 echo "</div>" >> $output #CSR tab end
 
-echo "---------------- change-o MakeDB ----------------"
+if [[ "$fast" == "no" ]] ; then
+
+	echo "---------------- change-o MakeDB ----------------"
 
-mkdir $outdir/change_o
+	mkdir $outdir/change_o
 
-tmp="$PWD"
+	tmp="$PWD"
 
-cd $outdir/change_o
+	cd $outdir/change_o
 
-bash $dir/change_o/makedb.sh $outdir/new_IMGT.txz false false false $outdir/change_o/change-o-db.txt
-bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones.txt $outdir/change_o/change-o-defined_clones-summary.txt
+	bash $dir/change_o/makedb.sh $outdir/new_IMGT.txz false false false $outdir/change_o/change-o-db.txt
+	bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones.txt $outdir/change_o/change-o-defined_clones-summary.txt
 
-Rscript $dir/merge.r $outdir/change_o/change-o-db-defined_clones.txt $outdir/merged.txt "all" "Sequence.ID,best_match" "SEQUENCE_ID" "Sequence.ID" $outdir/change_o/change-o-db-defined_clones.txt 2>&1
+	Rscript $dir/merge.r $outdir/change_o/change-o-db-defined_clones.txt $outdir/merged.txt "all" "Sequence.ID,best_match" "SEQUENCE_ID" "Sequence.ID" $outdir/change_o/change-o-db-defined_clones.txt 2>&1
 
-echo "Rscript $dir/merge.r $outdir/change_o/change-o-db-defined_clones.txt $outdir/$outdir/merged.txt 'all' 'Sequence.ID,best_match' 'Sequence.ID' 'Sequence.ID' '\t' $outdir/change_o/change-o-db-defined_clones.txt 2>&1"
+	echo "Rscript $dir/merge.r $outdir/change_o/change-o-db-defined_clones.txt $outdir/$outdir/merged.txt 'all' 'Sequence.ID,best_match' 'Sequence.ID' 'Sequence.ID' '\t' $outdir/change_o/change-o-db-defined_clones.txt 2>&1"
 
-if [[ $(wc -l < $outdir/new_IMGT_IGA/1_Summary.txt) -gt "1" ]]; then
-	bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGA.txz false false false $outdir/change_o/change-o-db-IGA.txt
-	bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db-IGA.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones-IGA.txt $outdir/change_o/change-o-defined_clones-summary-IGA.txt
-else
-	echo "No IGA sequences" > "$outdir/change_o/change-o-db-defined_clones-IGA.txt"
-	echo "No IGA sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGA.txt"
-fi
+	if [[ $(wc -l < $outdir/new_IMGT_IGA/1_Summary.txt) -gt "1" ]]; then
+		bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGA.txz false false false $outdir/change_o/change-o-db-IGA.txt
+		bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db-IGA.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones-IGA.txt $outdir/change_o/change-o-defined_clones-summary-IGA.txt
+	else
+		echo "No IGA sequences" > "$outdir/change_o/change-o-db-defined_clones-IGA.txt"
+		echo "No IGA sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGA.txt"
+	fi
 
-if [[ $(wc -l < $outdir/new_IMGT_IGG/1_Summary.txt) -gt "1" ]]; then
-	bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGG.txz false false false $outdir/change_o/change-o-db-IGG.txt
-	bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db-IGG.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones-IGG.txt $outdir/change_o/change-o-defined_clones-summary-IGG.txt
-else
-	echo "No IGG sequences" > "$outdir/change_o/change-o-db-defined_clones-IGG.txt"
-	echo "No IGG sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGG.txt"
-fi
+	if [[ $(wc -l < $outdir/new_IMGT_IGG/1_Summary.txt) -gt "1" ]]; then
+		bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGG.txz false false false $outdir/change_o/change-o-db-IGG.txt
+		bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db-IGG.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones-IGG.txt $outdir/change_o/change-o-defined_clones-summary-IGG.txt
+	else
+		echo "No IGG sequences" > "$outdir/change_o/change-o-db-defined_clones-IGG.txt"
+		echo "No IGG sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGG.txt"
+	fi
 
-if [[ $(wc -l < $outdir/new_IMGT_IGM/1_Summary.txt) -gt "1" ]]; then
-	bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGM.txz false false false $outdir/change_o/change-o-db-IGM.txt
-	bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db-IGM.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones-IGM.txt $outdir/change_o/change-o-defined_clones-summary-IGM.txt
-else
-	echo "No IGM sequences" > "$outdir/change_o/change-o-db-defined_clones-IGM.txt"
-	echo "No IGM sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGM.txt"
-fi
+	if [[ $(wc -l < $outdir/new_IMGT_IGM/1_Summary.txt) -gt "1" ]]; then
+		bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGM.txz false false false $outdir/change_o/change-o-db-IGM.txt
+		bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db-IGM.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones-IGM.txt $outdir/change_o/change-o-defined_clones-summary-IGM.txt
+	else
+		echo "No IGM sequences" > "$outdir/change_o/change-o-db-defined_clones-IGM.txt"
+		echo "No IGM sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGM.txt"
+	fi
 
-PWD="$tmp"
+	PWD="$tmp"
 
 echo "<div class='tabbertab' title='Clonality'>" >> $output #clonality tab
 
@@ -471,6 +485,8 @@
 
 echo "</div>" >> $output #clonality tab end
 
+fi
+
 echo "<div class='tabbertab' title='Downloads'>" >> $output
 
 echo "<table class='pure-table pure-table-striped'>" >> $output
@@ -553,54 +569,59 @@
 
 echo "</html>" >> $output
 
-echo "---------------- baseline ----------------"
-echo "---------------- baseline ----------------<br />" >> $log
-tmp="$PWD"
+
+if [[ "$fast" == "no" ]] ; then
 
-mkdir $outdir/baseline
+	echo "---------------- baseline ----------------"
+	echo "---------------- baseline ----------------<br />" >> $log
+	tmp="$PWD"
+
+	mkdir $outdir/baseline
 
 
-mkdir $outdir/baseline/IGA_IGG_IGM
-if [[ $(wc -l < $outdir/new_IMGT/1_Summary.txt) -gt "1" ]]; then
-	cd $outdir/baseline/IGA_IGG_IGM
-	bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT.txz "IGA_IGG_IGM" "$dir/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/IGA_IGG_IGM
+	if [[ $(wc -l < $outdir/new_IMGT/1_Summary.txt) -gt "1" ]]; then
+		cd $outdir/baseline/IGA_IGG_IGM
+		bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT.txz "IGA_IGG_IGM" "$dir/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/IGA
-if [[ $(wc -l < $outdir/new_IMGT_IGA/1_Summary.txt) -gt "1" ]]; then
-	cd $outdir/baseline/IGA
-	bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_IGA.txz "IGA" "$dir/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_IGA.pdf" "Sequence.ID" "$outdir/baseline_IGA.txt"
-else
-	echo "No IGA sequences" > "$outdir/baseline_IGA.txt"
-fi
+	mkdir $outdir/baseline/IGA
+	if [[ $(wc -l < $outdir/new_IMGT_IGA/1_Summary.txt) -gt "1" ]]; then
+		cd $outdir/baseline/IGA
+		bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_IGA.txz "IGA" "$dir/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_IGA.pdf" "Sequence.ID" "$outdir/baseline_IGA.txt"
+	else
+		echo "No IGA sequences" > "$outdir/baseline_IGA.txt"
+	fi
 
-mkdir $outdir/baseline/IGG
-if [[ $(wc -l < $outdir/new_IMGT_IGG/1_Summary.txt) -gt "1" ]]; then
-	cd $outdir/baseline/IGG
-	bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_IGG.txz "cg" "$dir/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_IGG.pdf" "Sequence.ID" "$outdir/baseline_IGG.txt"
-else
-	echo "No IGG sequences" > "$outdir/baseline_IGG.txt"
-fi
+	mkdir $outdir/baseline/IGG
+	if [[ $(wc -l < $outdir/new_IMGT_IGG/1_Summary.txt) -gt "1" ]]; then
+		cd $outdir/baseline/IGG
+		bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_IGG.txz "cg" "$dir/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_IGG.pdf" "Sequence.ID" "$outdir/baseline_IGG.txt"
+	else
+		echo "No IGG sequences" > "$outdir/baseline_IGG.txt"
+	fi
 
-mkdir $outdir/baseline/IGM
-if [[ $(wc -l < $outdir/new_IMGT_IGM/1_Summary.txt) -gt "1" ]]; then
-	cd $outdir/baseline/IGM
-	bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_IGM.txz "IGM" "$dir/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_IGM.pdf" "Sequence.ID" "$outdir/baseline_IGM.txt"
-else
-	echo "No IGM sequences" > "$outdir/baseline_IGM.txt"
+	mkdir $outdir/baseline/IGM
+	if [[ $(wc -l < $outdir/new_IMGT_IGM/1_Summary.txt) -gt "1" ]]; then
+		cd $outdir/baseline/IGM
+		bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_IGM.txz "IGM" "$dir/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_IGM.pdf" "Sequence.ID" "$outdir/baseline_IGM.txt"
+	else
+		echo "No IGM sequences" > "$outdir/baseline_IGM.txt"
+	fi
+
+	cd $tmp
+
+	echo "Cleaning up *.RData files"
+	find $outdir/baseline -name "*.RData" -type f -delete
+
 fi
 
-cd $tmp
-
-echo "Cleaning up *.RData files"
-find $outdir/baseline -name "*.RData" -type f -delete
-
 echo "---------------- naive_output.r ----------------"
 echo "---------------- naive_output.r ----------------<br />" >> $log
 
-if [[ "$naive_output" != "None" ]]
+if [[ "$naive_output" == "yes" ]]
 then
 	cp $outdir/new_IMGT_IGA.txz ${naive_output_ca}
 	cp $outdir/new_IMGT_IGG.txz ${naive_output_cg}