diff wrapper.sh @ 4:f11df36f43bb draft

Uploaded
author davidvanzessen
date Mon, 15 Sep 2014 05:37:16 -0400
parents f9316f7676cc
children 68c6c7624ffc
line wrap: on
line diff
--- a/wrapper.sh	Tue Aug 26 09:53:22 2014 -0400
+++ b/wrapper.sh	Mon Sep 15 05:37:16 2014 -0400
@@ -21,36 +21,42 @@
 
 cd $outputDir
 
-html="index.html"
-echo "<html><head><title>Result</title>" > $html
-echo "<script type='text/javascript' src='jquery-1.11.0.min.js'></script>" >> $html
-echo "<script type='text/javascript' src='tabber.js'></script>" >> $html
-echo "<script type='text/javascript' src='script.js'></script>" >> $html
-echo "<script type='text/javascript' src='jquery.tablesorter.min.js'></script>" >> $html
-echo "<link rel='stylesheet' type='text/css' href='style.css'></head>" >> $html
-echo "<div id='hidden_div' style='display: none;'></div>" >> $html
-echo "<div class='tabber'>" >> $html
-while read patient sample1 sample2
+header="<html><head><script type='text/javascript' src='jquery-1.11.0.min.js'></script><script type='text/javascript' src='tabber.js'></script><script type='text/javascript' src='script.js'></script><link rel='stylesheet' type='text/css' href='style.css'></head><div id='hidden_div' style='display: none;'></div>"
+singles=()
+pairs_BM_PB=()
+pairs_Left_Right=()
+pairs_R_Dx=()
+while read patient sample1 sample2 type
 do
 	echo "$patient"
+	html="${patient}.html"
+	echo "$header" > $html
+	if [[ "$type" == *pair* ]] ; then
+		if [[ "$sample1" == *_BM* ]] || [[ "$sample1" == *_PB* ]] ; then
+			pairs_BM_PB+=( "$patient" )
+		elif [[ "$sample1" == *_Left* ]] || [[ "$sample1" == *_Right* ]] ; then
+			pairs_Left_Right+=( "$patient" )
+		else
+			pairs_R_Dx+=( "$patient" )
+		fi
+	else
+		singles+=( "$patient" )
+	fi
 	oldLocus=""
 	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='tabbertab' title='$patient'>" >> $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>Normalized Read Count $sample1</th><th>Number of sequences_$sample2</th><th>Normalized Read Count $sample2</th><th>Sum number of sequences $patient</th><th>Percentage of sequences ${patient}_both</th></thead>" >> $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
-	readsumtable="<table class='result_table summary_table'><thead><tr><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Total normalized read count for $sample1</th><th>Total normalized read count for $sample2</th></tr></thead>"
 	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
-			readsumtable="${readsumtable}<tr><td>$locus</td><td>$v_segment</td><td>$j_segment</td><td>$locusreadsum1</td><td>$locusreadsum2</td></tr>"
 		else
 			echo "<td></td>" >> $html
 		fi
@@ -81,7 +87,7 @@
 	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 "${readsumtable}</table></div>" >> $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
@@ -93,13 +99,11 @@
 	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
-	readsumtable="<table class='result_table summary_table'><thead><tr><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Total normalized read count for $sample1</th><th>Total normalized read count for $sample2</th></tr></thead>"
 	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
-			readsumtable="${readsumtable}<tr><td>$locus</td><td>$v_segment</td><td>$j_segment</td><td>$locusreadsum1</td><td>$locusreadsum2</td></tr>"
 		else
 			echo "<td></td>" >> $html
 		fi
@@ -130,13 +134,42 @@
 	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 "${readsumtable}</table></div>" >> $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
-echo "</div></html>" >> $html
 rm tmp.txt
+
+html="index.html"
+echo "<html>" > $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
+done
+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
+done
+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
+done
+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
+done
+echo "<tr><td><b>Triplets:</b></td></tr>" >> $html
+
+echo "</table>" >> $html
+echo "</html>" >> $html
+