0
|
1 #!/bin/bash
|
|
2
|
|
3 inputFile=$1
|
|
4 outputFile=$2
|
|
5 outputDir=$3
|
3
|
6 min_freq=$4
|
|
7 min_cells=$5
|
0
|
8
|
|
9 dir="$(cd "$(dirname "$0")" && pwd)"
|
|
10 mkdir $outputDir
|
|
11
|
3
|
12
|
|
13 Rscript --verbose $dir/RScript.r $inputFile $outputDir $outputFile $min_freq $min_cells 2>&1
|
0
|
14 cp $dir/jquery-1.11.0.min.js $outputDir
|
|
15 cp $dir/script.js $outputDir
|
|
16 cp $dir/style.css $outputDir
|
|
17 cp $dir/tabber.js $outputDir
|
|
18
|
|
19 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)</center></html>" > $outputFile
|
|
20
|
|
21 cd $outputDir
|
|
22
|
4
|
23 header="<html><head><script type='text/javascript' src='jquery-1.11.0.min.js'></script><script type='text/javascript' src='tabber.js'></script><script type='text/javascript' src='script.js'></script><link rel='stylesheet' type='text/css' href='style.css'></head><div id='hidden_div' style='display: none;'></div>"
|
|
24 singles=()
|
|
25 pairs_BM_PB=()
|
|
26 pairs_Left_Right=()
|
|
27 pairs_R_Dx=()
|
|
28 while read patient sample1 sample2 type
|
0
|
29 do
|
|
30 echo "$patient"
|
4
|
31 html="${patient}.html"
|
|
32 echo "$header" > $html
|
|
33 if [[ "$type" == *pair* ]] ; then
|
|
34 if [[ "$sample1" == *_BM* ]] || [[ "$sample1" == *_PB* ]] ; then
|
|
35 pairs_BM_PB+=( "$patient" )
|
|
36 elif [[ "$sample1" == *_Left* ]] || [[ "$sample1" == *_Right* ]] ; then
|
|
37 pairs_Left_Right+=( "$patient" )
|
|
38 else
|
|
39 pairs_R_Dx+=( "$patient" )
|
|
40 fi
|
|
41 else
|
|
42 singles+=( "$patient" )
|
|
43 fi
|
0
|
44 oldLocus=""
|
|
45 sample1="$(echo ${sample1} | tr -d '\r' | tr -d '\n')"
|
|
46 sample2="$(echo ${sample2} | tr -d '\r' | tr -d '\n')"
|
|
47 tail -n+2 ${patient}_freq.txt | sed "s/>//" > tmp.txt
|
|
48 echo "<div class='tabber'>" >> $html
|
|
49 echo "<div class='tabbertab' title='Data frequency'>" >> $html
|
|
50 echo "<table><tr><td style='vertical-align:top;'>" >> $html
|
|
51 echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_freq'>" >> $html
|
4
|
52 echo "<thead><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Cut off value</th><th>Number of sequences ${patient}_Both</th><th>Number of sequences_$sample1</th><th>Read Count $sample1</th><th>Number of sequences_$sample2</th><th>Read Count $sample2</th><th>Sum number of sequences $patient</th><th>Percentage of sequences ${patient}_both</th></thead>" >> $html
|
0
|
53 echo "<tbody>" >> $html
|
2
|
54 while read locus j_segment v_segment cut_off_value both one read_count1 two read_count2 sum percent locusreadsum1 locusreadsum2
|
0
|
55 do
|
|
56 if [ "$locus" != "$oldLocus" ] ; then
|
|
57 echo "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr>" >> $html
|
|
58 echo "<tr><td><b>$locus</b></td>" >> $html
|
|
59 else
|
|
60 echo "<td></td>" >> $html
|
|
61 fi
|
|
62 echo "<td>$v_segment</td>" >> $html
|
|
63 echo "<td>$j_segment</td>" >> $html
|
|
64 echo "<td>>$cut_off_value</td>" >> $html
|
|
65 if [ "$both" != "0" ] ; then
|
|
66 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$both</td>" >> $html
|
|
67 else
|
|
68 echo "<td>$both</td>" >> $html
|
|
69 fi
|
|
70 if [ "$one" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
71 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$one</td>" >> $html
|
|
72 else
|
|
73 echo "<td>$one</td>" >> $html
|
|
74 fi
|
|
75 echo "<td>$read_count1</td>" >> $html
|
|
76 if [ "$two" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
77 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$two</td>" >> $html
|
|
78 else
|
|
79 echo "<td>$two</td>" >> $html
|
|
80 fi
|
|
81 echo "<td>$read_count2</td>" >> $html
|
|
82 echo "<td>$sum</td>" >> $html
|
|
83 echo "<td>${percent}%</td>" >> $html
|
|
84 echo "</tr>" >> $html
|
2
|
85 oldLocus="$locus"
|
0
|
86 done < tmp.txt
|
|
87 echo "</tbody></table>" >> $html
|
2
|
88 echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_freq'></div></td></tr></table>" >> $html
|
4
|
89 echo "</div>" >> $html
|
0
|
90 echo "<div class='tabbertab' title='Graphs frequency'>" >> $html
|
|
91 echo "<a href='${patient}_freq.png'><img src='${patient}_freq.png' width='1280' height='720' /></a><br />" >> $html
|
|
92 echo "<a href='${patient}_freq_both.png'><img src='${patient}_freq_both.png' width='1280' height='720' /></a><br />" >> $html
|
|
93 echo "<a href='${patient}_percent_freq.png'><img src='${patient}_percent_freq.png' width='1280' height='720' /></a></div>" >> $html
|
|
94
|
|
95 tail -n+2 ${patient}_reads.txt | sed "s/>//" > tmp.txt
|
|
96 echo "<div class='tabbertab' title='Data reads'>" >> $html
|
|
97 echo "<table><tr><td style='vertical-align:top;'>" >> $html
|
|
98 echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_reads'>" >> $html
|
|
99 echo "<thead><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Cut off value</th><th>Number of sequences ${patient}_Both</th><th>Number of sequences_$sample1</th><th>Read Count $sample1</th><th>Number of sequences_$sample2</th><th>Read Count $sample2</th><th>Sum number of sequences $patient</th><th>Percentage of sequences ${patient}_both</th></thead>" >> $html
|
|
100 echo "<tbody>" >> $html
|
2
|
101 while read locus j_segment v_segment cut_off_value both one read_count1 two read_count2 sum percent locusreadsum1 locusreadsum2
|
0
|
102 do
|
|
103 if [ "$locus" != "$oldLocus" ] ; then
|
|
104 echo "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr>" >> $html
|
|
105 echo "<tr><td><b>$locus</b></td>" >> $html
|
|
106 else
|
|
107 echo "<td></td>" >> $html
|
|
108 fi
|
|
109 echo "<td>$v_segment</td>" >> $html
|
|
110 echo "<td>$j_segment</td>" >> $html
|
|
111 echo "<td>>$cut_off_value</td>" >> $html
|
|
112 if [ "$both" != "0" ] ; then
|
1
|
113 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$both</td>" >> $html
|
0
|
114 else
|
|
115 echo "<td>$both</td>" >> $html
|
|
116 fi
|
|
117 if [ "$one" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
118 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$one</td>" >> $html
|
|
119 else
|
|
120 echo "<td>$one</td>" >> $html
|
|
121 fi
|
|
122 echo "<td>$read_count1</td>" >> $html
|
|
123 if [ "$two" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
124 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$two</td>" >> $html
|
|
125 else
|
|
126 echo "<td>$two</td>" >> $html
|
|
127 fi
|
|
128 echo "<td>$read_count2</td>" >> $html
|
|
129 echo "<td>$sum</td>" >> $html
|
|
130 echo "<td>${percent}%</td>" >> $html
|
|
131 echo "</tr>" >> $html
|
|
132 oldLocus="$locus"
|
|
133 done < tmp.txt
|
|
134 echo "</tbody></table>" >> $html
|
2
|
135 echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_reads'></div></td></tr></table>" >> $html
|
4
|
136 echo "</div>" >> $html
|
0
|
137 echo "<div class='tabbertab' title='Graphs reads'>" >> $html
|
|
138 echo "<a href='${patient}_reads.png'><img src='${patient}_reads.png' width='1280' height='720' /></a><br />" >> $html
|
|
139 echo "<a href='${patient}_reads_both.png'><img src='${patient}_reads_both.png' width='1280' height='720' /></a><br />" >> $html
|
|
140 echo "<a href='${patient}_percent_reads.png'><img src='${patient}_percent_reads.png' width='1280' height='720' /></a></div>" >> $html
|
2
|
141 echo "</div>" >> $html
|
0
|
142 echo "</div>" >> $html
|
4
|
143 echo "</html>" >> $html
|
0
|
144 done < patients.txt
|
4
|
145
|
|
146 html="index.html"
|
|
147 echo "<html>" > $html
|
|
148 echo "<table>" >> $html
|
|
149 echo "<tr><td><b>Singles:</b></td></tr>" >> $html
|
|
150 for patient in "${singles[@]}"
|
|
151 do
|
|
152 echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> $html
|
|
153 done
|
|
154 echo "<tr><td><b>Pairs (Left & Right):</b></td></tr>" >> $html
|
|
155 for patient in "${pairs_Left_Right[@]}"
|
|
156 do
|
|
157 echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> $html
|
|
158 done
|
|
159 echo "<tr><td><b>Pairs (BM & PB):</b></td></tr>" >> $html
|
|
160 for patient in "${pairs_BM_PB[@]}"
|
|
161 do
|
|
162 echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> $html
|
|
163 done
|
|
164 echo "<tr><td><b>Pairs (Dx & R):</b></td></tr>" >> $html
|
|
165 for patient in "${pairs_R_Dx[@]}"
|
|
166 do
|
|
167 echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> $html
|
|
168 done
|
|
169 echo "<tr><td><b>Triplets:</b></td></tr>" >> $html
|
|
170
|
7
|
171 while read sample1 sample2 sample3
|
|
172 do
|
|
173 sample1="$(echo ${sample1} | tr -d '\r' | tr -d '\n')"
|
|
174 sample2="$(echo ${sample2} | tr -d '\r' | tr -d '\n')"
|
|
175 sample3="$(echo ${sample3} | tr -d '\r' | tr -d '\n')"
|
|
176 patient="${sample1}_${sample2}_${sample3}"
|
|
177 echo "$patient"
|
|
178 html="${patient}.html"
|
|
179 echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> "index.html"
|
|
180 echo "$header" > $html
|
|
181 oldLocus=""
|
|
182 tail -n+2 ${patient}_freq.txt | sed "s/>//" > tmp.txt
|
|
183 echo "<div class='tabber'>" >> $html
|
|
184 echo "<div class='tabbertab' title='Data frequency'>" >> $html
|
|
185 echo "<table><tr><td style='vertical-align:top;'>" >> $html
|
|
186 echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_freq'>" >> $html
|
|
187 echo "<thead><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Cut off value</th><th>Number of sequences ${patient}_All</th><th>Number of sequences_$sample1</th><th>Read Count $sample1</th><th>Number of sequences_$sample2</th><th>Read Count $sample2</th><th>Number of sequences_$sample3</th><th>Read Count $sample3</th></thead>" >> $html
|
|
188 echo "<tbody>" >> $html
|
|
189 while read locus j_segment v_segment cut_off_value all one read_count1 two read_count2 three read_count3
|
|
190 do
|
|
191 if [ "$locus" != "$oldLocus" ] ; then
|
|
192 echo "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr>" >> $html
|
|
193 echo "<tr><td><b>$locus</b></td>" >> $html
|
|
194 else
|
|
195 echo "<td></td>" >> $html
|
|
196 fi
|
|
197 echo "<td>$v_segment</td>" >> $html
|
|
198 echo "<td>$j_segment</td>" >> $html
|
|
199 echo "<td>>$cut_off_value</td>" >> $html
|
|
200 if [ "$all" != "0" ] ; then
|
|
201 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${sample3}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$all</td>" >> $html
|
|
202 else
|
|
203 echo "<td>$all</td>" >> $html
|
|
204 fi
|
|
205 if [ "$one" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
206 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$one</td>" >> $html
|
|
207 else
|
|
208 echo "<td>$one</td>" >> $html
|
|
209 fi
|
|
210 echo "<td>$read_count1</td>" >> $html
|
|
211 if [ "$two" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
212 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$two</td>" >> $html
|
|
213 else
|
|
214 echo "<td>$two</td>" >> $html
|
|
215 fi
|
|
216 echo "<td>$read_count2</td>" >> $html
|
|
217 if [ "$three" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
218 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample3}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$three</td>" >> $html
|
|
219 else
|
|
220 echo "<td>$three</td>" >> $html
|
|
221 fi
|
|
222 echo "<td>$read_count3</td>" >> $html
|
|
223 echo "</tr>" >> $html
|
|
224 oldLocus="$locus"
|
|
225 done < tmp.txt
|
|
226 echo "</tbody></table>" >> $html
|
|
227 echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_freq'></div></td></tr></table>" >> $html
|
|
228 echo "</div>" >> $html
|
|
229 echo "<div class='tabbertab' title='Graphs frequency'>" >> $html
|
8
|
230 echo "<a href='${patient}_freq_total_all.png'><img src='${patient}_freq_total_all.png' width='1280' height='720' /></a><br />" >> $html
|
|
231 echo "<a href='${patient}_freq_indiv_all.png'><img src='${patient}_freq_indiv_all.png' width='1280' height='720' /></a><br /></div>" >> $html
|
7
|
232
|
|
233 tail -n+2 ${patient}_reads.txt | sed "s/>//" > tmp.txt
|
|
234 echo "<div class='tabbertab' title='Data reads'>" >> $html
|
|
235 echo "<table><tr><td style='vertical-align:top;'>" >> $html
|
|
236 echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_reads'>" >> $html
|
|
237 echo "<thead><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Cut off value</th><th>Number of sequences ${patient}_All</th><th>Number of sequences_$sample1</th><th>Read Count $sample1</th><th>Number of sequences_$sample2</th><th>Read Count $sample2</th><th>Number of sequences_$sample3</th><th>Read Count $sample3</th></thead>" >> $html
|
|
238 echo "<tbody>" >> $html
|
|
239 while read locus j_segment v_segment cut_off_value all one read_count1 two read_count2 three read_count3
|
|
240 do
|
|
241 if [ "$locus" != "$oldLocus" ] ; then
|
|
242 echo "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr>" >> $html
|
|
243 echo "<tr><td><b>$locus</b></td>" >> $html
|
|
244 else
|
|
245 echo "<td></td>" >> $html
|
|
246 fi
|
|
247 echo "<td>$v_segment</td>" >> $html
|
|
248 echo "<td>$j_segment</td>" >> $html
|
|
249 echo "<td>>$cut_off_value</td>" >> $html
|
|
250 if [ "$all" != "0" ] ; then
|
|
251 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${sample3}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$all</td>" >> $html
|
|
252 else
|
|
253 echo "<td>$all</td>" >> $html
|
|
254 fi
|
|
255 if [ "$one" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
256 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$one</td>" >> $html
|
|
257 else
|
|
258 echo "<td>$one</td>" >> $html
|
|
259 fi
|
|
260 echo "<td>$read_count1</td>" >> $html
|
|
261 if [ "$two" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
262 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$two</td>" >> $html
|
|
263 else
|
|
264 echo "<td>$two</td>" >> $html
|
|
265 fi
|
|
266 echo "<td>$read_count2</td>" >> $html
|
|
267 if [ "$three" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
268 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample3}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$three</td>" >> $html
|
|
269 else
|
|
270 echo "<td>$three</td>" >> $html
|
|
271 fi
|
|
272 echo "<td>$read_count3</td>" >> $html
|
|
273 echo "</tr>" >> $html
|
|
274 oldLocus="$locus"
|
|
275 done < tmp.txt
|
|
276 echo "</tbody></table>" >> $html
|
|
277 echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_reads'></div></td></tr></table>" >> $html
|
|
278 echo "</div>" >> $html
|
|
279 echo "<div class='tabbertab' title='Graphs reads'>" >> $html
|
8
|
280 echo "<a href='${patient}_reads_total_all.png'><img src='${patient}_reads_total_all.png' width='1280' height='720' /></a><br />" >> $html
|
|
281 echo "<a href='${patient}_reads_indiv_all.png'><img src='${patient}_reads_indiv_all.png' width='1280' height='720' /></a><br /></div>" >> $html
|
7
|
282 echo "</div>" >> $html
|
|
283 echo "</div>" >> $html
|
|
284 echo "</html>" >> $html
|
|
285 done < triplets.txt
|
|
286 rm tmp.txt
|
|
287
|
|
288
|
|
289 html="index.html"
|
|
290
|
4
|
291 echo "</table>" >> $html
|
|
292 echo "</html>" >> $html
|
|
293
|