comparison report_clonality/r_wrapper.sh @ 18:5d11c9139a55 draft

Uploaded
author davidvanzessen
date Wed, 21 Dec 2016 11:53:03 -0500
parents da95be204ebc
children 3ef457aa5df6
comparison
equal deleted inserted replaced
17:da95be204ebc 18:5d11c9139a55
45 echo "<td>$productive (${perc_prod}%)</td>" >> $2 45 echo "<td>$productive (${perc_prod}%)</td>" >> $2
46 echo "<td>$productive_unique (${perc_prod_un}%)</td>" >> $2 46 echo "<td>$productive_unique (${perc_prod_un}%)</td>" >> $2
47 echo "<td>$unproductive (${perc_unprod}%)</td>" >> $2 47 echo "<td>$unproductive (${perc_unprod}%)</td>" >> $2
48 echo "<td>$unproductive_unique (${perc_unprod_un}%)</td></tr>" >> $2 48 echo "<td>$unproductive_unique (${perc_unprod_un}%)</td></tr>" >> $2
49 done < $outputDir/productive_counting.txt 49 done < $outputDir/productive_counting.txt
50 echo "</table border></center></html>" >> $2 50 echo "</table><br />" >> $2
51 echo "Table showing the number and percentage of (unique) productive and unproductive sequences per sample and per replicate. <br />" >> $2
52 echo "The definition of unique sequences is based on the clonal type definition filter setting chosen. " >> $2
53 echo "</center></html>" >> $2
51 54
52 echo "<html><head><title>Report on:" >> $outputFile 55 echo "<html><head><title>Report on:" >> $outputFile
53 56
54 mkdir $outputDir/circos 57 mkdir $outputDir/circos
55 cp $dir/circos/* $outputDir/circos/ 58 cp $dir/circos/* $outputDir/circos/
122 echo "<img src='VPlot.png'/>" >> $outputFile 125 echo "<img src='VPlot.png'/>" >> $outputFile
123 if [[ "$useD" == "true" ]] ; then 126 if [[ "$useD" == "true" ]] ; then
124 echo "<img src='DPlot.png'/>" >> $outputFile 127 echo "<img src='DPlot.png'/>" >> $outputFile
125 fi 128 fi
126 echo "<img src='JPlot.png'/>" >> $outputFile 129 echo "<img src='JPlot.png'/>" >> $outputFile
130
131 cat $dir/naive_gene_freq.htm >> $outputFile
132
127 echo "</div>" >> $outputFile 133 echo "</div>" >> $outputFile
128 134
129 echo "<div class='tabbertab' title='CDR3 Characteristics'>" >> $outputFile 135 echo "<div class='tabbertab' title='CDR3 Characteristics'>" >> $outputFile
130 echo "<img src='CDR3LengthPlot.png'/><br />" >> $outputFile 136 echo "<img src='CDR3LengthPlot.png'/><br />" >> $outputFile
131 echo "<img src='AAComposition.png'/>" >> $outputFile 137 echo "<img src='AAComposition.png'/>" >> $outputFile
137 do 143 do
138 echo "<tr><td>$Sample</td><td>$median</td></tr>" >> $outputFile 144 echo "<tr><td>$Sample</td><td>$median</td></tr>" >> $outputFile
139 done < $outputDir/AAMedianBySample.csv 145 done < $outputDir/AAMedianBySample.csv
140 echo "</table>" >> $outputFile 146 echo "</table>" >> $outputFile
141 147
148 cat $dir/naive_cdr3_char.htm >> $outputFile
149
142 echo "</div>" >> $outputFile 150 echo "</div>" >> $outputFile
143 151
144 #Heatmaps 152 #Heatmaps
145 153
146 count=1 154 count=1
155 echo "<td><img src='HeatmapDJ_$sample.png'/></td>" >> $outputFile 163 echo "<td><img src='HeatmapDJ_$sample.png'/></td>" >> $outputFile
156 fi 164 fi
157 echo "</tr></table></div>" >> $outputFile 165 echo "</tr></table></div>" >> $outputFile
158 count=$((count+1)) 166 count=$((count+1))
159 done 167 done
168
169 cat $dir/naive_heatmap.htm >> $outputFile
170
160 echo "</div></div>" >> $outputFile 171 echo "</div></div>" >> $outputFile
172
173 echo "<div class='tabbertab' title='Compare Heatmaps'><table class='pure-table pure-table-striped'><thead><tr><th>ID</th><th>Include</th></tr></thead>" >> $outputFile
174 for sample in $samples; do
175 echo "<tr><td>$sample</td><td><input type='checkbox' onchange=\"javascript:compareAdd('$sample')\" id='compare_checkbox_$sample'/></td></tr>" >> $outputFile
176 done
177 echo "</table><div name='comparisonarea'>" >> $outputFile
178 echo "<table><tr id='comparison_table_vd'></tr></table>" >> $outputFile
179 echo "<table><tr id='comparison_table_vj'></tr></table>" >> $outputFile
180 echo "<table><tr id='comparison_table_dj'></tr></table>" >> $outputFile
181
182 cat $dir/naive_compare.htm >> $outputFile
183
184 echo "</div></div>" >> $outputFile
185
161 186
162 #circos 187 #circos
163 188
164 if [[ "$USECIRCOS" == "yes" ]]; then 189 if [[ "$USECIRCOS" == "yes" ]]; then
165 190
174 echo "<tr><td>D-J</td><td><img src='circosDJ_${sample}.png' width='700' height='700'/></td></tr>" >> $outputFile 199 echo "<tr><td>D-J</td><td><img src='circosDJ_${sample}.png' width='700' height='700'/></td></tr>" >> $outputFile
175 fi 200 fi
176 echo "<center></table></div>" >> $outputFile 201 echo "<center></table></div>" >> $outputFile
177 count=$((count+1)) 202 count=$((count+1))
178 done 203 done
204
205 cat $dir/naive_circos.htm >> $outputFile
206
179 echo "</div></div>" >> $outputFile 207 echo "</div></div>" >> $outputFile
180 fi 208 fi
181 #echo "<div class='tabbertab' title='Interactive'><svg class='chart'></svg><script src='http://d3js.org/d3.v3.min.js'></script></div>" >> $outputFile 209 #echo "<div class='tabbertab' title='Interactive'><svg class='chart'></svg><script src='http://d3js.org/d3.v3.min.js'></script></div>" >> $outputFile
182 210
183 hasReplicateColumn="$(if head -n 1 $inputFile | grep -q 'Replicate'; then echo 'Yes'; else echo 'No'; fi)" 211 hasReplicateColumn="$(if head -n 1 $inputFile | grep -q 'Replicate'; then echo 'Yes'; else echo 'No'; fi)"
237 echo "<tr><td>$type</td><td>$count</td></tr>" >> $outputFile 265 echo "<tr><td>$type</td><td>$count</td></tr>" >> $outputFile
238 done < $outputDir/lymphclon_coincidences_$sample.csv 266 done < $outputDir/lymphclon_coincidences_$sample.csv
239 echo "</table></div>" >> $outputFile 267 echo "</table></div>" >> $outputFile
240 fi 268 fi
241 done 269 done
270
271 cat $dir/naive_clonality.htm >> $outputFile
272
242 echo "</div></div>" >> $outputFile 273 echo "</div></div>" >> $outputFile
243 fi 274 fi
244 275
245 #hasJunctionData="$(if head -n 1 $inputFile | grep -qE '3V.REGION.trimmed.nt.nb'; then echo 'Yes'; else echo 'No'; fi)" 276 #hasJunctionData="$(if head -n 1 $inputFile | grep -qE '3V.REGION.trimmed.nt.nb'; then echo 'Yes'; else echo 'No'; fi)"
246 277
247 #if [[ "$hasJunctionData" == "Yes" ]] ; then 278 #if [[ "$hasJunctionData" == "Yes" ]] ; then
248 if [ -a "$outputDir/junctionAnalysisProd_mean.csv" ] ; then 279 if [ -a "$outputDir/junctionAnalysisProd_mean.csv" ] ; then
249 echo "<div class='tabbertab' title='Junction Analysis'>" >> $outputFile 280 echo "<div class='tabbertab' title='Junction Analysis'>" >> $outputFile
250 echo "<img src='IGH_junctie_analyse.png' />" >> $outputFile 281 echo "<img src='IGH_junctie_analyse.png' />" >> $outputFile
251 282
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 283 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Productive mean</caption><thead><tr><th>Sample</th><th>Number of sequences</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
253 while IFS=, read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median 284 while IFS=, read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median
254 do 285 do
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 286 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
256 done < $outputDir/junctionAnalysisProd_mean.csv 287 done < $outputDir/junctionAnalysisProd_mean.csv
257 echo "</tbody></table>" >> $outputFile 288 echo "</tbody></table>" >> $outputFile
258 289
259 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Unproductive 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 290 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Unproductive mean</caption><thead><tr><th>Sample</th><th>Number of sequences</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
260 while IFS=, read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median 291 while IFS=, read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median
261 do 292 do
262 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 293 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
263 done < $outputDir/junctionAnalysisUnProd_mean.csv 294 done < $outputDir/junctionAnalysisUnProd_mean.csv
264 echo "</tbody></table>" >> $outputFile 295 echo "</tbody></table>" >> $outputFile
265 296
266 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Productive median</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 297 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Productive median</caption><thead><tr><th>Sample</th><th>Number of sequences</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
267 while IFS=, read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median 298 while IFS=, read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median
268 do 299 do
269 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 300 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
270 done < $outputDir/junctionAnalysisProd_median.csv 301 done < $outputDir/junctionAnalysisProd_median.csv
271 echo "</tbody></table>" >> $outputFile 302 echo "</tbody></table>" >> $outputFile
272 303
273 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Unproductive median</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 304 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Unproductive median</caption><thead><tr><th>Sample</th><th>Number of sequences</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
274 while IFS=, read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median 305 while IFS=, read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median
275 do 306 do
276 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 307 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
277 done < $outputDir/junctionAnalysisUnProd_median.csv 308 done < $outputDir/junctionAnalysisUnProd_median.csv
278 echo "</tbody></table>" >> $outputFile 309 echo "</tbody></table>" >> $outputFile
279 310
311 cat $dir/naive_junction.htm >> $outputFile
312
280 echo "</div>" >> $outputFile 313 echo "</div>" >> $outputFile
281 fi 314 fi
282
283 echo "<div class='tabbertab' title='Comparison'><table class='pure-table pure-table-striped'><thead><tr><th>ID</th><th>Include</th></tr></thead>" >> $outputFile
284 for sample in $samples; do
285 echo "<tr><td>$sample</td><td><input type='checkbox' onchange=\"javascript:compareAdd('$sample')\" id='compare_checkbox_$sample'/></td></tr>" >> $outputFile
286 done
287 echo "</table><div name='comparisonarea'>" >> $outputFile
288 echo "<table><tr id='comparison_table_vd'></tr></table>" >> $outputFile
289 echo "<table><tr id='comparison_table_vj'></tr></table>" >> $outputFile
290 echo "<table><tr id='comparison_table_dj'></tr></table>" >> $outputFile
291 echo "</div></div>" >> $outputFile
292 315
293 echo "<div class='tabbertab' title='Downloads'>" >> $outputFile 316 echo "<div class='tabbertab' title='Downloads'>" >> $outputFile
294 echo "<table class='pure-table pure-table-striped'>" >> $outputFile 317 echo "<table class='pure-table pure-table-striped'>" >> $outputFile
295 echo "<thead><tr><th>Description</th><th>Link</th></tr></thead>" >> $outputFile 318 echo "<thead><tr><th>Description</th><th>Link</th></tr></thead>" >> $outputFile
296 echo "<tr><td>The dataset used to generate the frequency graphs and the heatmaps (Unique based on clonaltype, $clonalType)</td><td><a href='allUnique.csv'>Download</a></td></tr>" >> $outputFile 319 echo "<tr><td>The filtered dataset</td><td><a href='allUnique.txt'>Download</a></td></tr>" >> $outputFile
297 echo "<tr><td>The dataset used to calculate clonality score (Unique based on clonaltype, $clonalType)</td><td><a href='clonalityComplete.csv'>Download</a></td></tr>" >> $outputFile 320 echo "<tr><td>The dataset used to calculate clonality score (Unique based on clonaltype, $clonalType)</td><td><a href='clonalityComplete.txt'>Download</a></td></tr>" >> $outputFile
298 321
299 echo "<tr><td>The dataset used to generate the CDR3 length frequency graph</td><td><a href='CDR3LengthPlot.csv'>Download</a></td></tr>" >> $outputFile 322 echo "<tr><td>The dataset used to generate the CDR3 length frequency graph</td><td><a href='CDR3LengthPlot.csv'>Download</a></td></tr>" >> $outputFile
300 323
301 echo "<tr><td>The dataset used to generate the V gene family frequency graph</td><td><a href='VFFrequency.csv'>Download</a></td></tr>" >> $outputFile 324 echo "<tr><td>The dataset used to generate the distribution of V gene families graph</td><td><a href='VFFrequency.txt'>Download</a></td></tr>" >> $outputFile
302 if [[ "$useD" == "true" ]] ; then 325 if [[ "$useD" == "true" ]] ; then
303 echo "<tr><td>The dataset used to generate the D gene family frequency graph</td><td><a href='DFFrequency.csv'>Download</a></td></tr>" >> $outputFile 326 echo "<tr><td>The dataset used to generate the distribution of D gene families graph</td><td><a href='DFFrequency.txt'>Download</a></td></tr>" >> $outputFile
304 fi 327 fi
305 328
306 echo "<tr><td>The dataset used to generate the V gene frequency graph</td><td><a href='VFrequency.csv'>Download</a></td></tr>" >> $outputFile 329 echo "<tr><td>The dataset used to generate the relative frequency of V gene usage graph</td><td><a href='VFrequency.txt'>Download</a></td></tr>" >> $outputFile
307 if [[ "$useD" == "true" ]] ; then 330 if [[ "$useD" == "true" ]] ; then
308 echo "<tr><td>The dataset used to generate the D gene frequency graph</td><td><a href='DFrequency.csv'>Download</a></td></tr>" >> $outputFile 331 echo "<tr><td>The dataset used to generate the relative frequency of D gene usage graph</td><td><a href='DFrequency.txt'>Download</a></td></tr>" >> $outputFile
309 fi 332 fi
310 echo "<tr><td>The dataset used to generate the J gene frequency graph</td><td><a href='JFrequency.csv'>Download</a></td></tr>" >> $outputFile 333 echo "<tr><td>The dataset used to generate the relative frequency of J gene usage graph</td><td><a href='JFrequency.txt'>Download</a></td></tr>" >> $outputFile
311 echo "<tr><td>The dataset used to generate the AA composition graph</td><td><a href='AAComposition.csv'>Download</a></td></tr>" >> $outputFile 334 echo "<tr><td>The dataset used to generate the Amino Acid Composition in the CDR3 graph</td><td><a href='AAComposition.txt'>Download</a></td></tr>" >> $outputFile
312 335
313 for sample in $samples; do 336 for sample in $samples; do
314 if [[ "$useD" == "true" ]] ; then 337 if [[ "$useD" == "true" ]] ; then
315 echo "<tr><td>The data used to generate the VD heatmap for $sample.</td><td><a href='HeatmapVD_$sample.csv'>Download</a></td></tr>" >> $outputFile 338 echo "<tr><td>The data used to generate the VD heatmap for $sample.</td><td><a href='HeatmapVD_$sample.csv'>Download</a></td></tr>" >> $outputFile
316 fi 339 fi
321 done 344 done
322 345
323 echo "<tr><td>A frequency count of V Gene + J Gene + CDR3</td><td><a href='VJCDR3_count.txt'>Download</a></td></tr>" >> $outputFile 346 echo "<tr><td>A frequency count of V Gene + J Gene + CDR3</td><td><a href='VJCDR3_count.txt'>Download</a></td></tr>" >> $outputFile
324 347
325 echo "</table>" >> $outputFile 348 echo "</table>" >> $outputFile
349
350 cat $dir/naive_downloads.htm >> $outputFile
351
326 echo "</div></html>" >> $outputFile 352 echo "</div></html>" >> $outputFile