comparison report_clonality/r_wrapper.sh @ 17:da95be204ebc draft

Uploaded
author davidvanzessen
date Wed, 21 Dec 2016 05:57:31 -0500
parents 21ca9391a3b7
children 5d11c9139a55
comparison
equal deleted inserted replaced
16:21ca9391a3b7 17:da95be204ebc
30 cp $dir/tabber.js $outputDir 30 cp $dir/tabber.js $outputDir
31 cp $dir/style.css $outputDir 31 cp $dir/style.css $outputDir
32 cp $dir/script.js $outputDir 32 cp $dir/script.js $outputDir
33 cp $dir/jquery-1.11.0.min.js $outputDir 33 cp $dir/jquery-1.11.0.min.js $outputDir
34 cp $dir/pure-min.css $outputDir 34 cp $dir/pure-min.css $outputDir
35 cp $dir/IGH_junctie_analyse.png $outputDir
35 samples=`cat $outputDir/samples.txt` 36 samples=`cat $outputDir/samples.txt`
36 37
37 echo "<html><center><h1><a href='index.html'>Click here for the results</a></h1>Tip: Open it in a new tab (middle mouse button or right mouse button -> 'open in new tab' on the link above)<br />" > $2 38 echo "<html><center><h1><a href='index.html'>Click here for the results</a></h1>Tip: Open it in a new tab (middle mouse button or right mouse button -> 'open in new tab' on the link above)<br />" > $2
38 echo "<table border = 1>" >> $2 39 echo "<table border = 1>" >> $2
39 echo "<thead><tr><th>Sample/Replicate</th><th>All</th><th>Productive</th><th>Unique Productive</th><th>Unproductive</th><th>Unique Unproductive</th></tr></thead>" >> $2 40 echo "<thead><tr><th>Sample/Replicate</th><th>All</th><th>Productive</th><th>Unique Productive</th><th>Unproductive</th><th>Unique Unproductive</th></tr></thead>" >> $2
180 #echo "<div class='tabbertab' title='Interactive'><svg class='chart'></svg><script src='http://d3js.org/d3.v3.min.js'></script></div>" >> $outputFile 181 #echo "<div class='tabbertab' title='Interactive'><svg class='chart'></svg><script src='http://d3js.org/d3.v3.min.js'></script></div>" >> $outputFile
181 182
182 hasReplicateColumn="$(if head -n 1 $inputFile | grep -q 'Replicate'; then echo 'Yes'; else echo 'No'; fi)" 183 hasReplicateColumn="$(if head -n 1 $inputFile | grep -q 'Replicate'; then echo 'Yes'; else echo 'No'; fi)"
183 echo "$hasReplicateColumn" 184 echo "$hasReplicateColumn"
184 #if its a 'new' merged file with replicate info 185 #if its a 'new' merged file with replicate info
185 if [[ "$hasReplicateColumn" == "Yes" ]] ; then 186 if [[ "$hasReplicateColumn" == "Yes" && "${clonality_method}" != "none" ]] ; then
186 echo "<div class='tabbertab' title='Clonality'><div class='tabber'>" >> $outputFile 187 if [[ "${clonality_method}" == "boyd" ]] ; then
188 echo "<div class='tabbertab' title='Clonality'><div class='tabber'>" >> $outputFile
189 else
190 echo "<div class='tabbertab' title='Shared Clonal Types'><div class='tabber'>" >> $outputFile
191 fi
192
187 for sample in $samples; do 193 for sample in $samples; do
188 echo "${clonality_method}" 194 echo "${clonality_method}"
189 if [[ "${clonality_method}" == "old" ]] ; then 195 if [[ "${clonality_method}" == "old" ]] ; then
190 echo "in old" 196 echo "in old"
191 clonalityScore="$(cat $outputDir/ClonalityScore_$sample.csv)" 197 clonalityScore="$(cat $outputDir/ClonalityScore_$sample.csv)"
192 echo "<div class='tabbertab' title='$sample'><table class='pure-table pure-table-striped'>" >> $outputFile 198 echo "<div class='tabbertab' title='$sample'><table class='pure-table pure-table-striped'>" >> $outputFile
193 echo "<thead><tr><th colspan='4'>Clonality Score: $clonalityScore</th></tr></thead>" >> $outputFile 199
200 if [[ "${clonality_method}" == "boyd" ]] ; then
201 echo "<thead><tr><th colspan='2'>Clonality Score: $clonalityScore</th></tr></thead>" >> $outputFile
202 fi
194 203
195 #replicate,reads,squared 204 #replicate,reads,squared
196 echo "<tr><td>Replicate ID</td><td>Number of Reads</td></tr>" >> $outputFile 205 echo "<tr><td>Replicate ID</td><td>Number of Sequences</td></tr>" >> $outputFile
197 while IFS=, read replicate reads squared 206 while IFS=, read replicate reads squared
198 do 207 do
199 echo "<tr><td>$replicate</td><td>$reads</td></tr>" >> $outputFile 208 echo "<tr><td>$replicate</td><td>$reads</td></tr>" >> $outputFile
200 done < $outputDir/ReplicateReads_$sample.csv 209 done < $outputDir/ReplicateReads_$sample.csv
201 210
204 do 213 do
205 echo "<tr><td>Sum</td><td>$readsSum</td></tr>" >> $outputFile 214 echo "<tr><td>Sum</td><td>$readsSum</td></tr>" >> $outputFile
206 done < $outputDir/ReplicateSumReads_$sample.csv 215 done < $outputDir/ReplicateSumReads_$sample.csv
207 216
208 #overview 217 #overview
209 echo "<tr><td>Coincidence Type</td><td>Raw Coincidence Freq</td></tr>" >> $outputFile 218 echo "<tr><td>Number of replicates containing the coincidence</td><td>Number of sequences shared between replicates</td></tr>" >> $outputFile
210 while IFS=, read type count weight weightedCount 219 while IFS=, read type count weight weightedCount
211 do 220 do
212 if [[ "$type" -eq "1" ]]; then 221 if [[ "$type" -eq "1" ]]; then
213 echo "<tr><td>$type</td><td>$count</td></tr>" >> $outputFile 222 echo "<tr><td>$type</td><td>$count</td></tr>" >> $outputFile
214 else 223 else
236 #hasJunctionData="$(if head -n 1 $inputFile | grep -qE '3V.REGION.trimmed.nt.nb'; then echo 'Yes'; else echo 'No'; fi)" 245 #hasJunctionData="$(if head -n 1 $inputFile | grep -qE '3V.REGION.trimmed.nt.nb'; then echo 'Yes'; else echo 'No'; fi)"
237 246
238 #if [[ "$hasJunctionData" == "Yes" ]] ; then 247 #if [[ "$hasJunctionData" == "Yes" ]] ; then
239 if [ -a "$outputDir/junctionAnalysisProd_mean.csv" ] ; then 248 if [ -a "$outputDir/junctionAnalysisProd_mean.csv" ] ; then
240 echo "<div class='tabbertab' title='Junction Analysis'>" >> $outputFile 249 echo "<div class='tabbertab' title='Junction Analysis'>" >> $outputFile
250 echo "<img src='IGH_junctie_analyse.png' />" >> $outputFile
251
241 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Productive mean</caption><thead><tr><th>Sample</th><th>count</th><th>V.DEL</th><th>P1</th><th>N1</th><th>P2</th><th>DEL.D</th><th>D.DEL</th><th>P3</th><th>N2</th><th>P4</th><th>DEL.J</th><th>Total.Del</th><th>Total.N</th><th>Total.P</th><th>Median.CDR3</th><thead></tr><tbody>" >> $outputFile 252 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Productive mean</caption><thead><tr><th>Sample</th><th>count</th><th>V.DEL</th><th>P1</th><th>N1</th><th>P2</th><th>DEL.D</th><th>D.DEL</th><th>P3</th><th>N2</th><th>P4</th><th>DEL.J</th><th>Total.Del</th><th>Total.N</th><th>Total.P</th><th>Median.CDR3</th><thead></tr><tbody>" >> $outputFile
242 while IFS=, read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median 253 while IFS=, read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median
243 do 254 do
244 echo "<tr><td>$Sample</td><td>$unique</td><td>$VDEL</td><td>$P1</td><td>$N1</td><td>$P2</td><td>$DELD</td><td>$DDEL</td><td>$P3</td><td>$N2</td><td>$P4</td><td>$DELJ</td><td>$TotalDel</td><td>$TotalN</td><td>$TotalP</td><td>$median</td></tr>" >> $outputFile 255 echo "<tr><td>$Sample</td><td>$unique</td><td>$VDEL</td><td>$P1</td><td>$N1</td><td>$P2</td><td>$DELD</td><td>$DDEL</td><td>$P3</td><td>$N2</td><td>$P4</td><td>$DELJ</td><td>$TotalDel</td><td>$TotalN</td><td>$TotalP</td><td>$median</td></tr>" >> $outputFile
245 done < $outputDir/junctionAnalysisProd_mean.csv 256 done < $outputDir/junctionAnalysisProd_mean.csv