annotate report_clonality/r_wrapper.sh @ 58:4c6df851e262 draft default tip

"planemo upload commit 1a7731bb4fe2e80fb1fdc88121783068af3edb08"
author rhpvorderman
date Fri, 21 Apr 2023 10:04:39 +0000
parents 33412e85e669
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
53
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
1 #!/bin/bash
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
3 inputFile=$1
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
4 outputDir=$3
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
5 outputFile=$3/index.html #$2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
6 clonalType=$4
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
7 species=$5
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
8 locus=$6
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
9 filterproductive=$7
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
10 clonality_method=$8
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
11
57
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
12 ALL_OUTPUTS_ZIP="$outputDir/all_outputs.zip"
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
13
53
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
14 dir="$(cd "$(dirname "$0")" && pwd)"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
15 useD="false"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
16 if grep -q "$species.*${locus}D" "$dir/genes.txt" ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
17 echo "species D region in reference db"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
18 useD="true"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
19 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
20 echo "$species"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
21 if [[ "$species" == *"custom"* ]] ; then
54
81b3eb11ed2c "planemo upload commit 6c0195cc4de6a34e2c46d875be4fc2157a21cdf6"
rhpvorderman
parents: 53
diff changeset
22 loci=("${locus//;/ }")
53
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
23 useD="true"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
24 echo "${loci[@]}"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
25 if [[ "${#loci[@]}" -eq "2" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
26 useD="false"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
27 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
28 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
29 mkdir $3
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
30 cp $dir/genes.txt $outputDir
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
31 Rscript --verbose $dir/RScript.r $inputFile $outputDir $outputDir $clonalType "$species" "$locus" $filterproductive ${clonality_method} 2>&1
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
32 cp $dir/tabber.js $outputDir
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
33 cp $dir/style.css $outputDir
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
34 cp $dir/script.js $outputDir
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
35 cp $dir/jquery-1.11.0.min.js $outputDir
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
36 cp $dir/pure-min.css $outputDir
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
37 cp $dir/IGH_junctie_analyse.png $outputDir
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
38 samples=`cat $outputDir/samples.txt`
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
39
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
40 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
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
41 echo "<table border = 1>" >> $2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
42 echo "<thead><tr><th>Donor/Replicate</th><th>All</th><th>Productive</th><th>Unique Productive</th><th>Unproductive</th><th>Unique Unproductive</th></tr></thead>" >> $2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
43 while IFS=, read sample all productive perc_prod productive_unique perc_prod_un unproductive perc_unprod unproductive_unique perc_unprod_un
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
44 do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
45 echo "<tr><td>$sample</td>" >> $2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
46 echo "<td>$all</td>" >> $2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
47 if [[ "$productive" != "0" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
48 echo "<td>$productive (${perc_prod}%)</td>" >> $2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
49 echo "<td>$productive_unique (${perc_prod_un}%)</td>" >> $2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
50 echo "<td>$unproductive (${perc_unprod}%)</td>" >> $2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
51 echo "<td>$unproductive_unique (${perc_unprod_un}%)</td></tr>" >> $2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
52 else
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
53 echo "<td colspan='4' style='background-color: red;'>No productive sequences!</td>" >> $2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
54 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
55 done < $outputDir/productive_counting.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
56 echo "</table><br />" >> $2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
57 echo "Table showing the number and percentage of (unique) productive and unproductive sequences per donor and per replicate. <br />" >> $2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
58 echo "The definition of unique sequences is based on the clonal type definition filter setting chosen. " >> $2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
59 echo "</center></html>" >> $2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
60
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
61 echo "<html><head><title>Report on:" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
62
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
63 mkdir $outputDir/circos
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
64 cp -R $dir/circos/* $outputDir/circos/
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
65
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
66 USECIRCOS="no"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
67 path_to_circos=$(which circos)
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
68 if [ -x "$path_to_circos" ]; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
69 USECIRCOS="yes"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
70 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
71
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
72 echo "Using Circos: $USECIRCOS"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
73 sed -i "s%DATA_DIR%$outputDir/circos%" $outputDir/circos/circos.conf
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
74 for sample in $samples; do #output the samples to a file and create the circos plots with the R script output
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
75 echo " $sample" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
76
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
77 if [[ "$USECIRCOS" != "yes" ]]; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
78 continue
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
79 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
80
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
81 circos_file="$outputDir/${sample}_VJ_circos.txt"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
82 sed -i -- 's%/%:%g' $circos_file
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
83 echo -e -n "labels$(cat ${circos_file})" > ${circos_file}
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
84 echo "Circos tools command:"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
85 echo "cat \"${circos_file}\" | parse-table -configfile $dir/circos/parse-table.conf 2>&1 | make-conf -dir $outputDir/circos/"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
86 cat "${circos_file}" | parse-table -configfile $dir/circos/parse-table.conf 2>&1 | make-conf -dir $outputDir/circos/
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
87
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
88 echo "Circos command:"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
89 echo "circos -conf $outputDir/circos/circos.conf 2>&1"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
90 circos -conf $outputDir/circos/circos.conf 2>&1
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
91 mv $outputDir/circos/circos.png $outputDir/circosVJ_${sample}.png
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
92 mv $outputDir/circos/circos.svg $outputDir/circosVJ_${sample}.svg
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
93
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
94
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
95 if [[ "$useD" == "true" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
96 circos_file="$outputDir/${sample}_VD_circos.txt"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
97 sed -i -- 's%/%:%g' $circos_file
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
98 echo -e -n "labels$(cat ${circos_file})" > ${circos_file}
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
99 cat "${circos_file}" | parse-table -configfile $dir/circos/parse-table.conf 2>&1 | make-conf -dir $outputDir/circos/
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
100 sed -i -- 's%/%:%g' $outputDir/circos/cells.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
101 circos -conf $outputDir/circos/circos.conf 2>&1
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
102 mv $outputDir/circos/circos.png $outputDir/circosVD_${sample}.png
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
103 mv $outputDir/circos/circos.svg $outputDir/circosVD_${sample}.svg
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
104
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
105 circos_file="$outputDir/${sample}_DJ_circos.txt"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
106 sed -i -- 's%/%:%g' $circos_file
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
107 echo -e -n "labels$(cat ${circos_file})" > ${circos_file}
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
108 cat "${circos_file}" | parse-table -configfile $dir/circos/parse-table.conf 2>&1 | make-conf -dir $outputDir/circos/
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
109 sed -i -- 's%/%:%g' $outputDir/circos/cells.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
110 circos -conf $outputDir/circos/circos.conf 2>&1
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
111 mv $outputDir/circos/circos.png $outputDir/circosDJ_${sample}.png
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
112 mv $outputDir/circos/circos.svg $outputDir/circosDJ_${sample}.svg
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
113 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
114 done
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
115 echo "</title><script type='text/javascript' src='jquery-1.11.0.min.js'></script>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
116 echo "<link rel='stylesheet' type='text/css' href='pure-min.css'>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
117 echo "<script type='text/javascript' src='tabber.js'></script>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
118 echo "<script type='text/javascript' src='script.js'></script>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
119 echo "<link rel='stylesheet' type='text/css' href='style.css'></head>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
120 echo "<div class='tabber'><div class='tabbertab' title='Gene frequencies'>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
121
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
122
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
123 echo "<a href='VFPlot.pdf'><img src='VFPlot.png'/></a>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
124 if [[ "$useD" == "true" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
125 echo "<a href='DFPlot.pdf'><img src='DFPlot.png'/></a>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
126 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
127 echo "<a href='VPlot.pdf'><img src='VPlot.png'/></a>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
128 if [[ "$useD" == "true" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
129 echo "<a href='DPlot.pdf'><img src='DPlot.png'/></a>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
130 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
131 echo "<a href='JPlot.pdf'><img src='JPlot.png'/></a> <br />" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
132
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
133 echo "<a href='DReadingFrame.pdf'><img src='DReadingFrame.png'/></a>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
134
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
135 cat $dir/naive_gene_freq.htm >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
136
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
137 echo "</div>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
138
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
139 echo "<div class='tabbertab' title='CDR3 Characteristics'>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
140 echo "<a href='CDR3LengthPlot.pdf'><img src='CDR3LengthPlot.png'/></a><br />" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
141 echo "<a href='AAComposition.pdf'><img src='AAComposition.png'/></a>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
142
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
143
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
144 echo "<table class='pure-table pure-table-striped'>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
145 echo "<thead><tr><th>Donor</th><th>Median CDR3 Length</th></tr></thead>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
146 while read Sample median
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
147 do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
148 echo "<tr><td>$Sample</td><td>$median</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
149 done < $outputDir/AAMedianBySample.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
150 echo "</table>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
151
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
152 cat $dir/naive_cdr3_char.htm >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
153
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
154 echo "</div>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
155
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
156 #Heatmaps
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
157
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
158 count=1
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
159 echo "<div class='tabbertab' title='Heatmaps'><div class='tabber'>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
160 for sample in $samples; do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
161 echo "<div class='tabbertab' title='$sample'><table border='1'><tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
162 if [[ "$useD" == "true" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
163 echo "<td><a href='HeatmapVD_$sample.pdf'><img src='HeatmapVD_$sample.png'/></a></td>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
164 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
165 echo "<td><a href='HeatmapVJ_$sample.pdf'><img src='HeatmapVJ_$sample.png'/></a></td>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
166 if [[ "$useD" == "true" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
167 echo "<td><a href='HeatmapDJ_$sample.pdf'><img src='HeatmapDJ_$sample.png'/></a></td>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
168 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
169 echo "</tr></table></div>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
170 count=$((count+1))
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
171 done
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
172
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
173 cat $dir/naive_heatmap.htm >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
174
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
175 echo "</div></div>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
176
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
177 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
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
178 for sample in $samples; do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
179 echo "<tr><td>$sample</td><td><input type='checkbox' onchange=\"javascript:compareAdd('$sample')\" id='compare_checkbox_$sample'/></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
180 done
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
181 echo "</table><div name='comparisonarea'>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
182 echo "<table><tr id='comparison_table_vd'></tr></table>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
183 echo "<table><tr id='comparison_table_vj'></tr></table>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
184 echo "<table><tr id='comparison_table_dj'></tr></table>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
185
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
186 cat $dir/naive_compare.htm >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
187
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
188 echo "</div></div>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
189
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
190
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
191 #circos
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
192
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
193 if [[ "$USECIRCOS" == "yes" ]]; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
194
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
195 echo "<div class='tabbertab' title='Circos'><div class='tabber'>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
196 for sample in $samples; do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
197 echo "<div class='tabbertab' title='$sample'><table border='1'><center>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
198 if [[ "$useD" == "true" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
199 echo "<tr><td>V-D</td><td><a href='circosVD_${sample}.svg'><img src='circosVD_${sample}.png' width='700' height='700'/></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
200 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
201 echo "<tr><td>V-J</td><td><a href='circosVJ_${sample}.svg'><img src='circosVJ_${sample}.png' width='700' height='700'/></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
202 if [[ "$useD" == "true" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
203 echo "<tr><td>D-J</td><td><a href='circosDJ_${sample}.svg'><img src='circosDJ_${sample}.png' width='700' height='700'/></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
204 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
205 echo "<center></table></div>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
206 count=$((count+1))
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
207 done
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
208
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
209 cat $dir/naive_circos.htm >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
210
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
211 echo "</div></div>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
212 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
213 #echo "<div class='tabbertab' title='Interactive'><svg class='chart'></svg><script src='http://d3js.org/d3.v3.min.js'></script></div>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
214
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
215 hasReplicateColumn="$(if head -n 1 $inputFile | grep -q 'Replicate'; then echo 'Yes'; else echo 'No'; fi)"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
216 echo "$hasReplicateColumn"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
217 #if its a 'new' merged file with replicate info
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
218 if [[ "$hasReplicateColumn" == "Yes" && "${clonality_method}" != "none" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
219 if [[ "${clonality_method}" == "boyd" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
220 echo "<div class='tabbertab' title='Clonality'><div class='tabber'>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
221 else
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
222 echo "<div class='tabbertab' title='Shared Clonal Types'><div class='tabber'>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
223 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
224
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
225 for sample in $samples; do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
226 echo "${clonality_method}"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
227
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
228 echo "<div class='tabbertab' title='$sample'><table class='pure-table pure-table-striped'>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
229
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
230 if [[ "${clonality_method}" == "boyd" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
231 clonalityScore="$(cat $outputDir/lymphclon_clonality_${sample}.txt)"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
232 echo "<tr><td>Clonality Score: </td><td>$clonalityScore</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
233 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
234
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
235 #replicate,reads,squared
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
236 echo "<tr><td>Replicate ID</td><td>Number of Sequences</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
237 while read replicate reads squared
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
238 do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
239 echo "<tr><td>$replicate</td><td>$reads</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
240 done < $outputDir/ReplicateReads_$sample.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
241
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
242 #sum of reads and reads squared
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
243 while read readsSum squaredSum
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
244 do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
245 echo "<tr><td>Sum</td><td>$readsSum</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
246 done < $outputDir/ReplicateSumReads_$sample.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
247
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
248 echo "<tr><td></td><td></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
249
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
250 #overview
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
251 echo "<tr><td>Number of replicates containing the coincidence</td><td>Number of sequences shared between replicates</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
252 while read type count weight weightedCount
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
253 do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
254 if [[ "$type" -eq "1" ]]; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
255 echo "<tr><td>$type</td><td>$count</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
256 else
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
257 echo "<tr><td><a href='coincidences_${sample}_${type}.txt'>$type</a></td><td>$count</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
258 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
259 done < $outputDir/ClonalityOverView_$sample.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
260 echo "</table></div>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
261 done
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
262
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
263 cat $dir/naive_clonality.htm >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
264
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
265 echo "</div></div>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
266 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
267
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
268 #hasJunctionData="$(if head -n 1 $inputFile | grep -qE '3V.REGION.trimmed.nt.nb'; then echo 'Yes'; else echo 'No'; fi)"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
269
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
270 #if [[ "$hasJunctionData" == "Yes" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
271 if [ -a "$outputDir/junctionAnalysisProd_mean_wD.txt" ] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
272 echo "<div class='tabbertab' title='Junction Analysis'>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
273 echo "<img src='IGH_junctie_analyse.png' />" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
274
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
275 echo "<center><p style='font-size: 20;'>Unique rearrangements with a V, D and J gene assigned</p></center>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
276 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Productive mean</caption><thead><tr><th>Donor</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>CDR3.Length</th><thead></tr><tbody>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
277 while read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
278 do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
279 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
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
280 done < $outputDir/junctionAnalysisProd_mean_wD.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
281 echo "</tbody></table>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
282
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
283 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Unproductive mean</caption><thead><tr><th>Donor</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>CDR3.Length</th><thead></tr><tbody>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
284 while read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
285 do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
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>-</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
287 done < $outputDir/junctionAnalysisUnProd_mean_wD.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
288 echo "</tbody></table>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
289
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
290 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Productive median</caption><thead><tr><th>Donor</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>CDR3.Length</th><thead></tr><tbody>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
291 while read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
292 do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
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
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
294 done < $outputDir/junctionAnalysisProd_median_wD.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
295 echo "</tbody></table>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
296
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
297 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Unproductive median</caption><thead><tr><th>Donor</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>CDR3.Length</th><thead></tr><tbody>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
298 while read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
299 do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
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>-</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
301 done < $outputDir/junctionAnalysisUnProd_median_wD.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
302 echo "</tbody></table>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
303
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
304 # again for no-d
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
305 echo "<center><p style='font-size: 20;'>Unique rearrangements with only a V and J gene assigned</p></center>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
306 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Productive mean</caption><thead><tr><th>Donor</th><th>Number of sequences</th><th>V.DEL</th><th>P1</th><th>N</th><th>P2</th><th>DEL.J</th><th>Total.Del</th><th>Total.N</th><th>Total.P</th><th>CDR3.Length</th><thead></tr><tbody>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
307 while read Sample unique VDEL P1 N1 P2 DELJ TotalDel TotalN TotalP median
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
308 do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
309 echo "<tr><td>$Sample</td><td>$unique</td><td>$VDEL</td><td>$P1</td><td>$N1</td><td>$P2</td><td>$DELJ</td><td>$TotalDel</td><td>$TotalN</td><td>$TotalP</td><td>$median</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
310 done < $outputDir/junctionAnalysisProd_mean_nD.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
311 echo "</tbody></table>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
312
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
313 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Unproductive mean</caption><thead><tr><th>Donor</th><th>Number of sequences</th><th>V.DEL</th><th>P1</th><th>N</th><th>P2</th><th>DEL.J</th><th>Total.Del</th><th>Total.N</th><th>Total.P</th><th>CDR3.Length</th><thead></tr><tbody>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
314 while read Sample unique VDEL P1 N1 P2 DELJ TotalDel TotalN TotalP median
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
315 do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
316 echo "<tr><td>$Sample</td><td>$unique</td><td>$VDEL</td><td>$P1</td><td>$N1</td><td>$P2</td><td>$DELJ</td><td>$TotalDel</td><td>$TotalN</td><td>$TotalP</td><td>-</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
317 done < $outputDir/junctionAnalysisUnProd_mean_nD.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
318 echo "</tbody></table>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
319
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
320 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Productive median</caption><thead><tr><th>Donor</th><th>Number of sequences</th><th>V.DEL</th><th>P1</th><th>N</th><th>P2</th><th>DEL.J</th><th>Total.Del</th><th>Total.N</th><th>Total.P</th><th>CDR3.Length</th><thead></tr><tbody>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
321 while read Sample unique VDEL P1 N1 P2 DELJ TotalDel TotalN TotalP median
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
322 do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
323 echo "<tr><td>$Sample</td><td>$unique</td><td>$VDEL</td><td>$P1</td><td>$N1</td><td>$P2</td><td>$DELJ</td><td>$TotalDel</td><td>$TotalN</td><td>$TotalP</td><td>$median</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
324 done < $outputDir/junctionAnalysisProd_median_nD.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
325 echo "</tbody></table>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
326
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
327 echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Unproductive median</caption><thead><tr><th>Donor</th><th>Number of sequences</th><th>V.DEL</th><th>P1</th><th>N</th><th>P2</th><th>DEL.J</th><th>Total.Del</th><th>Total.N</th><th>Total.P</th><th>CDR3.Length</th><thead></tr><tbody>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
328 while read Sample unique VDEL P1 N1 P2 DELJ TotalDel TotalN TotalP median
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
329 do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
330 echo "<tr><td>$Sample</td><td>$unique</td><td>$VDEL</td><td>$P1</td><td>$N1</td><td>$P2</td><td>$DELJ</td><td>$TotalDel</td><td>$TotalN</td><td>$TotalP</td><td>-</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
331 done < $outputDir/junctionAnalysisUnProd_median_nD.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
332 echo "</tbody></table>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
333
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
334 cat $dir/naive_junction.htm >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
335
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
336 echo "</div>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
337 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
338
57
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
339
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
340 # Create zip file with all download files
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
341 # Use 7za as it is packaged in the container already.
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
342 cd "$outputDir" || exit 1
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
343
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
344 7za a -tzip "$ALL_OUTPUTS_ZIP" -- \
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
345 allUnique.txt VFFrequency.txt VFrequency.txt \
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
346 JFrequency.txt DReadingFrame.txt CDR3LengthPlot.txt \
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
347 AAComposition.txt clonalityComplete.txt
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
348
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
349 if [[ "$useD" == "true" ]] ; then
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
350 7za a -tzip "$ALL_OUTPUTS_ZIP" -- \
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
351 DFFrequency.txt DFrequency.txt
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
352 fi
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
353 for sample in $samples; do
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
354 if [[ "$useD" == "true" ]] ; then
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
355 7za a -tzip "$ALL_OUTPUTS_ZIP" -- \
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
356 "HeatmapVD_$sample.txt" "HeatmapDJ_$sample.txt" \
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
357 "${sample}_VD_circos.txt" "${sample}_DJ_circos.txt"
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
358 fi
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
359 7za a -tzip "$ALL_OUTPUTS_ZIP" -- \
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
360 "HeatmapVJ_$sample.txt" "${sample}_VJ_circos.txt"
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
361 done
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
362
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
363 cd $dir || exit 1
33412e85e669 "planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
rhpvorderman
parents: 54
diff changeset
364
53
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
365 echo "<div class='tabbertab' title='Downloads'>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
366 echo "<table class='pure-table pure-table-striped'>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
367 echo "<thead><tr><th>Description</th><th>Link</th></tr></thead>" >> $outputFile
58
4c6df851e262 "planemo upload commit 1a7731bb4fe2e80fb1fdc88121783068af3edb08"
rhpvorderman
parents: 57
diff changeset
368 echo "<tr><td>All outputs below in a zip file</td><td><a href='all_outputs.zip'>Download</a></td></tr>" >> $outputFile
53
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
369 echo "<tr><td>The filtered dataset</td><td><a href='allUnique.txt'>Download</a></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
370 echo "<tr><td colspan='2' style='background-color:#E0E0E0;'>Gene frequencies</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
371
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
372 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
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
373 if [[ "$useD" == "true" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
374 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
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
375 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
376
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
377 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
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
378 if [[ "$useD" == "true" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
379 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
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
380 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
381 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
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
382 echo "<tr><td>The dataset used to generate the relative frequency of the D reading frame graph</td><td><a href='DReadingFrame.txt'>Download</a></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
383
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
384 echo "<tr><td colspan='2' style='background-color:#E0E0E0;'>CDR3 Characteristics</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
385 echo "<tr><td>The dataset used to generate the CDR3 length frequency graph</td><td><a href='CDR3LengthPlot.txt'>Download</a></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
386 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
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
387
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
388 echo "<tr><td colspan='2' style='background-color:#E0E0E0;'>Heatmaps</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
389 for sample in $samples; do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
390 if [[ "$useD" == "true" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
391 echo "<tr><td>The data used to generate the VD heatmap for $sample.</td><td><a href='HeatmapVD_$sample.txt'>Download</a></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
392 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
393 echo "<tr><td>The data used to generate the VJ heatmap for $sample.</td><td><a href='HeatmapVJ_$sample.txt'>Download</a></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
394 if [[ "$useD" == "true" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
395 echo "<tr><td>The data used to generate the DJ heatmap for $sample.</td><td><a href='HeatmapDJ_$sample.txt'>Download</a></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
396 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
397 done
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
398
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
399 echo "<tr><td colspan='2' style='background-color:#E0E0E0;'>Circos</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
400 for sample in $samples; do
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
401 if [[ "$useD" == "true" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
402 echo "<tr><td>The data used to generate the VD Circos plots for $sample.</td><td><a href='${sample}_VD_circos.txt'>Download</a></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
403 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
404 echo "<tr><td>The data used to generate the VJ Circos plots for $sample.</td><td><a href='${sample}_VJ_circos.txt'>Download</a></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
405 if [[ "$useD" == "true" ]] ; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
406 echo "<tr><td>The data used to generate the DJ Circos plots for $sample.</td><td><a href='${sample}_DJ_circos.txt'>Download</a></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
407 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
408 done
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
409
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
410 #echo "<tr><td>A frequency count of V Gene + J Gene + CDR3</td><td><a href='VJCDR3_count.txt'>Download</a></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
411
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
412 echo "<tr><td colspan='2' style='background-color:#E0E0E0;'>Clonality</td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
413 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
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
414 # echo "<tr><td>Sequences that are present in more than one replicate</td><td><a href='clonaltypes_replicates.txt'>Download</a></td></tr>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
415
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
416 echo "</table>" >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
417
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
418 cat $dir/naive_downloads.htm >> $outputFile
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
419
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
420 echo "</div></html>" >> $outputFile