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