diff wrapper.sh @ 9:58a28427930e draft

Uploaded
author davidvanzessen
date Tue, 30 Sep 2014 10:06:57 -0400
parents fa240d1c57a9
children d980e2493657
line wrap: on
line diff
--- a/wrapper.sh	Thu Sep 18 10:28:24 2014 -0400
+++ b/wrapper.sh	Tue Sep 30 10:06:57 2014 -0400
@@ -29,7 +29,7 @@
 do
 	echo "$patient"
 	html="${patient}.html"
-	echo "$header" > $html
+	echo "$header" > "$html"
 	if [[ "$type" == *pair* ]] ; then
 		if [[ "$sample1" == *_BM* ]] || [[ "$sample1" == *_PB* ]] ; then
 			pairs_BM_PB+=( "$patient" )
@@ -45,128 +45,128 @@
 	sample1="$(echo ${sample1} | tr -d '\r' | tr -d '\n')"
 	sample2="$(echo ${sample2} | tr -d '\r' | tr -d '\n')"
 	tail -n+2 ${patient}_freq.txt | sed "s/>//" > tmp.txt
-	echo "<div class='tabber'>" >> $html
-	echo "<div class='tabbertab' title='Data frequency'>" >> $html
-	echo "<table><tr><td style='vertical-align:top;'>" >> $html
-	echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_freq'>" >> $html
-	echo "<thead><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Cut off value</th><th>Number of sequences ${patient}_Both</th><th>Number of sequences_$sample1</th><th>Read Count $sample1</th><th>Number of sequences_$sample2</th><th>Read Count $sample2</th><th>Sum number of sequences $patient</th><th>Percentage of sequences ${patient}_both</th></thead>" >> $html
-	echo "<tbody>" >> $html
+	echo "<div class='tabber'>" >> "$html"
+	echo "<div class='tabbertab' title='Data frequency'>" >> "$html"
+	echo "<table><tr><td style='vertical-align:top;'>" >> "$html"
+	echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_freq'>" >> "$html"
+	echo "<thead><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Cut off value</th><th>Number of sequences ${patient}_Both</th><th>Number of sequences_$sample1</th><th>Read Count $sample1</th><th>Number of sequences_$sample2</th><th>Read Count $sample2</th><th>Sum number of sequences $patient</th><th>Percentage of sequences ${patient}_both</th></thead>" >> "$html"
+	echo "<tbody>" >> "$html"
 	while read locus j_segment v_segment cut_off_value both one read_count1 two read_count2 sum percent locusreadsum1 locusreadsum2
 	do
 		if [ "$locus" != "$oldLocus" ] ; then
-			echo "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr>" >> $html
-			echo "<tr><td><b>$locus</b></td>" >> $html
+			echo "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr>" >> "$html"
+			echo "<tr><td><b>$locus</b></td>" >> "$html"
 		else
-			echo "<td></td>" >> $html
+			echo "<td></td>" >> "$html"
 		fi
-		echo "<td>$v_segment</td>" >> $html
-		echo "<td>$j_segment</td>" >> $html
-		echo "<td>>$cut_off_value</td>" >> $html 
+		echo "<td>$v_segment</td>" >> "$html"
+		echo "<td>$j_segment</td>" >> "$html"
+		echo "<td>>$cut_off_value</td>" >> "$html" 
 		if [ "$both" != "0" ] ; then
-			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$both</td>" >> $html
+			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$both</td>" >> "$html"
 		else
-			echo "<td>$both</td>" >> $html
+			echo "<td>$both</td>" >> "$html"
 		fi
 		if [ "$one" != "0" ] && [ "$cut_off_value" != "0" ] ; then
-			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$one</td>" >> $html
+			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$one</td>" >> "$html"
 		else
-			echo "<td>$one</td>" >> $html
+			echo "<td>$one</td>" >> "$html"
 		fi
-		echo "<td>$read_count1</td>" >> $html
+		echo "<td>$read_count1</td>" >> "$html"
 		if [ "$two" != "0" ] && [ "$cut_off_value" != "0" ] ; then
-			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$two</td>" >> $html
+			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$two</td>" >> "$html"
 		else
-			echo "<td>$two</td>" >> $html
+			echo "<td>$two</td>" >> "$html"
 		fi
-		echo "<td>$read_count2</td>" >> $html
-		echo "<td>$sum</td>" >> $html
-		echo "<td>${percent}&#37;</td>" >> $html
-		echo "</tr>" >> $html
+		echo "<td>$read_count2</td>" >> "$html"
+		echo "<td>$sum</td>" >> "$html"
+		echo "<td>${percent}&#37;</td>" >> "$html"
+		echo "</tr>" >> "$html"
 		oldLocus="$locus"	
 	done < tmp.txt
-	echo "</tbody></table>" >> $html
-	echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_freq'></div></td></tr></table>" >> $html
-	echo "</div>" >> $html
-	echo "<div class='tabbertab' title='Graphs frequency'>" >> $html
-	echo "<a href='${patient}_freq.png'><img src='${patient}_freq.png' width='1280' height='720' /></a><br />" >> $html
-	echo "<a href='${patient}_freq_both.png'><img src='${patient}_freq_both.png' width='1280' height='720' /></a><br />" >> $html
-	echo "<a href='${patient}_percent_freq.png'><img src='${patient}_percent_freq.png' width='1280' height='720' /></a></div>" >> $html
+	echo "</tbody></table>" >> "$html"
+	echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_freq'></div></td></tr></table>" >> "$html"
+	echo "</div>" >> "$html"
+	echo "<div class='tabbertab' title='Graphs frequency'>" >> "$html"
+	echo "<a href='${patient}_freq.png'><img src='${patient}_freq.png' width='1280' height='720' /></a><br />" >> "$html"
+	echo "<a href='${patient}_freq_both.png'><img src='${patient}_freq_both.png' width='1280' height='720' /></a><br />" >> "$html"
+	echo "<a href='${patient}_percent_freq.png'><img src='${patient}_percent_freq.png' width='1280' height='720' /></a></div>" >> "$html"
 	
 	tail -n+2 ${patient}_reads.txt | sed "s/>//" > tmp.txt
-	echo "<div class='tabbertab' title='Data reads'>" >> $html
-	echo "<table><tr><td style='vertical-align:top;'>" >> $html
-	echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_reads'>" >> $html
-	echo "<thead><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Cut off value</th><th>Number of sequences ${patient}_Both</th><th>Number of sequences_$sample1</th><th>Read Count $sample1</th><th>Number of sequences_$sample2</th><th>Read Count $sample2</th><th>Sum number of sequences $patient</th><th>Percentage of sequences ${patient}_both</th></thead>" >> $html
-	echo "<tbody>" >> $html
+	echo "<div class='tabbertab' title='Data reads'>" >> "$html"
+	echo "<table><tr><td style='vertical-align:top;'>" >> "$html"
+	echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_reads'>" >> "$html"
+	echo "<thead><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Cut off value</th><th>Number of sequences ${patient}_Both</th><th>Number of sequences_$sample1</th><th>Read Count $sample1</th><th>Number of sequences_$sample2</th><th>Read Count $sample2</th><th>Sum number of sequences $patient</th><th>Percentage of sequences ${patient}_both</th></thead>" >> "$html"
+	echo "<tbody>" >> "$html"
 	while read locus j_segment v_segment cut_off_value both one read_count1 two read_count2 sum percent locusreadsum1 locusreadsum2
 	do
 		if [ "$locus" != "$oldLocus" ] ; then
-			echo "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr>" >> $html
-			echo "<tr><td><b>$locus</b></td>" >> $html
+			echo "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr>" >> "$html"
+			echo "<tr><td><b>$locus</b></td>" >> "$html"
 		else
-			echo "<td></td>" >> $html
+			echo "<td></td>" >> "$html"
 		fi
-		echo "<td>$v_segment</td>" >> $html
-		echo "<td>$j_segment</td>" >> $html
-		echo "<td>>$cut_off_value</td>" >> $html 
+		echo "<td>$v_segment</td>" >> "$html"
+		echo "<td>$j_segment</td>" >> "$html"
+		echo "<td>>$cut_off_value</td>" >> "$html" 
 		if [ "$both" != "0" ] ; then
-			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$both</td>" >> $html
+			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$both</td>" >> "$html"
 		else
-			echo "<td>$both</td>" >> $html
+			echo "<td>$both</td>" >> "$html"
 		fi
 		if [ "$one" != "0" ] && [ "$cut_off_value" != "0" ] ; then
-			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$one</td>" >> $html
+			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$one</td>" >> "$html"
 		else
-			echo "<td>$one</td>" >> $html
+			echo "<td>$one</td>" >> "$html"
 		fi
-		echo "<td>$read_count1</td>" >> $html
+		echo "<td>$read_count1</td>" >> "$html"
 		if [ "$two" != "0" ] && [ "$cut_off_value" != "0" ] ; then
-			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$two</td>" >> $html
+			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$two</td>" >> "$html"
 		else
-			echo "<td>$two</td>" >> $html
+			echo "<td>$two</td>" >> "$html"
 		fi
-		echo "<td>$read_count2</td>" >> $html
-		echo "<td>$sum</td>" >> $html
-		echo "<td>${percent}&#37;</td>" >> $html
-		echo "</tr>" >> $html
+		echo "<td>$read_count2</td>" >> "$html"
+		echo "<td>$sum</td>" >> "$html"
+		echo "<td>${percent}&#37;</td>" >> "$html"
+		echo "</tr>" >> "$html"
 		oldLocus="$locus"
 	done < tmp.txt
-	echo "</tbody></table>" >> $html
-	echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_reads'></div></td></tr></table>" >> $html
-	echo "</div>" >> $html
-	echo "<div class='tabbertab' title='Graphs reads'>" >> $html
-	echo "<a href='${patient}_reads.png'><img src='${patient}_reads.png' width='1280' height='720' /></a><br />" >> $html
-	echo "<a href='${patient}_reads_both.png'><img src='${patient}_reads_both.png' width='1280' height='720' /></a><br />" >> $html
-	echo "<a href='${patient}_percent_reads.png'><img src='${patient}_percent_reads.png' width='1280' height='720' /></a></div>" >> $html
-	echo "</div>" >> $html
-	echo "</div>" >> $html
-	echo "</html>" >> $html
+	echo "</tbody></table>" >> "$html"
+	echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_reads'></div></td></tr></table>" >> "$html"
+	echo "</div>" >> "$html"
+	echo "<div class='tabbertab' title='Graphs reads'>" >> "$html"
+	echo "<a href='${patient}_reads.png'><img src='${patient}_reads.png' width='1280' height='720' /></a><br />" >> "$html"
+	echo "<a href='${patient}_reads_both.png'><img src='${patient}_reads_both.png' width='1280' height='720' /></a><br />" >> "$html"
+	echo "<a href='${patient}_percent_reads.png'><img src='${patient}_percent_reads.png' width='1280' height='720' /></a></div>" >> "$html"
+	echo "</div>" >> "$html"
+	echo "</div>" >> "$html"
+	echo "</html>" >> "$html"
 done < patients.txt
 
 html="index.html"
 echo "<html>" > $html
-echo "<table>" >> $html
-echo "<tr><td><b>Singles:</b></td></tr>" >> $html
+echo "<table>" >> "$html"
+echo "<tr><td><b>Singles:</b></td></tr>" >> "$html"
 for patient in "${singles[@]}"
 do
-	echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> $html
+	echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> "$html"
 done
-echo "<tr><td><b>Pairs (Left & Right):</b></td></tr>" >> $html
+echo "<tr><td><b>Pairs (Left & Right):</b></td></tr>" >> "$html"
 for patient in "${pairs_Left_Right[@]}"
 do
-	echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> $html
+	echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> "$html"
 done
-echo "<tr><td><b>Pairs (BM & PB):</b></td></tr>" >> $html
+echo "<tr><td><b>Pairs (BM & PB):</b></td></tr>" >> "$html"
 for patient in "${pairs_BM_PB[@]}"
 do
-	echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> $html
+	echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> "$html"
 done
-echo "<tr><td><b>Pairs (Dx & R):</b></td></tr>" >> $html
+echo "<tr><td><b>Pairs (Dx & R):</b></td></tr>" >> "$html"
 for patient in "${pairs_R_Dx[@]}"
 do
-	echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> $html
+	echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> "$html"
 done
-echo "<tr><td><b>Triplets:</b></td></tr>" >> $html
+echo "<tr><td><b>Triplets:</b></td></tr>" >> "$html"
 
 while read sample1 sample2 sample3
 do
@@ -180,114 +180,114 @@
 	echo "$header" > $html
 	oldLocus=""
 	tail -n+2 ${patient}_freq.txt | sed "s/>//" > tmp.txt
-	echo "<div class='tabber'>" >> $html
-	echo "<div class='tabbertab' title='Data frequency'>" >> $html
-	echo "<table><tr><td style='vertical-align:top;'>" >> $html
-	echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_freq'>" >> $html
-	echo "<thead><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Cut off value</th><th>Number of sequences ${patient}_All</th><th>Number of sequences_$sample1</th><th>Read Count $sample1</th><th>Number of sequences_$sample2</th><th>Read Count $sample2</th><th>Number of sequences_$sample3</th><th>Read Count $sample3</th></thead>" >> $html
-	echo "<tbody>" >> $html
+	echo "<div class='tabber'>" >> "$html"
+	echo "<div class='tabbertab' title='Data frequency'>" >> "$html"
+	echo "<table><tr><td style='vertical-align:top;'>" >> "$html"
+	echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_freq'>" >> "$html"
+	echo "<thead><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Cut off value</th><th>Number of sequences ${patient}_All</th><th>Number of sequences_$sample1</th><th>Read Count $sample1</th><th>Number of sequences_$sample2</th><th>Read Count $sample2</th><th>Number of sequences_$sample3</th><th>Read Count $sample3</th></thead>" >> "$html"
+	echo "<tbody>" >> "$html"
 	while read locus j_segment v_segment cut_off_value all one read_count1 two read_count2 three read_count3
 	do
 		if [ "$locus" != "$oldLocus" ] ; then
-			echo "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr>" >> $html
-			echo "<tr><td><b>$locus</b></td>" >> $html
+			echo "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr>" >> "$html"
+			echo "<tr><td><b>$locus</b></td>" >> "$html"
 		else
-			echo "<td></td>" >> $html
+			echo "<td></td>" >> "$html"
 		fi
-		echo "<td>$v_segment</td>" >> $html
-		echo "<td>$j_segment</td>" >> $html
-		echo "<td>>$cut_off_value</td>" >> $html 
+		echo "<td>$v_segment</td>" >> "$html"
+		echo "<td>$j_segment</td>" >> "$html"
+		echo "<td>>$cut_off_value</td>" >> "$html" 
 		if [ "$all" != "0" ] ; then
-			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${sample3}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$all</td>" >> $html
+			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${sample3}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$all</td>" >> "$html"
 		else
-			echo "<td>$all</td>" >> $html
+			echo "<td>$all</td>" >> "$html"
 		fi
 		if [ "$one" != "0" ] && [ "$cut_off_value" != "0" ] ; then
-			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$one</td>" >> $html
+			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$one</td>" >> "$html"
 		else
-			echo "<td>$one</td>" >> $html
+			echo "<td>$one</td>" >> "$html"
 		fi
-		echo "<td>$read_count1</td>" >> $html
+		echo "<td>$read_count1</td>" >> "$html"
 		if [ "$two" != "0" ] && [ "$cut_off_value" != "0" ] ; then
-			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$two</td>" >> $html
+			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$two</td>" >> "$html"
 		else
-			echo "<td>$two</td>" >> $html
+			echo "<td>$two</td>" >> "$html"
 		fi
-		echo "<td>$read_count2</td>" >> $html
+		echo "<td>$read_count2</td>" >> "$html"
 		if [ "$three" != "0" ] && [ "$cut_off_value" != "0" ] ; then
-			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample3}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$three</td>" >> $html
+			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample3}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$three</td>" >> "$html"
 		else
-			echo "<td>$three</td>" >> $html
+			echo "<td>$three</td>" >> "$html"
 		fi
-		echo "<td>$read_count3</td>" >> $html
-		echo "</tr>" >> $html
+		echo "<td>$read_count3</td>" >> "$html"
+		echo "</tr>" >> "$html"
 		oldLocus="$locus"	
 	done < tmp.txt
-	echo "</tbody></table>" >> $html
-	echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_freq'></div></td></tr></table>" >> $html
-	echo "</div>" >> $html
-	echo "<div class='tabbertab' title='Graphs frequency'>" >> $html
-	echo "<a href='${patient}_freq_total_all.png'><img src='${patient}_freq_total_all.png' width='1280' height='720' /></a><br />" >> $html
-	echo "<a href='${patient}_freq_indiv_all.png'><img src='${patient}_freq_indiv_all.png' width='1280' height='720' /></a><br /></div>" >> $html
+	echo "</tbody></table>" >> "$html"
+	echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_freq'></div></td></tr></table>" >> "$html"
+	echo "</div>" >> "$html"
+	echo "<div class='tabbertab' title='Graphs frequency'>" >> "$html"
+	echo "<a href='${patient}_freq_total_all.png'><img src='${patient}_freq_total_all.png' width='1280' height='720' /></a><br />" >> "$html"
+	echo "<a href='${patient}_freq_indiv_all.png'><img src='${patient}_freq_indiv_all.png' width='1280' height='720' /></a><br /></div>" >> "$html"
 	
 	tail -n+2 ${patient}_reads.txt | sed "s/>//" > tmp.txt
-	echo "<div class='tabbertab' title='Data reads'>" >> $html
-	echo "<table><tr><td style='vertical-align:top;'>" >> $html
-	echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_reads'>" >> $html
-	echo "<thead><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Cut off value</th><th>Number of sequences ${patient}_All</th><th>Number of sequences_$sample1</th><th>Read Count $sample1</th><th>Number of sequences_$sample2</th><th>Read Count $sample2</th><th>Number of sequences_$sample3</th><th>Read Count $sample3</th></thead>" >> $html
-	echo "<tbody>" >> $html
+	echo "<div class='tabbertab' title='Data reads'>" >> "$html"
+	echo "<table><tr><td style='vertical-align:top;'>" >> "$html"
+	echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_reads'>" >> "$html"
+	echo "<thead><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Cut off value</th><th>Number of sequences ${patient}_All</th><th>Number of sequences_$sample1</th><th>Read Count $sample1</th><th>Number of sequences_$sample2</th><th>Read Count $sample2</th><th>Number of sequences_$sample3</th><th>Read Count $sample3</th></thead>" >> "$html"
+	echo "<tbody>" >> "$html"
 	while read locus j_segment v_segment cut_off_value all one read_count1 two read_count2 three read_count3 
 	do
 		if [ "$locus" != "$oldLocus" ] ; then
-			echo "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr>" >> $html
-			echo "<tr><td><b>$locus</b></td>" >> $html
+			echo "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr>" >> "$html"
+			echo "<tr><td><b>$locus</b></td>" >> "$html"
 		else
-			echo "<td></td>" >> $html
+			echo "<td></td>" >> "$html"
 		fi
-		echo "<td>$v_segment</td>" >> $html
-		echo "<td>$j_segment</td>" >> $html
-		echo "<td>>$cut_off_value</td>" >> $html 
+		echo "<td>$v_segment</td>" >> "$html"
+		echo "<td>$j_segment</td>" >> "$html"
+		echo "<td>>$cut_off_value</td>" >> "$html" 
 		if [ "$all" != "0" ] ; then
-			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${sample3}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$all</td>" >> $html
+			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${sample3}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$all</td>" >> "$html"
 		else
-			echo "<td>$all</td>" >> $html
+			echo "<td>$all</td>" >> "$html"
 		fi
 		if [ "$one" != "0" ] && [ "$cut_off_value" != "0" ] ; then
-			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$one</td>" >> $html
+			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$one</td>" >> "$html"
 		else
-			echo "<td>$one</td>" >> $html
+			echo "<td>$one</td>" >> "$html"
 		fi
-		echo "<td>$read_count1</td>" >> $html
+		echo "<td>$read_count1</td>" >> "$html"
 		if [ "$two" != "0" ] && [ "$cut_off_value" != "0" ] ; then
-			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$two</td>" >> $html
+			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$two</td>" >> "$html"
 		else
-			echo "<td>$two</td>" >> $html
+			echo "<td>$two</td>" >> "$html"
 		fi
-		echo "<td>$read_count2</td>" >> $html
+		echo "<td>$read_count2</td>" >> "$html"
 		if [ "$three" != "0" ] && [ "$cut_off_value" != "0" ] ; then
-			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample3}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$three</td>" >> $html
+			echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample3}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$three</td>" >> "$html"
 		else
-			echo "<td>$three</td>" >> $html
+			echo "<td>$three</td>" >> "$html"
 		fi
-		echo "<td>$read_count3</td>" >> $html
-		echo "</tr>" >> $html
+		echo "<td>$read_count3</td>" >> "$html"
+		echo "</tr>" >> "$html"
 		oldLocus="$locus"
 	done < tmp.txt
-	echo "</tbody></table>" >> $html
-	echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_reads'></div></td></tr></table>" >> $html
-	echo "</div>" >> $html
-	echo "<div class='tabbertab' title='Graphs reads'>" >> $html
-	echo "<a href='${patient}_reads_total_all.png'><img src='${patient}_reads_total_all.png' width='1280' height='720' /></a><br />" >> $html
-	echo "<a href='${patient}_reads_indiv_all.png'><img src='${patient}_reads_indiv_all.png' width='1280' height='720' /></a><br /></div>" >> $html
-	echo "</div>" >> $html
-	echo "</div>" >> $html
-	echo "</html>" >> $html
+	echo "</tbody></table>" >> "$html"
+	echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_reads'></div></td></tr></table>" >> "$html"
+	echo "</div>" >> "$html"
+	echo "<div class='tabbertab' title='Graphs reads'>" >> "$html"
+	echo "<a href='${patient}_reads_total_all.png'><img src='${patient}_reads_total_all.png' width='1280' height='720' /></a><br />" >> "$html"
+	echo "<a href='${patient}_reads_indiv_all.png'><img src='${patient}_reads_indiv_all.png' width='1280' height='720' /></a><br /></div>" >> "$html"
+	echo "</div>" >> "$html"
+	echo "</div>" >> "$html"
+	echo "</html>" >> "$html"
 done < triplets.txt
 rm tmp.txt
 
 
 html="index.html"
 
-echo "</table>" >> $html
-echo "</html>" >> $html
+echo "</table>" >> "$html"
+echo "</html>" >> "$html"