Mercurial > repos > davidvanzessen > clonal_sequences_in_paired_samples
comparison wrapper.sh @ 29:5ab17bdf2530 draft
Uploaded
author | davidvanzessen |
---|---|
date | Fri, 22 May 2015 09:06:04 -0400 |
parents | 0940835d259c |
children | 45554fd15511 |
comparison
equal
deleted
inserted
replaced
28:a63ccc36f5a4 | 29:5ab17bdf2530 |
---|---|
3 inputFile=$1 | 3 inputFile=$1 |
4 outputFile=$2 | 4 outputFile=$2 |
5 outputDir=$3 | 5 outputDir=$3 |
6 min_freq=$4 | 6 min_freq=$4 |
7 min_cells=$5 | 7 min_cells=$5 |
8 merge_on="$6" | |
8 | 9 |
9 dir="$(cd "$(dirname "$0")" && pwd)" | 10 dir="$(cd "$(dirname "$0")" && pwd)" |
10 mkdir $outputDir | 11 mkdir $outputDir |
11 | 12 |
12 | 13 |
13 Rscript --verbose $dir/RScript.r $inputFile $outputDir $outputFile $min_freq $min_cells 2>&1 | 14 Rscript --verbose $dir/RScript.r $inputFile $outputDir $outputFile $min_freq $min_cells "${merge_on}" 2>&1 |
14 cp $dir/jquery-1.11.0.min.js $outputDir | 15 cp $dir/jquery-1.11.0.min.js $outputDir |
15 cp $dir/script.js $outputDir | 16 cp $dir/script.js $outputDir |
16 cp $dir/style.css $outputDir | 17 cp $dir/style.css $outputDir |
17 cp $dir/tabber.js $outputDir | 18 cp $dir/tabber.js $outputDir |
18 | 19 |
49 echo "<div class='tabbertab' title='Data frequency'>" >> "$html" | 50 echo "<div class='tabbertab' title='Data frequency'>" >> "$html" |
50 echo "<table><tr><td style='vertical-align:top;'>" >> "$html" | 51 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" | 52 echo "<table border = 1 class='result_table summary_table' id='summary_table_${patient}_freq'>" >> "$html" |
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" | 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" |
53 echo "<tbody>" >> "$html" | 54 echo "<tbody>" >> "$html" |
55 scatterplot_tab="<div class='tabbertab' title='Scatter Plots Reads'>" | |
54 while read locus j_segment v_segment cut_off_value both one read_count1 two read_count2 sum percent locusreadsum1 locusreadsum2 | 56 while read locus j_segment v_segment cut_off_value both one read_count1 two read_count2 sum percent locusreadsum1 locusreadsum2 |
55 do | 57 do |
56 if [ "$locus" != "$oldLocus" ] ; then | 58 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" | 59 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" | 60 echo "<tr><td><b>$locus</b></td>" >> "$html" |
80 fi | 82 fi |
81 echo "<td>$read_count2</td>" >> "$html" | 83 echo "<td>$read_count2</td>" >> "$html" |
82 echo "<td>$sum</td>" >> "$html" | 84 echo "<td>$sum</td>" >> "$html" |
83 echo "<td>${percent}%</td>" >> "$html" | 85 echo "<td>${percent}%</td>" >> "$html" |
84 echo "</tr>" >> "$html" | 86 echo "</tr>" >> "$html" |
85 oldLocus="$locus" | 87 oldLocus="$locus" |
88 if [ "${cut_off_value}" == "0" ] ; then | |
89 scatterplot_tab="${scatterplot_tab}<img src='${patient}_${sample1}_${sample2}_freq_${locus}_scatter.png' /><br />" | |
90 fi | |
86 done < tmp.txt | 91 done < tmp.txt |
87 echo "</tbody></table>" >> "$html" | 92 echo "</tbody></table>" >> "$html" |
88 echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_freq'></div></td></tr></table>" >> "$html" | 93 echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_freq'></div></td></tr></table>" >> "$html" |
89 echo "</div>" >> "$html" | 94 echo "</div>" >> "$html" |
90 echo "<div class='tabbertab' title='Graphs frequency'>" >> "$html" | 95 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" | 96 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" | 97 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" | 98 echo "<a href='${patient}_percent_freq.png'><img src='${patient}_percent_freq.png' width='1280' height='720' /></a></div>" >> "$html" |
99 echo "${scatterplot_tab}</div>" >> "$html" | |
94 | 100 |
95 tail -n+2 ${patient}_reads.txt | sed "s/>//" > tmp.txt | 101 tail -n+2 ${patient}_reads.txt | sed "s/>//" > tmp.txt |
96 echo "<div class='tabbertab' title='Data reads'>" >> "$html" | 102 echo "<div class='tabbertab' title='Data reads'>" >> "$html" |
97 echo "<table><tr><td style='vertical-align:top;'>" >> "$html" | 103 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" | 104 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" | 105 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" | 106 echo "<tbody>" >> "$html" |
107 scatterplot_tab="<div class='tabbertab' title='Scatter Plots Frequency'>" | |
101 while read locus j_segment v_segment cut_off_value both one read_count1 two read_count2 sum percent locusreadsum1 locusreadsum2 | 108 while read locus j_segment v_segment cut_off_value both one read_count1 two read_count2 sum percent locusreadsum1 locusreadsum2 |
102 do | 109 do |
103 if [ "$locus" != "$oldLocus" ] ; then | 110 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" | 111 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" | 112 echo "<tr><td><b>$locus</b></td>" >> "$html" |
128 echo "<td>$read_count2</td>" >> "$html" | 135 echo "<td>$read_count2</td>" >> "$html" |
129 echo "<td>$sum</td>" >> "$html" | 136 echo "<td>$sum</td>" >> "$html" |
130 echo "<td>${percent}%</td>" >> "$html" | 137 echo "<td>${percent}%</td>" >> "$html" |
131 echo "</tr>" >> "$html" | 138 echo "</tr>" >> "$html" |
132 oldLocus="$locus" | 139 oldLocus="$locus" |
140 if [ "${cut_off_value}" == "0" ] ; then | |
141 scatterplot_tab="${scatterplot_tab}<img src='${patient}_${sample1}_${sample2}_reads_${locus}_scatter.png' /><br />" | |
142 fi | |
133 done < tmp.txt | 143 done < tmp.txt |
134 echo "</tbody></table>" >> "$html" | 144 echo "</tbody></table>" >> "$html" |
135 echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_reads'></div></td></tr></table>" >> "$html" | 145 echo "</td><td style='vertical-align:top;'><div id='result_div_${patient}_reads'></div></td></tr></table>" >> "$html" |
136 echo "</div>" >> "$html" | 146 echo "</div>" >> "$html" |
137 echo "<div class='tabbertab' title='Graphs reads'>" >> "$html" | 147 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" | 148 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" | 149 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" | 150 echo "<a href='${patient}_percent_reads.png'><img src='${patient}_percent_reads.png' width='1280' height='720' /></a></div>" >> "$html" |
151 echo "${scatterplot_tab}</div>" >> "$html" | |
141 echo "</div>" >> "$html" | 152 echo "</div>" >> "$html" |
142 echo "</div>" >> "$html" | 153 echo "</div>" >> "$html" |
143 echo "</html>" >> "$html" | 154 echo "</html>" >> "$html" |
144 done < patients.txt | 155 done < patients.txt |
145 | 156 |
146 html="index.html" | 157 html="index.html" |
147 echo "<html>" > $html | 158 echo "<html>" > $html |
148 echo "<table>" >> "$html" | 159 echo "<table>" >> "$html" |
149 echo "<tr><td><b>Singles:</b></td></tr>" >> "$html" | 160 echo "<tr><td><b>Singles (<a href='singles_freq_scatterplot.png'>Frequency scatterplot</a>, <a href='singles_reads_scatterplot.png'>Reads scatterplot</a>):</b></td></tr>" >> "$html" |
150 for patient in "${singles[@]}" | 161 for patient in "${singles[@]}" |
151 do | 162 do |
152 echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> "$html" | 163 echo "<tr><td><a href='${patient}.html'>$patient</a></td></tr>" >> "$html" |
153 done | 164 done |
154 echo "<tr><td><b>Pairs (Left & Right):</b></td></tr>" >> "$html" | 165 echo "<tr><td><b>Pairs (Left & Right):</b></td></tr>" >> "$html" |