comparison wrapper.sh @ 5:012a738edf5a draft

Uploaded
author davidvanzessen
date Tue, 01 Nov 2016 10:15:37 -0400
parents 477e95b098fd
children 2ddb9a21f635
comparison
equal deleted inserted replaced
4:477e95b098fd 5:012a738edf5a
14 naive_output_cg=${10} 14 naive_output_cg=${10}
15 naive_output_cm=${11} 15 naive_output_cm=${11}
16 filter_unique=${12} 16 filter_unique=${12}
17 class_filter=${13} 17 class_filter=${13}
18 empty_region_filter=${14} 18 empty_region_filter=${14}
19 fast=${15}
19 mkdir $outdir 20 mkdir $outdir
20 21
21 tar -xzf $dir/style.tar.gz -C $outdir 22 tar -xzf $dir/style.tar.gz -C $outdir
22 23
23 echo "---------------- read parameters ----------------" 24 echo "---------------- read parameters ----------------"
60 echo "---------------- merge_and_filter.r ----------------" 61 echo "---------------- merge_and_filter.r ----------------"
61 echo "---------------- merge_and_filter.r ----------------<br />" >> $log 62 echo "---------------- merge_and_filter.r ----------------<br />" >> $log
62 63
63 Rscript $dir/merge_and_filter.r $PWD/summary.txt $PWD/sequences.txt $PWD/mutationanalysis.txt $PWD/mutationstats.txt $PWD/hotspots.txt $outdir/identified_genes.txt $outdir/merged.txt $outdir/before_unique_filter.txt $outdir/unmatched.txt $method $functionality $unique ${filter_unique} ${class_filter} ${empty_region_filter} 2>&1 64 Rscript $dir/merge_and_filter.r $PWD/summary.txt $PWD/sequences.txt $PWD/mutationanalysis.txt $PWD/mutationstats.txt $PWD/hotspots.txt $outdir/identified_genes.txt $outdir/merged.txt $outdir/before_unique_filter.txt $outdir/unmatched.txt $method $functionality $unique ${filter_unique} ${class_filter} ${empty_region_filter} 2>&1
64 65
65 echo "---------------- creating new IMGT zips ----------------" 66 if [[ "$fast" == "no" ]] ; then
66 echo "---------------- creating new IMGT zips ----------------<br />" >> $log 67
67 68 echo "---------------- creating new IMGT zips ----------------"
68 mkdir $outdir/new_IMGT 69 echo "---------------- creating new IMGT zips ----------------<br />" >> $log
69 70
70 cat `find $PWD/files/ -name "1_*"` > "$outdir/new_IMGT/1_Summary.txt" 71 mkdir $outdir/new_IMGT
71 cat `find $PWD/files/ -name "2_*"` > "$outdir/new_IMGT/2_IMGT-gapped-nt-sequences.txt" 72
72 cat `find $PWD/files/ -name "3_*"` > "$outdir/new_IMGT/3_Nt-sequences.txt" 73 cat `find $PWD/files/ -name "1_*"` > "$outdir/new_IMGT/1_Summary.txt"
73 cat `find $PWD/files/ -name "4_*"` > "$outdir/new_IMGT/4_IMGT-gapped-AA-sequences.txt" 74 cat `find $PWD/files/ -name "2_*"` > "$outdir/new_IMGT/2_IMGT-gapped-nt-sequences.txt"
74 cat `find $PWD/files/ -name "5_*"` > "$outdir/new_IMGT/5_AA-sequences.txt" 75 cat `find $PWD/files/ -name "3_*"` > "$outdir/new_IMGT/3_Nt-sequences.txt"
75 cat `find $PWD/files/ -name "6_*"` > "$outdir/new_IMGT/6_Junction.txt" 76 cat `find $PWD/files/ -name "4_*"` > "$outdir/new_IMGT/4_IMGT-gapped-AA-sequences.txt"
76 cat `find $PWD/files/ -name "7_*"` > "$outdir/new_IMGT/7_V-REGION-mutation-and-AA-change-table.txt" 77 cat `find $PWD/files/ -name "5_*"` > "$outdir/new_IMGT/5_AA-sequences.txt"
77 cat `find $PWD/files/ -name "8_*"` > "$outdir/new_IMGT/8_V-REGION-nt-mutation-statistics.txt" 78 cat `find $PWD/files/ -name "6_*"` > "$outdir/new_IMGT/6_Junction.txt"
78 cat `find $PWD/files/ -name "9_*"` > "$outdir/new_IMGT/9_V-REGION-AA-change-statistics.txt" 79 cat `find $PWD/files/ -name "7_*"` > "$outdir/new_IMGT/7_V-REGION-mutation-and-AA-change-table.txt"
79 cat `find $PWD/files/ -name "10_*"` > "$outdir/new_IMGT/10_V-REGION-mutation-hotspots.txt" 80 cat `find $PWD/files/ -name "8_*"` > "$outdir/new_IMGT/8_V-REGION-nt-mutation-statistics.txt"
80 81 cat `find $PWD/files/ -name "9_*"` > "$outdir/new_IMGT/9_V-REGION-AA-change-statistics.txt"
81 mkdir $outdir/new_IMGT_IGA 82 cat `find $PWD/files/ -name "10_*"` > "$outdir/new_IMGT/10_V-REGION-mutation-hotspots.txt"
82 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA 83
83 84 mkdir $outdir/new_IMGT_IGA
84 mkdir $outdir/new_IMGT_IGA1 85 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA
85 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA1 86
86 87 mkdir $outdir/new_IMGT_IGA1
87 mkdir $outdir/new_IMGT_IGA2 88 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA1
88 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA2 89
89 90 mkdir $outdir/new_IMGT_IGA2
90 mkdir $outdir/new_IMGT_IGG 91 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA2
91 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG 92
92 93 mkdir $outdir/new_IMGT_IGG
93 mkdir $outdir/new_IMGT_IGG1 94 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG
94 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG1 95
95 96 mkdir $outdir/new_IMGT_IGG1
96 mkdir $outdir/new_IMGT_IGG2 97 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG1
97 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG2 98
98 99 mkdir $outdir/new_IMGT_IGG2
99 mkdir $outdir/new_IMGT_IGG3 100 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG2
100 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG3 101
101 102 mkdir $outdir/new_IMGT_IGG3
102 mkdir $outdir/new_IMGT_IGG4 103 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG3
103 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG4 104
104 105 mkdir $outdir/new_IMGT_IGG4
105 mkdir $outdir/new_IMGT_IGM 106 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG4
106 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGM 107
107 108 mkdir $outdir/new_IMGT_IGM
108 Rscript $dir/new_imgt.r $outdir/new_IMGT/ $outdir/merged.txt "-" 2>&1 109 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGM
109 110
110 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA/ $outdir/merged.txt "IGA" 2>&1 111 mkdir $outdir/new_IMGT_IGE
111 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA1/ $outdir/merged.txt "IGA1" 2>&1 112 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGE
112 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA2/ $outdir/merged.txt "IGA2" 2>&1 113
113 114 Rscript $dir/new_imgt.r $outdir/new_IMGT/ $outdir/merged.txt "-" 2>&1
114 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG/ $outdir/merged.txt "IGG" 2>&1 115
115 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG1/ $outdir/merged.txt "IGG1" 2>&1 116 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA/ $outdir/merged.txt "IGA" 2>&1
116 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG2/ $outdir/merged.txt "IGG2" 2>&1 117 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA1/ $outdir/merged.txt "IGA1" 2>&1
117 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG3/ $outdir/merged.txt "IGG3" 2>&1 118 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA2/ $outdir/merged.txt "IGA2" 2>&1
118 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG4/ $outdir/merged.txt "IGG4" 2>&1 119
119 120 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG/ $outdir/merged.txt "IGG" 2>&1
120 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGM/ $outdir/merged.txt "IGM" 2>&1 121 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG1/ $outdir/merged.txt "IGG1" 2>&1
121 122 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG2/ $outdir/merged.txt "IGG2" 2>&1
122 123 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG3/ $outdir/merged.txt "IGG3" 2>&1
123 tmp="$PWD" 124 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG4/ $outdir/merged.txt "IGG4" 2>&1
124 cd $outdir/new_IMGT/ #tar weirdness... 125
125 tar -cJf ../new_IMGT.txz * 126 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGM/ $outdir/merged.txt "IGM" 2>&1
126 127
127 cd $outdir/new_IMGT_IGA/ 128 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGE/ $outdir/merged.txt "IGE" 2>&1
128 tar -cJf ../new_IMGT_IGA.txz * 129
129 130
130 cd $outdir/new_IMGT_IGA1/ 131 tmp="$PWD"
131 tar -cJf ../new_IMGT_IGA1.txz * 132 cd $outdir/new_IMGT/ #tar weirdness...
132 133 tar -cJf ../new_IMGT.txz *
133 cd $outdir/new_IMGT_IGA2/ 134
134 tar -cJf ../new_IMGT_IGA2.txz * 135 cd $outdir/new_IMGT_IGA/
135 136 tar -cJf ../new_IMGT_IGA.txz *
136 cd $outdir/new_IMGT_IGG/ 137
137 tar -cJf ../new_IMGT_IGG.txz * 138 cd $outdir/new_IMGT_IGA1/
138 139 tar -cJf ../new_IMGT_IGA1.txz *
139 cd $outdir/new_IMGT_IGG1/ 140
140 tar -cJf ../new_IMGT_IGG1.txz * 141 cd $outdir/new_IMGT_IGA2/
141 142 tar -cJf ../new_IMGT_IGA2.txz *
142 cd $outdir/new_IMGT_IGG2/ 143
143 tar -cJf ../new_IMGT_IGG2.txz * 144 cd $outdir/new_IMGT_IGG/
144 145 tar -cJf ../new_IMGT_IGG.txz *
145 cd $outdir/new_IMGT_IGG3/ 146
146 tar -cJf ../new_IMGT_IGG3.txz * 147 cd $outdir/new_IMGT_IGG1/
147 148 tar -cJf ../new_IMGT_IGG1.txz *
148 cd $outdir/new_IMGT_IGG4/ 149
149 tar -cJf ../new_IMGT_IGG4.txz * 150 cd $outdir/new_IMGT_IGG2/
150 151 tar -cJf ../new_IMGT_IGG2.txz *
151 cd $outdir/new_IMGT_IGM/ 152
152 tar -cJf ../new_IMGT_IGM.txz * 153 cd $outdir/new_IMGT_IGG3/
153 154 tar -cJf ../new_IMGT_IGG3.txz *
154 cd $tmp 155
156 cd $outdir/new_IMGT_IGG4/
157 tar -cJf ../new_IMGT_IGG4.txz *
158
159 cd $outdir/new_IMGT_IGM/
160 tar -cJf ../new_IMGT_IGM.txz *
161
162 cd $outdir/new_IMGT_IGE/
163 tar -cJf ../new_IMGT_IGE.txz *
164
165 cd $tmp
166 fi
155 167
156 echo "---------------- shm_csr.r ----------------" 168 echo "---------------- shm_csr.r ----------------"
157 echo "---------------- shm_csr.r ----------------<br />" >> $log 169 echo "---------------- shm_csr.r ----------------<br />" >> $log
158 170
159 classes="IGA,IGA1,IGA2,IGG,IGG1,IGG2,IGG3,IGG4,IGM,unmatched" 171 classes="IGA,IGA1,IGA2,IGG,IGG1,IGG2,IGG3,IGG4,IGM,IGE,unmatched"
160 echo "R mutation analysis" 172 echo "R mutation analysis"
161 Rscript $dir/shm_csr.r $outdir/merged.txt $classes $outdir ${empty_region_filter} 2>&1 173 Rscript $dir/shm_csr.r $outdir/merged.txt $classes $outdir ${empty_region_filter} 2>&1
162 174
163 echo "---------------- shm_csr.py ----------------" 175 echo "---------------- shm_csr.py ----------------"
164 echo "---------------- shm_csr.py ----------------<br />" >> $log 176 echo "---------------- shm_csr.py ----------------<br />" >> $log
166 python $dir/shm_csr.py --input $outdir/merged.txt --genes $classes --empty_region_filter "${empty_region_filter}" --output $outdir/hotspot_analysis.txt 178 python $dir/shm_csr.py --input $outdir/merged.txt --genes $classes --empty_region_filter "${empty_region_filter}" --output $outdir/hotspot_analysis.txt
167 179
168 echo "---------------- aa_histogram.r ----------------" 180 echo "---------------- aa_histogram.r ----------------"
169 echo "---------------- aa_histogram.r ----------------<br />" >> $log 181 echo "---------------- aa_histogram.r ----------------<br />" >> $log
170 182
171 Rscript $dir/aa_histogram.r $outdir/aa_id_mutations.txt $outdir/absent_aa_id.txt "IGA,IGG,IGM" $outdir/ 2>&1 183 Rscript $dir/aa_histogram.r $outdir/aa_id_mutations.txt $outdir/absent_aa_id.txt "IGA,IGG,IGM,IGE" $outdir/ 2>&1
172 if [ -e "$outdir/aa_histogram_.png" ]; then 184 if [ -e "$outdir/aa_histogram_.png" ]; then
173 mv $outdir/aa_histogram_.png $outdir/aa_histogram.png 185 mv $outdir/aa_histogram_.png $outdir/aa_histogram.png
174 mv $outdir/aa_histogram_.txt $outdir/aa_histogram.txt 186 mv $outdir/aa_histogram_.txt $outdir/aa_histogram.txt
175 fi 187 fi
176 188
177 genes=(IGA IGA1 IGA2 IGG IGG1 IGG2 IGG3 IGG4 IGM) 189 genes=(IGA IGA1 IGA2 IGG IGG1 IGG2 IGG3 IGG4 IGM IGE)
178 190
179 funcs=(sum mean median) 191 funcs=(sum mean median)
180 funcs=(sum) 192 funcs=(sum)
181 193
182 echo "---------------- sequence_overview.r ----------------" 194 echo "---------------- sequence_overview.r ----------------"
245 tmp=`cat $outdir/all_${func}_n.txt` 257 tmp=`cat $outdir/all_${func}_n.txt`
246 echo "<th><a href='matched_all_${func}.txt'>all (N = $tmp)</a></th>" >> $output 258 echo "<th><a href='matched_all_${func}.txt'>all (N = $tmp)</a></th>" >> $output
247 tmp=`cat $outdir/unmatched_${func}_n.txt` 259 tmp=`cat $outdir/unmatched_${func}_n.txt`
248 echo "<th><a href='unmatched.txt'>unmatched (N = ${unmatched_count})</a></th><tr></thead>" >> $output 260 echo "<th><a href='unmatched.txt'>unmatched (N = ${unmatched_count})</a></th><tr></thead>" >> $output
249 261
250 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 unx uny unz allx ally allz 262 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
251 do 263 do
252 if [ "$name" == "FR R/S (ratio)" ] || [ "$name" == "CDR R/S (ratio)" ] ; then #meh 264 if [ "$name" == "FR R/S (ratio)" ] || [ "$name" == "CDR R/S (ratio)" ] ; then #meh
253 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>${allx}/${ally} (${allz})</td><td>${unx}/${uny} (${unz})</td></tr>" >> $output 265 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
254 elif [ "$name" == "Median of Number of Mutations (%)" ] ; then 266 elif [ "$name" == "Median of Number of Mutations (%)" ] ; then
255 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>${allz}%</td><td>${unz}%</td></tr>" >> $output 267 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
256 else 268 else
257 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>${allx}/${ally} (${allz}%)</td><td>${unx}/${uny} (${unz}%)</td></tr>" >> $output 269 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
258 fi 270 fi
259 done < $outdir/data_${func}.txt 271 done < $outdir/data_${func}.txt
260 272
261 else 273 else
262 tmp=`cat $outdir/all_${func}_n.txt` 274 tmp=`cat $outdir/all_${func}_n.txt`
263 echo "<th><a href='matched_all_${func}.txt'>all (N = $tmp)</a></th>" >> $output 275 echo "<th><a href='matched_all_${func}.txt'>all (N = $tmp)</a></th>" >> $output
264 276
265 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 unx uny unz allx ally allz 277 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
266 do 278 do
267 if [ "$name" == "FR R/S (ratio)" ] || [ "$name" == "CDR R/S (ratio)" ] ; then #meh 279 if [ "$name" == "FR R/S (ratio)" ] || [ "$name" == "CDR R/S (ratio)" ] ; then #meh
268 echo "<tr><td>$name</td><td>${allx}/${ally}</td></tr>" >> $output 280 echo "<tr><td>$name</td><td>${allx}/${ally}</td></tr>" >> $output
269 elif [ "$name" == "Median of Number of Mutations (%)" ] ; then 281 elif [ "$name" == "Median of Number of Mutations (%)" ] ; then
270 echo "<tr><td>$name</td><td>${allz}%</td></tr>" >> $output 282 echo "<tr><td>$name</td><td>${allz}%</td></tr>" >> $output
379 echo "<img src='IGG.png'/><br />" >> $output 391 echo "<img src='IGG.png'/><br />" >> $output
380 fi 392 fi
381 393
382 echo "</div>" >> $output #CSR tab end 394 echo "</div>" >> $output #CSR tab end
383 395
384 echo "---------------- change-o MakeDB ----------------" 396 if [[ "$fast" == "no" ]] ; then
385 397
386 mkdir $outdir/change_o 398 echo "---------------- change-o MakeDB ----------------"
387 399
388 tmp="$PWD" 400 mkdir $outdir/change_o
389 401
390 cd $outdir/change_o 402 tmp="$PWD"
391 403
392 bash $dir/change_o/makedb.sh $outdir/new_IMGT.txz false false false $outdir/change_o/change-o-db.txt 404 cd $outdir/change_o
393 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 405
394 406 bash $dir/change_o/makedb.sh $outdir/new_IMGT.txz false false false $outdir/change_o/change-o-db.txt
395 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 407 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
396 408
397 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" 409 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
398 410
399 if [[ $(wc -l < $outdir/new_IMGT_IGA/1_Summary.txt) -gt "1" ]]; then 411 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"
400 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGA.txz false false false $outdir/change_o/change-o-db-IGA.txt 412
401 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 413 if [[ $(wc -l < $outdir/new_IMGT_IGA/1_Summary.txt) -gt "1" ]]; then
402 else 414 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGA.txz false false false $outdir/change_o/change-o-db-IGA.txt
403 echo "No IGA sequences" > "$outdir/change_o/change-o-db-defined_clones-IGA.txt" 415 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
404 echo "No IGA sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGA.txt" 416 else
405 fi 417 echo "No IGA sequences" > "$outdir/change_o/change-o-db-defined_clones-IGA.txt"
406 418 echo "No IGA sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGA.txt"
407 if [[ $(wc -l < $outdir/new_IMGT_IGG/1_Summary.txt) -gt "1" ]]; then 419 fi
408 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGG.txz false false false $outdir/change_o/change-o-db-IGG.txt 420
409 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 421 if [[ $(wc -l < $outdir/new_IMGT_IGG/1_Summary.txt) -gt "1" ]]; then
410 else 422 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGG.txz false false false $outdir/change_o/change-o-db-IGG.txt
411 echo "No IGG sequences" > "$outdir/change_o/change-o-db-defined_clones-IGG.txt" 423 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
412 echo "No IGG sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGG.txt" 424 else
413 fi 425 echo "No IGG sequences" > "$outdir/change_o/change-o-db-defined_clones-IGG.txt"
414 426 echo "No IGG sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGG.txt"
415 if [[ $(wc -l < $outdir/new_IMGT_IGM/1_Summary.txt) -gt "1" ]]; then 427 fi
416 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGM.txz false false false $outdir/change_o/change-o-db-IGM.txt 428
417 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 429 if [[ $(wc -l < $outdir/new_IMGT_IGM/1_Summary.txt) -gt "1" ]]; then
418 else 430 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGM.txz false false false $outdir/change_o/change-o-db-IGM.txt
419 echo "No IGM sequences" > "$outdir/change_o/change-o-db-defined_clones-IGM.txt" 431 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
420 echo "No IGM sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGM.txt" 432 else
421 fi 433 echo "No IGM sequences" > "$outdir/change_o/change-o-db-defined_clones-IGM.txt"
422 434 echo "No IGM sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGM.txt"
423 PWD="$tmp" 435 fi
436
437 PWD="$tmp"
424 438
425 echo "<div class='tabbertab' title='Clonality'>" >> $output #clonality tab 439 echo "<div class='tabbertab' title='Clonality'>" >> $output #clonality tab
426 440
427 function clonality_table { 441 function clonality_table {
428 local infile=$1 442 local infile=$1
468 482
469 483
470 echo "</div>" >> $output #clonality tabber end 484 echo "</div>" >> $output #clonality tabber end
471 485
472 echo "</div>" >> $output #clonality tab end 486 echo "</div>" >> $output #clonality tab end
487
488 fi
473 489
474 echo "<div class='tabbertab' title='Downloads'>" >> $output 490 echo "<div class='tabbertab' title='Downloads'>" >> $output
475 491
476 echo "<table class='pure-table pure-table-striped'>" >> $output 492 echo "<table class='pure-table pure-table-striped'>" >> $output
477 echo "<thead><tr><th>info</th><th>link</th></tr></thead>" >> $output 493 echo "<thead><tr><th>info</th><th>link</th></tr></thead>" >> $output
551 567
552 echo "</div>" >> $output #tabs end 568 echo "</div>" >> $output #tabs end
553 569
554 echo "</html>" >> $output 570 echo "</html>" >> $output
555 571
556 echo "---------------- baseline ----------------" 572
557 echo "---------------- baseline ----------------<br />" >> $log 573 if [[ "$fast" == "no" ]] ; then
558 tmp="$PWD" 574
559 575 echo "---------------- baseline ----------------"
560 mkdir $outdir/baseline 576 echo "---------------- baseline ----------------<br />" >> $log
561 577 tmp="$PWD"
562 578
563 mkdir $outdir/baseline/IGA_IGG_IGM 579 mkdir $outdir/baseline
564 if [[ $(wc -l < $outdir/new_IMGT/1_Summary.txt) -gt "1" ]]; then 580
565 cd $outdir/baseline/IGA_IGG_IGM 581
566 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT.txz "IGA_IGG_IGM" "$dir/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline.pdf" "Sequence.ID" "$outdir/baseline.txt" 582 mkdir $outdir/baseline/IGA_IGG_IGM
567 else 583 if [[ $(wc -l < $outdir/new_IMGT/1_Summary.txt) -gt "1" ]]; then
568 echo "No sequences" > "$outdir/baseline.txt" 584 cd $outdir/baseline/IGA_IGG_IGM
569 fi 585 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT.txz "IGA_IGG_IGM" "$dir/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline.pdf" "Sequence.ID" "$outdir/baseline.txt"
570 586 else
571 mkdir $outdir/baseline/IGA 587 echo "No sequences" > "$outdir/baseline.txt"
572 if [[ $(wc -l < $outdir/new_IMGT_IGA/1_Summary.txt) -gt "1" ]]; then 588 fi
573 cd $outdir/baseline/IGA 589
574 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_IGA.txz "IGA" "$dir/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_IGA.pdf" "Sequence.ID" "$outdir/baseline_IGA.txt" 590 mkdir $outdir/baseline/IGA
575 else 591 if [[ $(wc -l < $outdir/new_IMGT_IGA/1_Summary.txt) -gt "1" ]]; then
576 echo "No IGA sequences" > "$outdir/baseline_IGA.txt" 592 cd $outdir/baseline/IGA
577 fi 593 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_IGA.txz "IGA" "$dir/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_IGA.pdf" "Sequence.ID" "$outdir/baseline_IGA.txt"
578 594 else
579 mkdir $outdir/baseline/IGG 595 echo "No IGA sequences" > "$outdir/baseline_IGA.txt"
580 if [[ $(wc -l < $outdir/new_IMGT_IGG/1_Summary.txt) -gt "1" ]]; then 596 fi
581 cd $outdir/baseline/IGG 597
582 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_IGG.txz "cg" "$dir/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_IGG.pdf" "Sequence.ID" "$outdir/baseline_IGG.txt" 598 mkdir $outdir/baseline/IGG
583 else 599 if [[ $(wc -l < $outdir/new_IMGT_IGG/1_Summary.txt) -gt "1" ]]; then
584 echo "No IGG sequences" > "$outdir/baseline_IGG.txt" 600 cd $outdir/baseline/IGG
585 fi 601 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_IGG.txz "cg" "$dir/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_IGG.pdf" "Sequence.ID" "$outdir/baseline_IGG.txt"
586 602 else
587 mkdir $outdir/baseline/IGM 603 echo "No IGG sequences" > "$outdir/baseline_IGG.txt"
588 if [[ $(wc -l < $outdir/new_IMGT_IGM/1_Summary.txt) -gt "1" ]]; then 604 fi
589 cd $outdir/baseline/IGM 605
590 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_IGM.txz "IGM" "$dir/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_IGM.pdf" "Sequence.ID" "$outdir/baseline_IGM.txt" 606 mkdir $outdir/baseline/IGM
591 else 607 if [[ $(wc -l < $outdir/new_IMGT_IGM/1_Summary.txt) -gt "1" ]]; then
592 echo "No IGM sequences" > "$outdir/baseline_IGM.txt" 608 cd $outdir/baseline/IGM
593 fi 609 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "25:26:38:55:65:104:-" $outdir/new_IMGT_IGM.txz "IGM" "$dir/baseline/IMGT-reference-seqs-IGHV-2015-11-05.fa" "$outdir/baseline_IGM.pdf" "Sequence.ID" "$outdir/baseline_IGM.txt"
594 610 else
595 cd $tmp 611 echo "No IGM sequences" > "$outdir/baseline_IGM.txt"
596 612 fi
597 echo "Cleaning up *.RData files" 613
598 find $outdir/baseline -name "*.RData" -type f -delete 614 cd $tmp
615
616 echo "Cleaning up *.RData files"
617 find $outdir/baseline -name "*.RData" -type f -delete
618
619 fi
599 620
600 echo "---------------- naive_output.r ----------------" 621 echo "---------------- naive_output.r ----------------"
601 echo "---------------- naive_output.r ----------------<br />" >> $log 622 echo "---------------- naive_output.r ----------------<br />" >> $log
602 623
603 if [[ "$naive_output" != "None" ]] 624 if [[ "$naive_output" == "yes" ]]
604 then 625 then
605 cp $outdir/new_IMGT_IGA.txz ${naive_output_ca} 626 cp $outdir/new_IMGT_IGA.txz ${naive_output_ca}
606 cp $outdir/new_IMGT_IGG.txz ${naive_output_cg} 627 cp $outdir/new_IMGT_IGG.txz ${naive_output_cg}
607 cp $outdir/new_IMGT_IGM.txz ${naive_output_cm} 628 cp $outdir/new_IMGT_IGM.txz ${naive_output_cm}
608 fi 629 fi