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
|
|
24 html="index.html"
|
|
25 echo "<html><head><title>Result</title>" > $html
|
|
26 echo "<script type='text/javascript' src='jquery-1.11.0.min.js'></script>" >> $html
|
|
27 echo "<script type='text/javascript' src='tabber.js'></script>" >> $html
|
|
28 echo "<script type='text/javascript' src='script.js'></script>" >> $html
|
|
29 echo "<script type='text/javascript' src='jquery.tablesorter.min.js'></script>" >> $html
|
|
30 echo "<link rel='stylesheet' type='text/css' href='style.css'></head>" >> $html
|
|
31 echo "<div id='hidden_div' style='display: none;'></div>" >> $html
|
|
32 echo "<div class='tabber'>" >> $html
|
|
33 while read patient sample1 sample2
|
|
34 do
|
|
35 echo "$patient"
|
|
36 oldLocus=""
|
|
37 sample1="$(echo ${sample1} | tr -d '\r' | tr -d '\n')"
|
|
38 sample2="$(echo ${sample2} | tr -d '\r' | tr -d '\n')"
|
|
39 tail -n+2 ${patient}_freq.txt | sed "s/>//" > tmp.txt
|
|
40 echo "<div class='tabbertab' title='$patient'>" >> $html
|
|
41 echo "<div class='tabber'>" >> $html
|
|
42 echo "<div class='tabbertab' title='Data frequency'>" >> $html
|
|
43 echo "<table><tr><td style='vertical-align:top;'>" >> $html
|
|
44 echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_freq'>" >> $html
|
2
|
45 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>Normalized Read Count $sample1</th><th>Number of sequences_$sample2</th><th>Normalized Read Count $sample2</th><th>Sum number of sequences $patient</th><th>Percentage of sequences ${patient}_both</th></thead>" >> $html
|
0
|
46 echo "<tbody>" >> $html
|
2
|
47 readsumtable="<table class='result_table summary_table'><thead><tr><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Total normalized read count for $sample1</th><th>Total normalized read count for $sample2</th></tr></thead>"
|
|
48 while read locus j_segment v_segment cut_off_value both one read_count1 two read_count2 sum percent locusreadsum1 locusreadsum2
|
0
|
49 do
|
|
50 if [ "$locus" != "$oldLocus" ] ; then
|
|
51 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
|
|
52 echo "<tr><td><b>$locus</b></td>" >> $html
|
2
|
53 readsumtable="${readsumtable}<tr><td>$locus</td><td>$v_segment</td><td>$j_segment</td><td>$locusreadsum1</td><td>$locusreadsum2</td></tr>"
|
0
|
54 else
|
|
55 echo "<td></td>" >> $html
|
|
56 fi
|
|
57 echo "<td>$v_segment</td>" >> $html
|
|
58 echo "<td>$j_segment</td>" >> $html
|
|
59 echo "<td>>$cut_off_value</td>" >> $html
|
|
60 if [ "$both" != "0" ] ; then
|
|
61 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$both</td>" >> $html
|
|
62 else
|
|
63 echo "<td>$both</td>" >> $html
|
|
64 fi
|
|
65 if [ "$one" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
66 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$one</td>" >> $html
|
|
67 else
|
|
68 echo "<td>$one</td>" >> $html
|
|
69 fi
|
|
70 echo "<td>$read_count1</td>" >> $html
|
|
71 if [ "$two" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
72 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"freq\")'>$two</td>" >> $html
|
|
73 else
|
|
74 echo "<td>$two</td>" >> $html
|
|
75 fi
|
|
76 echo "<td>$read_count2</td>" >> $html
|
|
77 echo "<td>$sum</td>" >> $html
|
|
78 echo "<td>${percent}%</td>" >> $html
|
|
79 echo "</tr>" >> $html
|
2
|
80 oldLocus="$locus"
|
0
|
81 done < tmp.txt
|
|
82 echo "</tbody></table>" >> $html
|
2
|
83 echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_freq'></div></td></tr></table>" >> $html
|
|
84 echo "${readsumtable}</table></div>" >> $html
|
0
|
85 echo "<div class='tabbertab' title='Graphs frequency'>" >> $html
|
|
86 echo "<a href='${patient}_freq.png'><img src='${patient}_freq.png' width='1280' height='720' /></a><br />" >> $html
|
|
87 echo "<a href='${patient}_freq_both.png'><img src='${patient}_freq_both.png' width='1280' height='720' /></a><br />" >> $html
|
|
88 echo "<a href='${patient}_percent_freq.png'><img src='${patient}_percent_freq.png' width='1280' height='720' /></a></div>" >> $html
|
|
89
|
|
90 tail -n+2 ${patient}_reads.txt | sed "s/>//" > tmp.txt
|
|
91 echo "<div class='tabbertab' title='Data reads'>" >> $html
|
|
92 echo "<table><tr><td style='vertical-align:top;'>" >> $html
|
|
93 echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_reads'>" >> $html
|
|
94 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
|
|
95 echo "<tbody>" >> $html
|
2
|
96 readsumtable="<table class='result_table summary_table'><thead><tr><th>Ig/TCR gene rearrangement type</th><th>Proximal gene segment</th><th>Distal gene segment</th><th>Total normalized read count for $sample1</th><th>Total normalized read count for $sample2</th></tr></thead>"
|
|
97 while read locus j_segment v_segment cut_off_value both one read_count1 two read_count2 sum percent locusreadsum1 locusreadsum2
|
0
|
98 do
|
|
99 if [ "$locus" != "$oldLocus" ] ; then
|
|
100 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
|
|
101 echo "<tr><td><b>$locus</b></td>" >> $html
|
2
|
102 readsumtable="${readsumtable}<tr><td>$locus</td><td>$v_segment</td><td>$j_segment</td><td>$locusreadsum1</td><td>$locusreadsum2</td></tr>"
|
0
|
103 else
|
|
104 echo "<td></td>" >> $html
|
|
105 fi
|
|
106 echo "<td>$v_segment</td>" >> $html
|
|
107 echo "<td>$j_segment</td>" >> $html
|
|
108 echo "<td>>$cut_off_value</td>" >> $html
|
|
109 if [ "$both" != "0" ] ; then
|
1
|
110 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$both</td>" >> $html
|
0
|
111 else
|
|
112 echo "<td>$both</td>" >> $html
|
|
113 fi
|
|
114 if [ "$one" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
115 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample1}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$one</td>" >> $html
|
|
116 else
|
|
117 echo "<td>$one</td>" >> $html
|
|
118 fi
|
|
119 echo "<td>$read_count1</td>" >> $html
|
|
120 if [ "$two" != "0" ] && [ "$cut_off_value" != "0" ] ; then
|
|
121 echo "<td data-patient='${patient}' style='cursor:pointer' onclick='javascript:loadfile(\"${sample2}_${locus}_${cut_off_value}.txt\", \"$patient\", \"reads\")'>$two</td>" >> $html
|
|
122 else
|
|
123 echo "<td>$two</td>" >> $html
|
|
124 fi
|
|
125 echo "<td>$read_count2</td>" >> $html
|
|
126 echo "<td>$sum</td>" >> $html
|
|
127 echo "<td>${percent}%</td>" >> $html
|
|
128 echo "</tr>" >> $html
|
|
129 oldLocus="$locus"
|
|
130 done < tmp.txt
|
|
131 echo "</tbody></table>" >> $html
|
2
|
132 echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_reads'></div></td></tr></table>" >> $html
|
|
133 echo "${readsumtable}</table></div>" >> $html
|
0
|
134 echo "<div class='tabbertab' title='Graphs reads'>" >> $html
|
|
135 echo "<a href='${patient}_reads.png'><img src='${patient}_reads.png' width='1280' height='720' /></a><br />" >> $html
|
|
136 echo "<a href='${patient}_reads_both.png'><img src='${patient}_reads_both.png' width='1280' height='720' /></a><br />" >> $html
|
|
137 echo "<a href='${patient}_percent_reads.png'><img src='${patient}_percent_reads.png' width='1280' height='720' /></a></div>" >> $html
|
2
|
138 echo "</div>" >> $html
|
0
|
139 echo "</div>" >> $html
|
|
140 done < patients.txt
|
|
141 echo "</div></html>" >> $html
|
|
142 rm tmp.txt
|