0
|
1 #!/bin/bash
|
|
2 #set -e
|
|
3 dir="$(cd "$(dirname "$0")" && pwd)"
|
|
4 input=$1
|
|
5 method=$2
|
|
6 log=$3 #becomes the main html page at the end
|
|
7 outdir=$4
|
|
8 output="$outdir/index.html" #copied to $log location at the end
|
34
|
9 title="$5"
|
0
|
10 include_fr1=$6
|
|
11 functionality=$7
|
|
12 unique=$8
|
28
|
13 naive_output=$9
|
|
14 naive_output_ca=${10}
|
|
15 naive_output_cg=${11}
|
|
16 naive_output_cm=${12}
|
|
17 naive_output_ce=${13}
|
|
18 naive_output_all=${14}
|
|
19 filter_unique=${15}
|
49
|
20 filter_unique_count=${16}
|
|
21 class_filter=${17}
|
|
22 empty_region_filter=${18}
|
|
23 fast=${19}
|
|
24
|
0
|
25 mkdir $outdir
|
|
26
|
|
27 tar -xzf $dir/style.tar.gz -C $outdir
|
|
28
|
|
29 echo "---------------- read parameters ----------------"
|
|
30 echo "---------------- read parameters ----------------<br />" > $log
|
|
31
|
|
32 echo "unpacking IMGT file"
|
|
33
|
|
34 type="`file $input`"
|
|
35 if [[ "$type" == *"Zip archive"* ]] ; then
|
|
36 echo "Zip archive"
|
|
37 echo "unzip $input -d $PWD/files/"
|
|
38 unzip $input -d $PWD/files/
|
|
39 elif [[ "$type" == *"XZ compressed data"* ]] ; then
|
|
40 echo "ZX archive"
|
|
41 echo "tar -xJf $input -C $PWD/files/"
|
34
|
42 mkdir -p "$PWD/files/$title"
|
|
43 tar -xJf $input -C "$PWD/files/$title"
|
0
|
44 fi
|
|
45
|
35
|
46 cat "`find $PWD/files/ -name "1_*"`" > $PWD/summary.txt
|
|
47 cat "`find $PWD/files/ -name "3_*"`" > $PWD/sequences.txt
|
40
|
48 cat "`find $PWD/files/ -name "4_*"`" > $PWD/gapped_aa.txt
|
35
|
49 cat "`find $PWD/files/ -name "5_*"`" > $PWD/aa.txt
|
|
50 cat "`find $PWD/files/ -name "6_*"`" > $PWD/junction.txt
|
|
51 cat "`find $PWD/files/ -name "7_*"`" > $PWD/mutationanalysis.txt
|
|
52 cat "`find $PWD/files/ -name "8_*"`" > $PWD/mutationstats.txt
|
|
53 cat "`find $PWD/files/ -name "10_*"`" > $PWD/hotspots.txt
|
0
|
54
|
|
55 if [[ ${#BLASTN_DIR} -ge 5 ]] ; then
|
|
56 echo "On server, using BLASTN_DIR env: ${BLASTN_DIR}"
|
|
57 else
|
|
58 BLASTN_DIR="/home/galaxy/Downloads/ncbi-blast-2.4.0+/bin"
|
|
59 echo "Dev Galaxy set BLASTN_DIR to: ${BLASTN_DIR}"
|
|
60 fi
|
|
61
|
|
62 echo "---------------- class identification ----------------"
|
|
63 echo "---------------- class identification ----------------<br />" >> $log
|
|
64
|
|
65 python $dir/gene_identification.py --input $PWD/summary.txt --output $outdir/identified_genes.txt
|
|
66
|
|
67 echo "---------------- merge_and_filter.r ----------------"
|
|
68 echo "---------------- merge_and_filter.r ----------------<br />" >> $log
|
|
69
|
49
|
70 Rscript $dir/merge_and_filter.r $PWD/summary.txt $PWD/sequences.txt $PWD/mutationanalysis.txt $PWD/mutationstats.txt $PWD/hotspots.txt "$PWD/gapped_aa.txt" $outdir/identified_genes.txt $outdir/merged.txt $outdir/before_unique_filter.txt $outdir/unmatched.txt $method $functionality $unique ${filter_unique} ${filter_unique_count} ${class_filter} ${empty_region_filter} 2>&1
|
0
|
71
|
5
|
72 if [[ "$fast" == "no" ]] ; then
|
0
|
73
|
5
|
74 echo "---------------- creating new IMGT zips ----------------"
|
|
75 echo "---------------- creating new IMGT zips ----------------<br />" >> $log
|
|
76
|
|
77 mkdir $outdir/new_IMGT
|
0
|
78
|
36
|
79 cat "`find $PWD/files/ -name "1_*"`" > "$outdir/new_IMGT/1_Summary.txt"
|
|
80 cat "`find $PWD/files/ -name "2_*"`" > "$outdir/new_IMGT/2_IMGT-gapped-nt-sequences.txt"
|
|
81 cat "`find $PWD/files/ -name "3_*"`" > "$outdir/new_IMGT/3_Nt-sequences.txt"
|
|
82 cat "`find $PWD/files/ -name "4_*"`" > "$outdir/new_IMGT/4_IMGT-gapped-AA-sequences.txt"
|
|
83 cat "`find $PWD/files/ -name "5_*"`" > "$outdir/new_IMGT/5_AA-sequences.txt"
|
|
84 cat "`find $PWD/files/ -name "6_*"`" > "$outdir/new_IMGT/6_Junction.txt"
|
|
85 cat "`find $PWD/files/ -name "7_*"`" > "$outdir/new_IMGT/7_V-REGION-mutation-and-AA-change-table.txt"
|
|
86 cat "`find $PWD/files/ -name "8_*"`" > "$outdir/new_IMGT/8_V-REGION-nt-mutation-statistics.txt"
|
|
87 cat "`find $PWD/files/ -name "9_*"`" > "$outdir/new_IMGT/9_V-REGION-AA-change-statistics.txt"
|
|
88 cat "`find $PWD/files/ -name "10_*"`" > "$outdir/new_IMGT/10_V-REGION-mutation-hotspots.txt"
|
0
|
89
|
5
|
90 mkdir $outdir/new_IMGT_IGA
|
|
91 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA
|
0
|
92
|
5
|
93 mkdir $outdir/new_IMGT_IGA1
|
|
94 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA1
|
0
|
95
|
5
|
96 mkdir $outdir/new_IMGT_IGA2
|
|
97 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA2
|
0
|
98
|
5
|
99 mkdir $outdir/new_IMGT_IGG
|
|
100 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG
|
0
|
101
|
5
|
102 mkdir $outdir/new_IMGT_IGG1
|
|
103 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG1
|
0
|
104
|
5
|
105 mkdir $outdir/new_IMGT_IGG2
|
|
106 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG2
|
0
|
107
|
5
|
108 mkdir $outdir/new_IMGT_IGG3
|
|
109 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG3
|
0
|
110
|
5
|
111 mkdir $outdir/new_IMGT_IGG4
|
|
112 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG4
|
|
113
|
|
114 mkdir $outdir/new_IMGT_IGM
|
|
115 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGM
|
0
|
116
|
5
|
117 mkdir $outdir/new_IMGT_IGE
|
|
118 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGE
|
0
|
119
|
5
|
120 Rscript $dir/new_imgt.r $outdir/new_IMGT/ $outdir/merged.txt "-" 2>&1
|
|
121
|
|
122 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA/ $outdir/merged.txt "IGA" 2>&1
|
|
123 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA1/ $outdir/merged.txt "IGA1" 2>&1
|
|
124 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA2/ $outdir/merged.txt "IGA2" 2>&1
|
0
|
125
|
5
|
126 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG/ $outdir/merged.txt "IGG" 2>&1
|
|
127 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG1/ $outdir/merged.txt "IGG1" 2>&1
|
|
128 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG2/ $outdir/merged.txt "IGG2" 2>&1
|
|
129 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG3/ $outdir/merged.txt "IGG3" 2>&1
|
|
130 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG4/ $outdir/merged.txt "IGG4" 2>&1
|
0
|
131
|
5
|
132 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGM/ $outdir/merged.txt "IGM" 2>&1
|
0
|
133
|
5
|
134 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGE/ $outdir/merged.txt "IGE" 2>&1
|
0
|
135
|
|
136
|
5
|
137 tmp="$PWD"
|
|
138 cd $outdir/new_IMGT/ #tar weirdness...
|
|
139 tar -cJf ../new_IMGT.txz *
|
0
|
140
|
5
|
141 cd $outdir/new_IMGT_IGA/
|
|
142 tar -cJf ../new_IMGT_IGA.txz *
|
0
|
143
|
5
|
144 cd $outdir/new_IMGT_IGA1/
|
|
145 tar -cJf ../new_IMGT_IGA1.txz *
|
0
|
146
|
5
|
147 cd $outdir/new_IMGT_IGA2/
|
|
148 tar -cJf ../new_IMGT_IGA2.txz *
|
0
|
149
|
5
|
150 cd $outdir/new_IMGT_IGG/
|
|
151 tar -cJf ../new_IMGT_IGG.txz *
|
0
|
152
|
5
|
153 cd $outdir/new_IMGT_IGG1/
|
|
154 tar -cJf ../new_IMGT_IGG1.txz *
|
0
|
155
|
5
|
156 cd $outdir/new_IMGT_IGG2/
|
|
157 tar -cJf ../new_IMGT_IGG2.txz *
|
|
158
|
|
159 cd $outdir/new_IMGT_IGG3/
|
|
160 tar -cJf ../new_IMGT_IGG3.txz *
|
0
|
161
|
5
|
162 cd $outdir/new_IMGT_IGG4/
|
|
163 tar -cJf ../new_IMGT_IGG4.txz *
|
|
164
|
|
165 cd $outdir/new_IMGT_IGM/
|
|
166 tar -cJf ../new_IMGT_IGM.txz *
|
0
|
167
|
5
|
168 cd $outdir/new_IMGT_IGE/
|
|
169 tar -cJf ../new_IMGT_IGE.txz *
|
0
|
170
|
5
|
171 cd $tmp
|
|
172 fi
|
0
|
173
|
|
174 echo "---------------- shm_csr.r ----------------"
|
|
175 echo "---------------- shm_csr.r ----------------<br />" >> $log
|
|
176
|
5
|
177 classes="IGA,IGA1,IGA2,IGG,IGG1,IGG2,IGG3,IGG4,IGM,IGE,unmatched"
|
0
|
178 echo "R mutation analysis"
|
1
|
179 Rscript $dir/shm_csr.r $outdir/merged.txt $classes $outdir ${empty_region_filter} 2>&1
|
0
|
180
|
43
|
181 echo "---------------- plot_pdfs.r ----------------"
|
|
182 echo "---------------- plot_pdfs.r ----------------<br />" >> $log
|
|
183
|
|
184 echo "Rscript $dir/shm_csr.r $outdir/pdfplots.RData $outdir 2>&1"
|
|
185
|
|
186 Rscript $dir/plot_pdf.r "$outdir/pdfplots.RData" "$outdir" 2>&1
|
|
187
|
0
|
188 echo "---------------- shm_csr.py ----------------"
|
|
189 echo "---------------- shm_csr.py ----------------<br />" >> $log
|
|
190
|
1
|
191 python $dir/shm_csr.py --input $outdir/merged.txt --genes $classes --empty_region_filter "${empty_region_filter}" --output $outdir/hotspot_analysis.txt
|
0
|
192
|
|
193 echo "---------------- aa_histogram.r ----------------"
|
|
194 echo "---------------- aa_histogram.r ----------------<br />" >> $log
|
|
195
|
5
|
196 Rscript $dir/aa_histogram.r $outdir/aa_id_mutations.txt $outdir/absent_aa_id.txt "IGA,IGG,IGM,IGE" $outdir/ 2>&1
|
0
|
197 if [ -e "$outdir/aa_histogram_.png" ]; then
|
|
198 mv $outdir/aa_histogram_.png $outdir/aa_histogram.png
|
42
|
199 mv $outdir/aa_histogram_.pdf $outdir/aa_histogram.pdf
|
0
|
200 mv $outdir/aa_histogram_.txt $outdir/aa_histogram.txt
|
29
|
201 mv $outdir/aa_histogram_absent_.txt $outdir/aa_histogram_absent.txt
|
|
202 mv $outdir/aa_histogram_count_.txt $outdir/aa_histogram_count.txt
|
|
203 mv $outdir/aa_histogram_sum_.txt $outdir/aa_histogram_sum.txt
|
0
|
204 fi
|
|
205
|
5
|
206 genes=(IGA IGA1 IGA2 IGG IGG1 IGG2 IGG3 IGG4 IGM IGE)
|
0
|
207
|
|
208 funcs=(sum mean median)
|
|
209 funcs=(sum)
|
|
210
|
|
211 echo "---------------- sequence_overview.r ----------------"
|
|
212 echo "---------------- sequence_overview.r ----------------<br />" >> $log
|
|
213
|
|
214 mkdir $outdir/sequence_overview
|
|
215
|
7
|
216 Rscript $dir/sequence_overview.r $outdir/before_unique_filter.txt $outdir/merged.txt $outdir/sequence_overview $classes $outdir/hotspot_analysis_sum.txt ${empty_region_filter} 2>&1
|
0
|
217
|
|
218 echo "<table border='1'>" > $outdir/base_overview.html
|
|
219
|
|
220 while IFS=$'\t' read ID class seq A C G T
|
|
221 do
|
|
222 echo "<tr><td>$ID</td><td>$seq</td><td>$class</td><td>$A</td><td>$C</td><td>$G</td><td>$T</td></tr>" >> $outdir/base_overview.html
|
|
223 done < $outdir/sequence_overview/ntoverview.txt
|
|
224
|
|
225 echo "<html><center><h1>$title</h1></center>" > $output
|
|
226 echo "<meta name='viewport' content='width=device-width, initial-scale=1'>" >> $output
|
|
227 echo "<script type='text/javascript' src='jquery-1.11.0.min.js'></script>" >> $output
|
|
228 echo "<script type='text/javascript' src='tabber.js'></script>" >> $output
|
|
229 echo "<script type='text/javascript' src='script.js'></script>" >> $output
|
|
230 echo "<link rel='stylesheet' type='text/css' href='style.css'>" >> $output
|
|
231 echo "<link rel='stylesheet' type='text/css' href='pure-min.css'>" >> $output
|
|
232
|
|
233 matched_count="`cat $outdir/merged.txt | grep -v 'unmatched' | tail -n +2 | wc -l`"
|
|
234 unmatched_count="`cat $outdir/unmatched.txt | tail -n +2 | wc -l`"
|
|
235 total_count=$((matched_count + unmatched_count))
|
|
236 perc_count=$((unmatched_count / total_count * 100))
|
|
237 perc_count=`bc -l <<< "scale=2; ${unmatched_count} / ${total_count} * 100"`
|
|
238 perc_count=`bc -l <<< "scale=2; (${unmatched_count} / ${total_count} * 100 ) / 1"`
|
|
239
|
|
240 echo "<center><h2>Total: ${total_count}</h2></center>" >> $output
|
|
241 echo "<center><h2>Matched: ${matched_count} Unmatched: ${unmatched_count}</h2></center>" >> $output
|
|
242 echo "<center><h2>Percentage unmatched: ${perc_count}</h2></center>" >> $output
|
|
243
|
|
244 echo "---------------- main tables ----------------"
|
|
245 echo "---------------- main tables ----------------<br />" >> $log
|
|
246
|
|
247 echo "<div class='tabber'>" >> $output
|
23
|
248 echo "<div class='tabbertab' title='SHM Overview' style='width: 3000px;'>" >> $output
|
0
|
249
|
|
250 for func in ${funcs[@]}
|
|
251 do
|
|
252
|
|
253 echo "---------------- $func table ----------------"
|
|
254 echo "---------------- $func table ----------------<br />" >> $log
|
|
255
|
47
|
256 cat $outdir/mutations_${func}.txt $outdir/shm_overview_tandem_row.txt $outdir/hotspot_analysis_${func}.txt > $outdir/data_${func}.txt
|
0
|
257
|
|
258 echo "---------------- pattern_plots.r ----------------"
|
|
259 echo "---------------- pattern_plots.r ----------------<br />" >> $log
|
|
260
|
43
|
261 Rscript $dir/pattern_plots.r $outdir/data_${func}.txt $outdir/aid_motives $outdir/relative_mutations $outdir/absolute_mutations $outdir/shm_overview.txt 2>&1
|
0
|
262
|
|
263 echo "<table class='pure-table pure-table-striped'>" >> $output
|
|
264 echo "<thead><tr><th>info</th>" >> $output
|
|
265
|
|
266 if [ "${class_filter}" != "101_101" ] ; then
|
|
267
|
|
268 for gene in ${genes[@]}
|
|
269 do
|
|
270 tmp=`cat $outdir/${gene}_${func}_n.txt`
|
|
271 echo "<th><a href='matched_${gene}_${func}.txt'>${gene} (N = $tmp)</a></th>" >> $output
|
|
272 done
|
|
273
|
|
274 tmp=`cat $outdir/all_${func}_n.txt`
|
|
275 echo "<th><a href='matched_all_${func}.txt'>all (N = $tmp)</a></th>" >> $output
|
|
276 tmp=`cat $outdir/unmatched_${func}_n.txt`
|
|
277 echo "<th><a href='unmatched.txt'>unmatched (N = ${unmatched_count})</a></th><tr></thead>" >> $output
|
|
278
|
5
|
279 while IFS=, read name cax cay caz ca1x ca1y ca1z ca2x ca2y ca2z cgx cgy cgz cg1x cg1y cg1z cg2x cg2y cg2z cg3x cg3y cg3z cg4x cg4y cg4z cmx cmy cmz cex cey cez unx uny unz allx ally allz
|
0
|
280 do
|
47
|
281 if [ "$name" == "FR R/S (ratio)" ] || [ "$name" == "CDR R/S (ratio)" ] || [ "$name" == "Tandems/Expected (ratio)" ] ; then #meh
|
5
|
282 echo "<tr><td>$name</td><td>${cax}/${cay} (${caz})</td><td>${ca1x}/${ca1y} (${ca1z})</td><td>${ca2x}/${ca2y} (${ca2z})</td><td>${cgx}/${cgy} (${cgz})</td><td>${cg1x}/${cg1y} (${cg1z})</td><td>${cg2x}/${cg2y} (${cg2z})</td><td>${cg3x}/${cg3y} (${cg3z})</td><td>${cg4x}/${cg4y} (${cg4z})</td><td>${cmx}/${cmy} (${cmz})</td><td>${cex}/${cey} (${cez})</td><td>${allx}/${ally} (${allz})</td><td>${unx}/${uny} (${unz})</td></tr>" >> $output
|
0
|
283 elif [ "$name" == "Median of Number of Mutations (%)" ] ; then
|
5
|
284 echo "<tr><td>$name</td><td>${caz}%</td><td>${ca1z}%</td><td>${ca2z}%</td><td>${cgz}%</td><td>${cg1z}%</td><td>${cg2z}%</td><td>${cg3z}%</td><td>${cg4z}%</td><td>${cmz}%</td><td>${cez}%</td><td>${allz}%</td><td>${unz}%</td></tr>" >> $output
|
0
|
285 else
|
5
|
286 echo "<tr><td>$name</td><td>${cax}/${cay} (${caz}%)</td><td>${ca1x}/${ca1y} (${ca1z}%)</td><td>${ca2x}/${ca2y} (${ca2z}%)</td><td>${cgx}/${cgy} (${cgz}%)</td><td>${cg1x}/${cg1y} (${cg1z}%)</td><td>${cg2x}/${cg2y} (${cg2z}%)</td><td>${cg3x}/${cg3y} (${cg3z}%)</td><td>${cg4x}/${cg4y} (${cg4z}%)</td><td>${cmx}/${cmy} (${cmz}%)</td><td>${cex}/${cey} (${cez}%)</td><td>${allx}/${ally} (${allz}%)</td><td>${unx}/${uny} (${unz}%)</td></tr>" >> $output
|
0
|
287 fi
|
|
288 done < $outdir/data_${func}.txt
|
|
289
|
|
290 else
|
3
|
291 tmp=`cat $outdir/all_${func}_n.txt`
|
0
|
292 echo "<th><a href='matched_all_${func}.txt'>all (N = $tmp)</a></th>" >> $output
|
|
293
|
5
|
294 while IFS=, read name cax cay caz ca1x ca1y ca1z ca2x ca2y ca2z cgx cgy cgz cg1x cg1y cg1z cg2x cg2y cg2z cg3x cg3y cg3z cg4x cg4y cg4z cmx cmy cmz cex cey cez unx uny unz allx ally allz
|
0
|
295 do
|
|
296 if [ "$name" == "FR R/S (ratio)" ] || [ "$name" == "CDR R/S (ratio)" ] ; then #meh
|
3
|
297 echo "<tr><td>$name</td><td>${allx}/${ally}</td></tr>" >> $output
|
0
|
298 elif [ "$name" == "Median of Number of Mutations (%)" ] ; then
|
3
|
299 echo "<tr><td>$name</td><td>${allz}%</td></tr>" >> $output
|
0
|
300 else
|
3
|
301 echo "<tr><td>$name</td><td>${allx}/${ally} (${allz}%)</td></tr>" >> $output
|
0
|
302 fi
|
|
303 done < $outdir/data_${func}.txt
|
|
304
|
|
305 fi
|
|
306 echo "</table>" >> $output
|
|
307 #echo "<a href='data_${func}.txt'>Download data</a>" >> $output
|
|
308 done
|
|
309
|
42
|
310 echo "<a href='aid_motives.pdf'><img src='aid_motives.png' /></a><br />" >> $output
|
|
311 echo "<a href='relative_mutations.pdf'><img src='relative_mutations.png' /></a><br />" >> $output
|
43
|
312 echo "<a href='absolute_mutations.pdf'><img src='absolute_mutations.png' /></a><br />" >> $output
|
39
|
313 echo "<br />" >> $output
|
|
314 cat $dir/shm_overview.htm >> $output
|
0
|
315 echo "</div>" >> $output #SHM overview tab end
|
|
316
|
|
317 echo "---------------- images ----------------"
|
|
318 echo "---------------- images ----------------<br />" >> $log
|
|
319
|
42
|
320 echo "<div class='tabbertab' title='SHM Frequency' style='width: 3000px;'></a>" >> $output
|
0
|
321
|
|
322 if [ -a $outdir/scatter.png ]
|
|
323 then
|
42
|
324 echo "<a href='scatter.pdf'><img src='scatter.png'/><br />" >> $output
|
0
|
325 fi
|
|
326 if [ -a $outdir/frequency_ranges.png ]
|
|
327 then
|
42
|
328 echo "<a href='frequency_ranges.pdf'><img src='frequency_ranges.png'/></a><br />" >> $output
|
0
|
329 fi
|
|
330
|
39
|
331 echo "<br />" >> $output
|
|
332 cat $dir/shm_frequency.htm >> $output
|
|
333
|
0
|
334 echo "</div>" >> $output #SHM frequency tab end
|
|
335
|
23
|
336 echo "<div class='tabbertab' title='Transition tables' style='width: 3000px;'>" >> $output
|
0
|
337
|
|
338 echo "<table border='0'>" >> $output
|
|
339
|
|
340 for gene in ${genes[@]}
|
|
341 do
|
|
342 echo "<tr>" >> $output
|
|
343 echo "<td><h1>${gene}</h1></td>" >> $output
|
23
|
344
|
|
345 if [ -e $outdir/transitions_heatmap_${gene}.png ]
|
|
346 then
|
42
|
347 echo "<td><a href='transitions_heatmap_${gene}.pdf'><img src='transitions_heatmap_${gene}.png' /></a></td>" >> $output
|
23
|
348 else
|
|
349 echo "<td></td>" >> $output
|
|
350 fi
|
|
351
|
|
352 if [ -e $outdir/transitions_stacked_${gene}.png ]
|
|
353 then
|
42
|
354 echo "<td><a href='transitions_stacked_${gene}.pdf'><img src='transitions_stacked_${gene}.png' /></a></td>" >> $output
|
23
|
355 else
|
|
356 echo "<td></td>" >> $output
|
|
357 fi
|
|
358
|
0
|
359 echo "<td><table style='border-left-width: 1;' class='pure-table transition-table pure-table-bordered'>" >> $output
|
|
360 echo "<tr><td></td><td colspan="5"><center>To</center></td></tr>" >> $output
|
|
361 first="true"
|
|
362 while IFS=, read from a c g t
|
|
363 do
|
|
364 if [ "$first" == "true" ] ; then
|
|
365 echo "<tr><td rowspan='5'>From</td><td>$from</td><td>$a</td><td>$c</td><td>$g</td><td>$t</td></tr>" >> $output
|
|
366 first="false"
|
|
367 else
|
|
368 echo "<tr><td>$from</td><td>$a</td><td>$c</td><td>$g</td><td>$t</td></tr>" >> $output
|
|
369 fi
|
|
370 done < $outdir/transitions_${gene}_sum.txt
|
|
371 echo "</table></td>" >> $output
|
|
372
|
|
373 echo "</tr>" >> $output
|
|
374 done
|
|
375
|
|
376 echo "<tr>" >> $output
|
|
377 echo "<td><h1>All</h1></td>" >> $output
|
42
|
378 echo "<td><a href='transitions_heatmap_all.pdf'><img src='transitions_heatmap_all.png' /></a></td>" >> $output
|
|
379 echo "<td><a href='transitions_stacked_all.pdf'><img src='transitions_stacked_all.png' /></a></td>" >> $output
|
0
|
380 echo "<td><table style='border-left-width: 1;' class='pure-table transition-table pure-table-bordered'>" >> $output
|
|
381 echo "<tr><td></td><td colspan="5"><center>To</center></td></tr>" >> $output
|
|
382 first="true"
|
|
383 while IFS=, read from a c g t
|
|
384 do
|
|
385 if [ "$first" == "true" ] ; then
|
|
386 echo "<tr><td rowspan='5'>From</td><td>$from</td><td>$a</td><td>$c</td><td>$g</td><td>$t</td></tr>" >> $output
|
|
387 first="false"
|
|
388 else
|
|
389 echo "<tr><td>$from</td><td>$a</td><td>$c</td><td>$g</td><td>$t</td></tr>" >> $output
|
|
390 fi
|
|
391 done < $outdir/transitions_all_sum.txt
|
|
392 echo "</table></td>" >> $output
|
|
393
|
|
394 echo "</tr>" >> $output
|
|
395
|
|
396 echo "</table>" >> $output
|
|
397
|
39
|
398 echo "<br />" >> $output
|
|
399 cat $dir/shm_transition.htm >> $output
|
|
400
|
0
|
401 echo "</div>" >> $output #transition tables tab end
|
|
402
|
|
403 echo "<div class='tabbertab' title='Antigen Selection'>" >> $output
|
|
404
|
23
|
405 if [ -e $outdir/aa_histogram.png ]
|
0
|
406 then
|
42
|
407 echo "<a href='aa_histogram.pdf'><img src='aa_histogram.png'/></a><br />" >> $output
|
23
|
408 fi
|
|
409
|
|
410 if [ -e $outdir/aa_histogram_IGA.png ]
|
|
411 then
|
42
|
412 echo "<a href='aa_histogram_IGA.pdf'><img src='aa_histogram_IGA.png'/></a><br />" >> $output
|
23
|
413 fi
|
|
414
|
|
415 if [ -e $outdir/aa_histogram_IGG.png ]
|
|
416 then
|
42
|
417 echo "<a href='aa_histogram_IGG.pdf'><img src='aa_histogram_IGG.png'/></a><br />" >> $output
|
23
|
418 fi
|
|
419
|
|
420 if [ -e $outdir/aa_histogram_IGM.png ]
|
|
421 then
|
42
|
422 echo "<a href='aa_histogram_IGM.pdf'><img src='aa_histogram_IGM.png'/></a><br />" >> $output
|
23
|
423 fi
|
|
424
|
|
425 if [ -e $outdir/aa_histogram_IGE.png ]
|
|
426 then
|
42
|
427 echo "<a href='aa_histogram_IGE.pdf'><img src='aa_histogram_IGE.png'/></a><br />" >> $output
|
0
|
428 fi
|
|
429
|
23
|
430
|
33
|
431
|
|
432 if [[ "$fast" == "no" ]] ; then
|
|
433
|
41
|
434
|
|
435
|
33
|
436 echo "---------------- baseline ----------------"
|
|
437 echo "---------------- baseline ----------------<br />" >> $log
|
|
438 tmp="$PWD"
|
|
439
|
|
440 mkdir $outdir/baseline
|
37
|
441
|
41
|
442 echo "<center><h1>BASELINe</h1>" >> $output
|
|
443 header_substring="Based on CDR1, FR2, CDR2, FR3 (27:27:38:55:65:104:-)"
|
|
444
|
37
|
445 baseline_boundaries="27:27:38:55:65:104:-"
|
|
446
|
|
447 if [[ "${empty_region_filter}" == "leader" ]] ; then
|
|
448 baseline_boundaries="1:26:38:55:65:104:-"
|
41
|
449 header_substring="Based on FR1, CDR1, FR2, CDR2, FR3 (1:26:38:55:65:104,-)"
|
37
|
450 fi
|
41
|
451
|
|
452 echo "<p>${header_substring}</p></center>" >> $output
|
23
|
453
|
33
|
454 mkdir $outdir/baseline/IGA_IGG_IGM
|
|
455 if [[ $(wc -l < $outdir/new_IMGT/1_Summary.txt) -gt "1" ]]; then
|
|
456 cd $outdir/baseline/IGA_IGG_IGM
|
41
|
457 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT.txz "IGA_IGG_IGM_IGE" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline.pdf" "Sequence.ID" "$outdir/baseline.txt"
|
33
|
458 else
|
|
459 echo "No sequences" > "$outdir/baseline.txt"
|
|
460 fi
|
|
461
|
|
462 mkdir $outdir/baseline/IGA
|
|
463 if [[ $(wc -l < $outdir/new_IMGT_IGA/1_Summary.txt) -gt "1" ]]; then
|
|
464 cd $outdir/baseline/IGA
|
37
|
465 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT_IGA.txz "IGA" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline_IGA.pdf" "Sequence.ID" "$outdir/baseline_IGA.txt"
|
33
|
466 else
|
|
467 echo "No IGA sequences" > "$outdir/baseline_IGA.txt"
|
|
468 fi
|
|
469
|
|
470 mkdir $outdir/baseline/IGG
|
|
471 if [[ $(wc -l < $outdir/new_IMGT_IGG/1_Summary.txt) -gt "1" ]]; then
|
|
472 cd $outdir/baseline/IGG
|
37
|
473 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT_IGG.txz "IGG" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline_IGG.pdf" "Sequence.ID" "$outdir/baseline_IGG.txt"
|
33
|
474 else
|
|
475 echo "No IGG sequences" > "$outdir/baseline_IGG.txt"
|
|
476 fi
|
23
|
477
|
33
|
478 mkdir $outdir/baseline/IGM
|
|
479 if [[ $(wc -l < $outdir/new_IMGT_IGM/1_Summary.txt) -gt "1" ]]; then
|
|
480 cd $outdir/baseline/IGM
|
37
|
481 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT_IGM.txz "IGM" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline_IGM.pdf" "Sequence.ID" "$outdir/baseline_IGM.txt"
|
33
|
482 else
|
|
483 echo "No IGM sequences" > "$outdir/baseline_IGM.txt"
|
|
484 fi
|
|
485
|
|
486 mkdir $outdir/baseline/IGE
|
|
487 if [[ $(wc -l < $outdir/new_IMGT_IGE/1_Summary.txt) -gt "1" ]]; then
|
|
488 cd $outdir/baseline/IGE
|
37
|
489 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT_IGE.txz "IGE" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline_IGE.pdf" "Sequence.ID" "$outdir/baseline_IGE.txt"
|
33
|
490 else
|
|
491 echo "No IGE sequences" > "$outdir/baseline_IGE.txt"
|
|
492 fi
|
|
493
|
|
494 cd $tmp
|
23
|
495
|
33
|
496 echo "Cleaning up *.RData files"
|
|
497 find $outdir/baseline -name "*.RData" -type f -delete
|
|
498
|
|
499 if [ -e $outdir/baseline.pdf ]
|
|
500 then
|
|
501 echo "<embed src='baseline.pdf' width='700px' height='1000px'>" >> $output
|
|
502 fi
|
|
503
|
|
504 if [ -e $outdir/baseline_IGA.pdf ]
|
|
505 then
|
|
506 echo "<embed src='baseline_IGA.pdf' width='700px' height='1000px'>" >> $output
|
|
507 fi
|
23
|
508
|
33
|
509 if [ -e $outdir/baseline_IGG.pdf ]
|
|
510 then
|
|
511 echo "<embed src='baseline_IGG.pdf' width='700px' height='1000px'>" >> $output
|
|
512 fi
|
|
513
|
|
514 if [ -e $outdir/baseline_IGM.pdf ]
|
|
515 then
|
|
516 echo "<embed src='baseline_IGM.pdf' width='700px' height='1000px'>" >> $output
|
|
517 fi
|
|
518
|
|
519 if [ -e $outdir/baseline_IGE.pdf ]
|
|
520 then
|
|
521 echo "<embed src='baseline_IGE.pdf' width='700px' height='1000px'>" >> $output
|
|
522 fi
|
23
|
523 fi
|
0
|
524
|
39
|
525 echo "<br />" >> $output
|
|
526 cat $dir/shm_selection.htm >> $output
|
|
527
|
0
|
528 echo "</div>" >> $output #antigen selection tab end
|
|
529
|
|
530 echo "<div class='tabbertab' title='CSR'>" >> $output #CSR tab
|
|
531
|
23
|
532 if [ -e $outdir/IGA.png ]
|
0
|
533 then
|
42
|
534 echo "<a href='IGA.pdf'><img src='IGA.png'/></a><br />" >> $output
|
0
|
535 fi
|
23
|
536 if [ -e $outdir/IGG.png ]
|
0
|
537 then
|
42
|
538 echo "<a href='IGG.pdf'><img src='IGG.png'/></a><br />" >> $output
|
0
|
539 fi
|
|
540
|
39
|
541 echo "<br />" >> $output
|
|
542 cat $dir/shm_csr.htm >> $output
|
|
543
|
0
|
544 echo "</div>" >> $output #CSR tab end
|
|
545
|
5
|
546 if [[ "$fast" == "no" ]] ; then
|
|
547
|
|
548 echo "---------------- change-o MakeDB ----------------"
|
0
|
549
|
5
|
550 mkdir $outdir/change_o
|
0
|
551
|
5
|
552 tmp="$PWD"
|
0
|
553
|
5
|
554 cd $outdir/change_o
|
0
|
555
|
5
|
556 bash $dir/change_o/makedb.sh $outdir/new_IMGT.txz false false false $outdir/change_o/change-o-db.txt
|
|
557 bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones.txt $outdir/change_o/change-o-defined_clones-summary.txt
|
55
|
558 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones.txt $outdir/change_o/change-o-db-defined_first_clones.txt 2>&1
|
|
559
|
|
560 mkdir $outdir/new_IMGT_changeo
|
|
561 cp $outdir/new_IMGT/* $outdir/new_IMGT_changeo
|
|
562
|
|
563 Rscript $dir/new_imgt.r $outdir/new_IMGT_changeo $outdir/change_o/change-o-db-defined_first_clones.txt "-" 2>&1
|
|
564
|
|
565 cd $outdir/new_IMGT_changeo
|
|
566 tar -cJf ../new_IMGT_first_seq_of_clone.txz *
|
|
567 cd $outdir/change_o
|
|
568
|
|
569 rm -rf $outdir/new_IMGT_changeo
|
|
570
|
5
|
571 Rscript $dir/merge.r $outdir/change_o/change-o-db-defined_clones.txt $outdir/merged.txt "all" "Sequence.ID,best_match" "SEQUENCE_ID" "Sequence.ID" $outdir/change_o/change-o-db-defined_clones.txt 2>&1
|
|
572 echo "Rscript $dir/merge.r $outdir/change_o/change-o-db-defined_clones.txt $outdir/$outdir/merged.txt 'all' 'Sequence.ID,best_match' 'Sequence.ID' 'Sequence.ID' '\t' $outdir/change_o/change-o-db-defined_clones.txt 2>&1"
|
55
|
573
|
5
|
574 if [[ $(wc -l < $outdir/new_IMGT_IGA/1_Summary.txt) -gt "1" ]]; then
|
|
575 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGA.txz false false false $outdir/change_o/change-o-db-IGA.txt
|
|
576 bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db-IGA.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones-IGA.txt $outdir/change_o/change-o-defined_clones-summary-IGA.txt
|
55
|
577 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones-IGA.txt $outdir/change_o/change-o-db-defined_first_clones-IGA.txt 2>&1
|
|
578
|
|
579 mkdir $outdir/new_IMGT_IGA_changeo
|
|
580 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA_changeo
|
|
581
|
|
582 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA_changeo $outdir/change_o/change-o-db-defined_first_clones-IGA.txt "-" 2>&1
|
|
583
|
|
584 cd $outdir/new_IMGT_IGA_changeo
|
|
585 tar -cJf ../new_IMGT_IGA_first_seq_of_clone.txz *
|
|
586
|
|
587 rm -rf $outdir/new_IMGT_IGA_changeo
|
|
588
|
|
589 cd $outdir/change_o
|
5
|
590 else
|
|
591 echo "No IGA sequences" > "$outdir/change_o/change-o-db-defined_clones-IGA.txt"
|
|
592 echo "No IGA sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGA.txt"
|
|
593 fi
|
55
|
594
|
5
|
595 if [[ $(wc -l < $outdir/new_IMGT_IGG/1_Summary.txt) -gt "1" ]]; then
|
|
596 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGG.txz false false false $outdir/change_o/change-o-db-IGG.txt
|
|
597 bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db-IGG.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones-IGG.txt $outdir/change_o/change-o-defined_clones-summary-IGG.txt
|
55
|
598 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones-IGG.txt $outdir/change_o/change-o-db-defined_first_clones-IGG.txt 2>&1
|
|
599
|
|
600 mkdir $outdir/new_IMGT_IGG_changeo
|
|
601 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG_changeo
|
|
602
|
|
603 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG_changeo $outdir/change_o/change-o-db-defined_first_clones-IGG.txt "-" 2>&1
|
|
604
|
|
605 cd $outdir/new_IMGT_IGG_changeo
|
|
606 tar -cJf ../new_IMGT_IGG_first_seq_of_clone.txz *
|
|
607 rm -rf $outdir/new_IMGT_IGG_changeo
|
|
608
|
|
609 cd $outdir/change_o
|
5
|
610 else
|
|
611 echo "No IGG sequences" > "$outdir/change_o/change-o-db-defined_clones-IGG.txt"
|
|
612 echo "No IGG sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGG.txt"
|
|
613 fi
|
0
|
614
|
5
|
615 if [[ $(wc -l < $outdir/new_IMGT_IGM/1_Summary.txt) -gt "1" ]]; then
|
|
616 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGM.txz false false false $outdir/change_o/change-o-db-IGM.txt
|
|
617 bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db-IGM.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones-IGM.txt $outdir/change_o/change-o-defined_clones-summary-IGM.txt
|
55
|
618 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones-IGM.txt $outdir/change_o/change-o-db-defined_first_clones-IGM.txt 2>&1
|
|
619
|
|
620 mkdir $outdir/new_IMGT_IGM_changeo
|
|
621 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGM_changeo
|
|
622
|
|
623 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGM_changeo $outdir/change_o/change-o-db-defined_first_clones-IGM.txt "-" 2>&1
|
|
624
|
|
625 cd $outdir/new_IMGT_IGM_changeo
|
|
626 tar -cJf ../new_IMGT_IGM_first_seq_of_clone.txz *
|
|
627
|
|
628 rm -rf $outdir/new_IMGT_IGM_changeo
|
|
629
|
|
630 cd $outdir/change_o
|
5
|
631 else
|
|
632 echo "No IGM sequences" > "$outdir/change_o/change-o-db-defined_clones-IGM.txt"
|
|
633 echo "No IGM sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGM.txt"
|
|
634 fi
|
0
|
635
|
6
|
636 if [[ $(wc -l < $outdir/new_IMGT_IGE/1_Summary.txt) -gt "1" ]]; then
|
|
637 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGE.txz false false false $outdir/change_o/change-o-db-IGE.txt
|
|
638 bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db-IGE.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones-IGE.txt $outdir/change_o/change-o-defined_clones-summary-IGE.txt
|
55
|
639 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones-IGE.txt $outdir/change_o/change-o-db-defined_first_clones-IGE.txt 2>&1
|
|
640
|
|
641 mkdir $outdir/new_IMGT_IGE_changeo
|
|
642 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGE_changeo
|
|
643
|
|
644 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGE_changeo $outdir/change_o/change-o-db-defined_first_clones-IGE.txt "-" 2>&1
|
|
645
|
|
646 cd $outdir/new_IMGT_IGE_changeo
|
|
647 tar -cJf ../new_IMGT_IGE_first_seq_of_clone.txz *
|
|
648
|
|
649 rm -rf $outdir/new_IMGT_IGE_changeo
|
|
650
|
|
651 cd $outdir/change_o
|
6
|
652 else
|
|
653 echo "No IGE sequences" > "$outdir/change_o/change-o-db-defined_clones-IGE.txt"
|
|
654 echo "No IGE sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGE.txt"
|
|
655 fi
|
|
656
|
55
|
657 cd "$tmp"
|
|
658
|
|
659 rm -rf $outdir/new_IMGT
|
|
660 rm -rf $outdir/new_IMGT_IGA/
|
|
661 rm -rf $outdir/new_IMGT_IGA1/
|
|
662 rm -rf $outdir/new_IMGT_IGA2/
|
|
663 rm -rf $outdir/new_IMGT_IGG/
|
|
664 rm -rf $outdir/new_IMGT_IGG1/
|
|
665 rm -rf $outdir/new_IMGT_IGG2/
|
|
666 rm -rf $outdir/new_IMGT_IGG3/
|
|
667 rm -rf $outdir/new_IMGT_IGG4/
|
|
668 rm -rf $outdir/new_IMGT_IGM/
|
|
669 rm -rf $outdir/new_IMGT_IGE/
|
0
|
670
|
39
|
671 echo "<div class='tabbertab' title='Clonal Relation' style='width: 7000px;'>" >> $output #clonality tab
|
0
|
672
|
16
|
673 function clonality_table {
|
|
674 local infile=$1
|
|
675 local outfile=$2
|
|
676
|
|
677 echo "<table class='pure-table pure-table-striped'>" >> $outfile
|
|
678 echo "<thead><tr><th>Clone size</th><th>Nr of clones</th><th>Nr of sequences</th></tr></thead>" >> $outfile
|
|
679
|
|
680 first='true'
|
|
681
|
|
682 while read size clones seqs
|
|
683 do
|
|
684 if [[ "$first" == "true" ]]; then
|
|
685 first="false"
|
|
686 continue
|
|
687 fi
|
|
688 echo "<tr><td>$size</td><td>$clones</td><td>$seqs</td></tr>" >> $outfile
|
|
689 done < $infile
|
|
690
|
|
691 echo "</table>" >> $outfile
|
|
692 }
|
|
693 echo "<div class='tabber'>" >> $output
|
0
|
694
|
16
|
695 echo "<div class='tabbertab' title='All'>" >> $output
|
|
696 clonality_table $outdir/change_o/change-o-defined_clones-summary.txt $output
|
|
697 echo "</div>" >> $output
|
0
|
698
|
16
|
699 echo "<div class='tabbertab' title='IGA'>" >> $output
|
|
700 clonality_table $outdir/change_o/change-o-defined_clones-summary-IGA.txt $output
|
|
701 echo "</div>" >> $output
|
0
|
702
|
16
|
703 echo "<div class='tabbertab' title='IGG'>" >> $output
|
|
704 clonality_table $outdir/change_o/change-o-defined_clones-summary-IGG.txt $output
|
|
705 echo "</div>" >> $output
|
0
|
706
|
16
|
707 echo "<div class='tabbertab' title='IGM'>" >> $output
|
|
708 clonality_table $outdir/change_o/change-o-defined_clones-summary-IGM.txt $output
|
|
709 echo "</div>" >> $output
|
6
|
710
|
16
|
711 echo "<div class='tabbertab' title='IGE'>" >> $output
|
|
712 clonality_table $outdir/change_o/change-o-defined_clones-summary-IGM.txt $output
|
|
713 echo "</div>" >> $output
|
0
|
714
|
39
|
715 echo "<div class='tabbertab' title='Overlap' style='width: 7000px;'>" >> $output
|
|
716 cat "$outdir/sequence_overview/index.html" | sed -e 's:</td>:</td>\n:g' | sed "s:href='\(.*\).html:href='sequence_overview/\1.html:g" >> $output # rewrite href to 'sequence_overview/..."
|
16
|
717 echo "</div>" >> $output
|
39
|
718
|
16
|
719 echo "</div>" >> $output #clonality tabber end
|
39
|
720
|
|
721 echo "<br />" >> $output
|
|
722 cat $dir/shm_clonality.htm >> $output
|
|
723
|
16
|
724 echo "</div>" >> $output #clonality tab end
|
0
|
725
|
5
|
726 fi
|
|
727
|
0
|
728 echo "<div class='tabbertab' title='Downloads'>" >> $output
|
|
729
|
|
730 echo "<table class='pure-table pure-table-striped'>" >> $output
|
|
731 echo "<thead><tr><th>info</th><th>link</th></tr></thead>" >> $output
|
|
732 echo "<tr><td>The complete dataset</td><td><a href='merged.txt' download='merged.txt' >Download</a></td></tr>" >> $output
|
|
733 echo "<tr><td>The filtered dataset</td><td><a href='filtered.txt' download='filtered.txt' >Download</a></td></tr>" >> $output
|
|
734 echo "<tr><td>The alignment info on the unmatched sequences</td><td><a href='unmatched.txt' download='unmatched.txt' >Download</a></td></tr>" >> $output
|
|
735
|
2
|
736 echo "<tr><td colspan='2' style='background-color:#E0E0E0;'>SHM Overview</td></tr>" >> $output
|
23
|
737 echo "<tr><td>The SHM Overview table as a dataset</td><td><a href='shm_overview.txt' download='shm_overview.txt' >Download</a></td></tr>" >> $output
|
2
|
738 echo "<tr><td>Motif data per sequence ID</td><td><a href='motif_per_seq.txt' download='motif_per_seq.txt' >Download</a></td></tr>" >> $output
|
|
739 echo "<tr><td>Mutation data per sequence ID</td><td><a href='mutation_by_id.txt' download='mutation_by_id.txt' >Download</a></td></tr>" >> $output
|
|
740 echo "<tr><td>Base count for every sequence</td><td><a href='base_overview.html'>View</a></td></tr>" >> $output
|
39
|
741 echo "<tr><td>The data used to generate the percentage of mutations in AID and pol eta motives plot</td><td><a href='aid_motives.txt' download='aid_motives.txt' >Download</a></td></tr>" >> $output
|
|
742 echo "<tr><td>The data used to generate the relative mutation patterns plot</td><td><a href='relative_mutations.txt' download='relative_mutations.txt' >Download</a></td></tr>" >> $output
|
43
|
743 echo "<tr><td>The data used to generate the absolute mutation patterns plot</td><td><a href='absolute_mutations.txt' download='absolute_mutations.txt' >Download</a></td></tr>" >> $output
|
47
|
744 echo "<tr><td>Data about tandem mutations by ID</td><td><a href='tandems_by_id.txt' download='tandems_by_id.txt' >Download</a></td></tr>" >> $output
|
2
|
745
|
|
746 echo "<tr><td colspan='2' style='background-color:#E0E0E0;'>SHM Frequency</td></tr>" >> $output
|
0
|
747 echo "<tr><td>The data generate the frequency scatter plot</td><td><a href='scatter.txt' download='scatter.txt' >Download</a></td></tr>" >> $output
|
|
748 echo "<tr><td>The data used to generate the frequency by class plot</td><td><a href='frequency_ranges_classes.txt' download='frequency_ranges_classes.txt' >Download</a></td></tr>" >> $output
|
|
749 echo "<tr><td>The data for frequency by subclass</td><td><a href='frequency_ranges_subclasses.txt' download='frequency_ranges_subclasses.txt' >Download</a></td></tr>" >> $output
|
|
750
|
2
|
751 echo "<tr><td colspan='2' style='background-color:#E0E0E0;'>Transition Tables</td></tr>" >> $output
|
23
|
752 echo "<tr><td>The data for the 'all' transition plot</td><td><a href='transitions_all_sum.txt' download='transitions_all_sum.txt' >Download</a></td></tr>" >> $output
|
45
|
753 echo "<tr><td>The data for the 'IGA' transition plot</td><td><a href='transitions_IGA_sum.txt' download='transitions_IGA_sum.txt' >Download</a></td></tr>" >> $output
|
23
|
754 echo "<tr><td>The data for the 'IGA1' transition plot</td><td><a href='transitions_IGA1_sum.txt' download='transitions_IGA1_sum.txt' >Download</a></td></tr>" >> $output
|
30
|
755 echo "<tr><td>The data for the 'IGA2' transition plot</td><td><a href='transitions_IGA2_sum.txt' download='transitions_IGA2_sum.txt' >Download</a></td></tr>" >> $output
|
23
|
756 echo "<tr><td>The data for the 'IGG' transition plot</td><td><a href='transitions_IGG_sum.txt' download='transitions_IGG_sum.txt' >Download</a></td></tr>" >> $output
|
|
757 echo "<tr><td>The data for the 'IGG1' transition plot</td><td><a href='transitions_IGG1_sum.txt' download='transitions_IGG1_sum.txt' >Download</a></td></tr>" >> $output
|
|
758 echo "<tr><td>The data for the 'IGG2' transition plot</td><td><a href='transitions_IGG2_sum.txt' download='transitions_IGG2_sum.txt' >Download</a></td></tr>" >> $output
|
|
759 echo "<tr><td>The data for the 'IGG3' transition plot</td><td><a href='transitions_IGG3_sum.txt' download='transitions_IGG3_sum.txt' >Download</a></td></tr>" >> $output
|
|
760 echo "<tr><td>The data for the 'IGG4' transition plot</td><td><a href='transitions_IGG4_sum.txt' download='transitions_IGG4_sum.txt' >Download</a></td></tr>" >> $output
|
|
761 echo "<tr><td>The data for the 'IGM' transition plot</td><td><a href='transitions_IGM_sum.txt' download='transitions_IGM_sum.txt' >Download</a></td></tr>" >> $output
|
|
762 echo "<tr><td>The data for the 'IGE' transition plot</td><td><a href='transitions_IGE_sum.txt' download='transitions_IGE_sum.txt' >Download</a></td></tr>" >> $output
|
0
|
763
|
2
|
764 echo "<tr><td colspan='2' style='background-color:#E0E0E0;'>Antigen Selection</td></tr>" >> $output
|
0
|
765 echo "<tr><td>AA mutation data per sequence ID</td><td><a href='aa_id_mutations.txt' download='aa_id_mutations.txt' >Download</a></td></tr>" >> $output
|
39
|
766 echo "<tr><td>Presence of AA per sequence ID</td><td><a href='absent_aa_id.txt' download='absent_aa_id.txt' >Download</a></td></tr>" >> $output
|
0
|
767
|
29
|
768 echo "<tr><td>The data used to generate the aa mutation frequency plot</td><td><a href='aa_histogram_sum.txt' download='aa_histogram_sum.txt' >Download</a></td></tr>" >> $output
|
|
769 echo "<tr><td>The data used to generate the aa mutation frequency plot for IGA</td><td><a href='aa_histogram_sum_IGA.txt' download='aa_histogram_sum_IGA.txt' >Download</a></td></tr>" >> $output
|
|
770 echo "<tr><td>The data used to generate the aa mutation frequency plot for IGG</td><td><a href='aa_histogram_sum_IGG.txt' download='aa_histogram_sum_IGG.txt' >Download</a></td></tr>" >> $output
|
|
771 echo "<tr><td>The data used to generate the aa mutation frequency plot for IGM</td><td><a href='aa_histogram_sum_IGM.txt' download='aa_histogram_sum_IGM.txt' >Download</a></td></tr>" >> $output
|
|
772 echo "<tr><td>The data used to generate the aa mutation frequency plot for IGE</td><td><a href='aa_histogram_sum_IGE.txt' download='aa_histogram_sum_IGE.txt' >Download</a></td></tr>" >> $output
|
|
773
|
0
|
774 echo "<tr><td>Baseline PDF (<a href='http://selection.med.yale.edu/baseline/'>http://selection.med.yale.edu/baseline/</a>)</td><td><a href='baseline.pdf' download='baseline.pdf' >Download</a></td></tr>" >> $output
|
|
775 echo "<tr><td>Baseline data</td><td><a href='baseline.txt' download='baseline.txt' >Download</a></td></tr>" >> $output
|
|
776 echo "<tr><td>Baseline IGA PDF</td><td><a href='baseline_IGA.pdf' download='baseline_IGA.pdf' >Download</a></td></tr>" >> $output
|
|
777 echo "<tr><td>Baseline IGA data</td><td><a href='baseline_IGA.txt' download='baseline_IGA.txt' >Download</a></td></tr>" >> $output
|
|
778 echo "<tr><td>Baseline IGG PDF</td><td><a href='baseline_IGG.pdf' download='baseline_IGG.pdf' >Download</a></td></tr>" >> $output
|
|
779 echo "<tr><td>Baseline IGG data</td><td><a href='baseline_IGG.txt' download='baseline_IGG.txt' >Download</a></td></tr>" >> $output
|
|
780 echo "<tr><td>Baseline IGM PDF</td><td><a href='baseline_IGM.pdf' download='baseline_IGM.pdf' >Download</a></td></tr>" >> $output
|
|
781 echo "<tr><td>Baseline IGM data</td><td><a href='baseline_IGM.txt' download='baseline_IGM.txt' >Download</a></td></tr>" >> $output
|
31
|
782 echo "<tr><td>Baseline IGE PDF</td><td><a href='baseline_IGE.pdf' download='baseline_IGE.pdf' >Download</a></td></tr>" >> $output
|
6
|
783 echo "<tr><td>Baseline IGE data</td><td><a href='baseline_IGE.txt' download='baseline_IGE.txt' >Download</a></td></tr>" >> $output
|
0
|
784
|
2
|
785 echo "<tr><td colspan='2' style='background-color:#E0E0E0;'>CSR</td></tr>" >> $output
|
39
|
786 echo "<tr><td>The data for the IGA subclass distribution plot</td><td><a href='IGA_pie.txt' download='IGA_pie.txt' >Download</a></td></tr>" >> $output
|
|
787 echo "<tr><td>The data for the IGG subclass distribution plot</td><td><a href='IGG_pie.txt' download='IGG_pie.txt' >Download</a></td></tr>" >> $output
|
2
|
788
|
55
|
789
|
39
|
790 echo "<tr><td colspan='2' style='background-color:#E0E0E0;'>Clonal Relation</td></tr>" >> $output
|
2
|
791 echo "<tr><td>Sequence overlap between subclasses</td><td><a href='sequence_overview/index.html'>View</a></td></tr>" >> $output
|
|
792 echo "<tr><td>The Change-O DB file with defined clones and subclass annotation</td><td><a href='change_o/change-o-db-defined_clones.txt' download='change_o/change-o-db-defined_clones.txt' >Download</a></td></tr>" >> $output
|
|
793 echo "<tr><td>The Change-O DB defined clones summary file</td><td><a href='change_o/change-o-defined_clones-summary.txt' download='change_o/change-o-defined_clones-summary.txt' >Download</a></td></tr>" >> $output
|
55
|
794 echo "<tr><td>An IMGT archive with just just the first sequence of a clone</td><td><a href='new_IMGT_first_seq_of_clone.txz' download='new_IMGT_first_seq_of_clone.txz' >Download</a></td></tr>" >> $output
|
|
795
|
2
|
796 echo "<tr><td>The Change-O DB file with defined clones of IGA</td><td><a href='change_o/change-o-db-defined_clones-IGA.txt' download='change_o/change-o-db-defined_clones-IGA.txt' >Download</a></td></tr>" >> $output
|
|
797 echo "<tr><td>The Change-O DB defined clones summary file of IGA</td><td><a href='change_o/change-o-defined_clones-summary-IGA.txt' download='change_o/change-o-defined_clones-summary-IGA.txt' >Download</a></td></tr>" >> $output
|
55
|
798 echo "<tr><td>An IMGT archive with just just the first sequence of a clone (IGA)</td><td><a href='new_IMGT_IGA_first_seq_of_clone.txz' download='new_IMGT_IGA_first_seq_of_clone.txz' >Download</a></td></tr>" >> $output
|
|
799
|
2
|
800 echo "<tr><td>The Change-O DB file with defined clones of IGG</td><td><a href='change_o/change-o-db-defined_clones-IGG.txt' download='change_o/change-o-db-defined_clones-IGG.txt' >Download</a></td></tr>" >> $output
|
|
801 echo "<tr><td>The Change-O DB defined clones summary file of IGG</td><td><a href='change_o/change-o-defined_clones-summary-IGG.txt' download='change_o/change-o-defined_clones-summary-IGG.txt' >Download</a></td></tr>" >> $output
|
55
|
802 echo "<tr><td>An IMGT archive with just just the first sequence of a clone (IGG)</td><td><a href='new_IMGT_IGG_first_seq_of_clone.txz' download='new_IMGT_IGG_first_seq_of_clone.txz' >Download</a></td></tr>" >> $output
|
|
803
|
2
|
804 echo "<tr><td>The Change-O DB file with defined clones of IGM</td><td><a href='change_o/change-o-db-defined_clones-IGM.txt' download='change_o/change-o-db-defined_clones-IGM.txt' >Download</a></td></tr>" >> $output
|
|
805 echo "<tr><td>The Change-O DB defined clones summary file of IGM</td><td><a href='change_o/change-o-defined_clones-summary-IGM.txt' download='change_o/change-o-defined_clones-summary-IGM.txt' >Download</a></td></tr>" >> $output
|
55
|
806 echo "<tr><td>An IMGT archive with just just the first sequence of a clone (IGM)</td><td><a href='new_IMGT_IGM_first_seq_of_clone.txz' download='new_IMGT_IGM_first_seq_of_clone.txz' >Download</a></td></tr>" >> $output
|
|
807
|
6
|
808 echo "<tr><td>The Change-O DB file with defined clones of IGE</td><td><a href='change_o/change-o-db-defined_clones-IGE.txt' download='change_o/change-o-db-defined_clones-IGE.txt' >Download</a></td></tr>" >> $output
|
|
809 echo "<tr><td>The Change-O DB defined clones summary file of IGE</td><td><a href='change_o/change-o-defined_clones-summary-IGE.txt' download='change_o/change-o-defined_clones-summary-IGE.txt' >Download</a></td></tr>" >> $output
|
55
|
810 echo "<tr><td>An IMGT archive with just just the first sequence of a clone (IGE)</td><td><a href='new_IMGT_IGE_first_seq_of_clone.txz' download='new_IMGT_IGE_first_seq_of_clone.txz' >Download</a></td></tr>" >> $output
|
2
|
811
|
|
812 echo "<tr><td colspan='2' style='background-color:#E0E0E0;'>Filtered IMGT output files</td></tr>" >> $output
|
0
|
813 echo "<tr><td>An IMGT archive with just the matched and filtered sequences</td><td><a href='new_IMGT.txz' download='new_IMGT.txz' >Download</a></td></tr>" >> $output
|
|
814 echo "<tr><td>An IMGT archive with just the matched and filtered IGA sequences</td><td><a href='new_IMGT_IGA.txz' download='new_IMGT_IGA.txz' >Download</a></td></tr>" >> $output
|
|
815 echo "<tr><td>An IMGT archive with just the matched and filtered IGA1 sequences</td><td><a href='new_IMGT_IGA1.txz' download='new_IMGT_IGA1.txz' >Download</a></td></tr>" >> $output
|
|
816 echo "<tr><td>An IMGT archive with just the matched and filtered IGA2 sequences</td><td><a href='new_IMGT_IGA2.txz' download='new_IMGT_IGA2.txz' >Download</a></td></tr>" >> $output
|
|
817 echo "<tr><td>An IMGT archive with just the matched and filtered IGG sequences</td><td><a href='new_IMGT_IGG.txz' download='new_IMGT_IGG.txz' >Download</a></td></tr>" >> $output
|
|
818 echo "<tr><td>An IMGT archive with just the matched and filtered IGG1 sequences</td><td><a href='new_IMGT_IGG1.txz' download='new_IMGT_IGG1.txz' >Download</a></td></tr>" >> $output
|
|
819 echo "<tr><td>An IMGT archive with just the matched and filtered IGG2 sequences</td><td><a href='new_IMGT_IGG2.txz' download='new_IMGT_IGG2.txz' >Download</a></td></tr>" >> $output
|
|
820 echo "<tr><td>An IMGT archive with just the matched and filtered IGG3 sequences</td><td><a href='new_IMGT_IGG3.txz' download='new_IMGT_IGG3.txz' >Download</a></td></tr>" >> $output
|
|
821 echo "<tr><td>An IMGT archive with just the matched and filtered IGG4 sequences</td><td><a href='new_IMGT_IGG4.txz' download='new_IMGT_IGG4.txz' >Download</a></td></tr>" >> $output
|
|
822 echo "<tr><td>An IMGT archive with just the matched and filtered IGM sequences</td><td><a href='new_IMGT_IGM.txz' download='new_IMGT_IGM.txz' >Download</a></td></tr>" >> $output
|
31
|
823 echo "<tr><td>An IMGT archive with just the matched and filtered IGE sequences</td><td><a href='new_IMGT_IGE.txz' download='new_IMGT_IGE.txz' >Download</a></td></tr>" >> $output
|
0
|
824
|
|
825 echo "</table>" >> $output
|
|
826
|
39
|
827 echo "<br />" >> $output
|
|
828 cat $dir/shm_downloads.htm >> $output
|
|
829
|
0
|
830 echo "</div>" >> $output #downloads tab end
|
|
831
|
|
832 echo "</div>" >> $output #tabs end
|
|
833
|
|
834 echo "</html>" >> $output
|
|
835
|
5
|
836
|
0
|
837 echo "---------------- naive_output.r ----------------"
|
|
838 echo "---------------- naive_output.r ----------------<br />" >> $log
|
|
839
|
5
|
840 if [[ "$naive_output" == "yes" ]]
|
0
|
841 then
|
28
|
842 echo "output naive output"
|
18
|
843 if [[ "${class_filter}" == "101_101" ]]
|
|
844 then
|
28
|
845 echo "copy new_IMGT.txz to ${naive_output_all}"
|
21
|
846 cp $outdir/new_IMGT.txz ${naive_output_all}
|
18
|
847 else
|
28
|
848 echo "copy for classes"
|
18
|
849 cp $outdir/new_IMGT_IGA.txz ${naive_output_ca}
|
|
850 cp $outdir/new_IMGT_IGG.txz ${naive_output_cg}
|
|
851 cp $outdir/new_IMGT_IGM.txz ${naive_output_cm}
|
|
852 cp $outdir/new_IMGT_IGE.txz ${naive_output_ce}
|
|
853 fi
|
0
|
854 fi
|
|
855
|
|
856 echo "</table>" >> $outdir/base_overview.html
|
|
857
|
|
858 mv $log $outdir/log.html
|
|
859
|
|
860 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 />" > $log
|
|
861 echo "<table border = 1>" >> $log
|
|
862 echo "<thead><tr><th>Info</th><th>Sequences</th><th>Percentage</th></tr></thead>" >> $log
|
|
863 tIFS="$TMP"
|
|
864 IFS=$'\t'
|
|
865 while read step seq perc
|
|
866 do
|
|
867 echo "<tr>" >> $log
|
|
868 echo "<td>$step</td>" >> $log
|
|
869 echo "<td>$seq</td>" >> $log
|
|
870 echo "<td>${perc}%</td>" >> $log
|
|
871 echo "</tr>" >> $log
|
|
872 done < $outdir/filtering_steps.txt
|
39
|
873 echo "</table>" >> $log
|
|
874 echo "<br />" >> $log
|
|
875 cat $dir/shm_first.htm >> $log
|
|
876 echo "</center></html>" >> $log
|
0
|
877
|
|
878 IFS="$tIFS"
|
|
879
|
|
880
|
|
881 echo "---------------- Done! ----------------"
|
|
882 echo "---------------- Done! ----------------<br />" >> $outdir/log.html
|
|
883
|
|
884
|
|
885
|
|
886
|
|
887
|
|
888
|
|
889
|
|
890
|
|
891
|
|
892
|
|
893
|
|
894
|
|
895
|
|
896
|
|
897
|
|
898
|
|
899
|
|
900
|
|
901
|
|
902
|
|
903
|