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 echo "testtestsetset" > $outputFile
|
|
13
|
|
14 Rscript --verbose $dir/RScript.r $inputFile $outputDir $outputFile $min_freq $min_cells 2>&1
|
0
|
15 cp $dir/jquery-1.11.0.min.js $outputDir
|
|
16 cp $dir/script.js $outputDir
|
|
17 cp $dir/style.css $outputDir
|
|
18 cp $dir/tabber.js $outputDir
|
|
19
|
|
20 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
|
|
21
|
|
22 cd $outputDir
|
|
23
|
4
|
24 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>"
|
|
25 singles=()
|
|
26 pairs_BM_PB=()
|
|
27 pairs_Left_Right=()
|
|
28 pairs_R_Dx=()
|
|
29 while read patient sample1 sample2 type
|
0
|
30 do
|
|
31 echo "$patient"
|
4
|
32 html="${patient}.html"
|
|
33 echo "$header" > $html
|
|
34 if [[ "$type" == *pair* ]] ; then
|
|
35 if [[ "$sample1" == *_BM* ]] || [[ "$sample1" == *_PB* ]] ; then
|
|
36 pairs_BM_PB+=( "$patient" )
|
|
37 elif [[ "$sample1" == *_Left* ]] || [[ "$sample1" == *_Right* ]] ; then
|
|
38 pairs_Left_Right+=( "$patient" )
|
|
39 else
|
|
40 pairs_R_Dx+=( "$patient" )
|
|
41 fi
|
|
42 else
|
|
43 singles+=( "$patient" )
|
|
44 fi
|
0
|
45 oldLocus=""
|
|
46 sample1="$(echo ${sample1} | tr -d '\r' | tr -d '\n')"
|
|
47 sample2="$(echo ${sample2} | tr -d '\r' | tr -d '\n')"
|
|
48 tail -n+2 ${patient}_freq.txt | sed "s/>//" > tmp.txt
|
|
49 echo "<div class='tabber'>" >> $html
|
|
50 echo "<div class='tabbertab' title='Data frequency'>" >> $html
|
|
51 echo "<table><tr><td style='vertical-align:top;'>" >> $html
|
|
52 echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_freq'>" >> $html
|
4
|
53 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
|
54 echo "<tbody>" >> $html
|
2
|
55 while read locus j_segment v_segment cut_off_value both one read_count1 two read_count2 sum percent locusreadsum1 locusreadsum2
|
0
|
56 do
|
|
57 if [ "$locus" != "$oldLocus" ] ; then
|
|
58 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
|
|
59 echo "<tr><td><b>$locus</b></td>" >> $html
|
|
60 else
|
|
61 echo "<td></td>" >> $html
|
|
62 fi
|
|
63 echo "<td>$v_segment</td>" >> $html
|
|
64 echo "<td>$j_segment</td>" >> $html
|
|
65 echo "<td>>$cut_off_value</td>" >> $html
|
|
66 if [ "$both" != "0" ] ; then
|
|
67 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$both</td>" >> $html
|
|
68 else
|
|
69 echo "<td>$both</td>" >> $html
|
|
70 fi
|
|
71 if [ "$one" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
72 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$one</td>" >> $html
|
|
73 else
|
|
74 echo "<td>$one</td>" >> $html
|
|
75 fi
|
|
76 echo "<td>$read_count1</td>" >> $html
|
|
77 if [ "$two" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
78 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$two</td>" >> $html
|
|
79 else
|
|
80 echo "<td>$two</td>" >> $html
|
|
81 fi
|
|
82 echo "<td>$read_count2</td>" >> $html
|
|
83 echo "<td>$sum</td>" >> $html
|
|
84 echo "<td>${percent}%</td>" >> $html
|
|
85 echo "</tr>" >> $html
|
2
|
86 oldLocus="$locus"
|
0
|
87 done < tmp.txt
|
|
88 echo "</tbody></table>" >> $html
|
2
|
89 echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_freq'></div></td></tr></table>" >> $html
|
4
|
90 echo "</div>" >> $html
|
0
|
91 echo "<div class='tabbertab' title='Graphs frequency'>" >> $html
|
|
92 echo "<a href='${patient}_freq.png'><img src='${patient}_freq.png' width='1280' height='720' /></a><br />" >> $html
|
|
93 echo "<a href='${patient}_freq_both.png'><img src='${patient}_freq_both.png' width='1280' height='720' /></a><br />" >> $html
|
|
94 echo "<a href='${patient}_percent_freq.png'><img src='${patient}_percent_freq.png' width='1280' height='720' /></a></div>" >> $html
|
|
95
|
|
96 tail -n+2 ${patient}_reads.txt | sed "s/>//" > tmp.txt
|
|
97 echo "<div class='tabbertab' title='Data reads'>" >> $html
|
|
98 echo "<table><tr><td style='vertical-align:top;'>" >> $html
|
|
99 echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_reads'>" >> $html
|
|
100 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
|
|
101 echo "<tbody>" >> $html
|
2
|
102 while read locus j_segment v_segment cut_off_value both one read_count1 two read_count2 sum percent locusreadsum1 locusreadsum2
|
0
|
103 do
|
|
104 if [ "$locus" != "$oldLocus" ] ; then
|
|
105 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
|
|
106 echo "<tr><td><b>$locus</b></td>" >> $html
|
|
107 else
|
|
108 echo "<td></td>" >> $html
|
|
109 fi
|
|
110 echo "<td>$v_segment</td>" >> $html
|
|
111 echo "<td>$j_segment</td>" >> $html
|
|
112 echo "<td>>$cut_off_value</td>" >> $html
|
|
113 if [ "$both" != "0" ] ; then
|
1
|
114 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$both</td>" >> $html
|
0
|
115 else
|
|
116 echo "<td>$both</td>" >> $html
|
|
117 fi
|
|
118 if [ "$one" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
119 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$one</td>" >> $html
|
|
120 else
|
|
121 echo "<td>$one</td>" >> $html
|
|
122 fi
|
|
123 echo "<td>$read_count1</td>" >> $html
|
|
124 if [ "$two" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
125 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$two</td>" >> $html
|
|
126 else
|
|
127 echo "<td>$two</td>" >> $html
|
|
128 fi
|
|
129 echo "<td>$read_count2</td>" >> $html
|
|
130 echo "<td>$sum</td>" >> $html
|
|
131 echo "<td>${percent}%</td>" >> $html
|
|
132 echo "</tr>" >> $html
|
|
133 oldLocus="$locus"
|
|
134 done < tmp.txt
|
|
135 echo "</tbody></table>" >> $html
|
2
|
136 echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_reads'></div></td></tr></table>" >> $html
|
4
|
137 echo "</div>" >> $html
|
0
|
138 echo "<div class='tabbertab' title='Graphs reads'>" >> $html
|
|
139 echo "<a href='${patient}_reads.png'><img src='${patient}_reads.png' width='1280' height='720' /></a><br />" >> $html
|
|
140 echo "<a href='${patient}_reads_both.png'><img src='${patient}_reads_both.png' width='1280' height='720' /></a><br />" >> $html
|
|
141 echo "<a href='${patient}_percent_reads.png'><img src='${patient}_percent_reads.png' width='1280' height='720' /></a></div>" >> $html
|
2
|
142 echo "</div>" >> $html
|
0
|
143 echo "</div>" >> $html
|
4
|
144 echo "</html>" >> $html
|
0
|
145 done < patients.txt
|
|
146 rm tmp.txt
|
4
|
147
|
|
148 html="index.html"
|
|
149 echo "<html>" > $html
|
|
150 echo "<table>" >> $html
|
|
151 echo "<tr><td><b>Singles:</b></td></tr>" >> $html
|
|
152 for patient in "${singles[@]}"
|
|
153 do
|
|
154 echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> $html
|
|
155 done
|
|
156 echo "<tr><td><b>Pairs (Left & Right):</b></td></tr>" >> $html
|
|
157 for patient in "${pairs_Left_Right[@]}"
|
|
158 do
|
|
159 echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> $html
|
|
160 done
|
|
161 echo "<tr><td><b>Pairs (BM & PB):</b></td></tr>" >> $html
|
|
162 for patient in "${pairs_BM_PB[@]}"
|
|
163 do
|
|
164 echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> $html
|
|
165 done
|
|
166 echo "<tr><td><b>Pairs (Dx & R):</b></td></tr>" >> $html
|
|
167 for patient in "${pairs_R_Dx[@]}"
|
|
168 do
|
|
169 echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> $html
|
|
170 done
|
|
171 echo "<tr><td><b>Triplets:</b></td></tr>" >> $html
|
|
172
|
|
173 echo "</table>" >> $html
|
|
174 echo "</html>" >> $html
|
|
175
|