comparison wrapper.sh @ 92:cf8ad181628f draft

planemo upload commit 36be3b053802693392f935e6619ba3f2b1704e3c
author rhpvorderman
date Mon, 12 Dec 2022 12:32:44 +0000
parents f387cc1580c6
children 8fcf31272f6e
comparison
equal deleted inserted replaced
91:f387cc1580c6 92:cf8ad181628f
22 empty_region_filter=${18} 22 empty_region_filter=${18}
23 fast=${19} 23 fast=${19}
24 24
25 #exec 5> debug_output.txt 25 #exec 5> debug_output.txt
26 #BASH_XTRACEFD="5" 26 #BASH_XTRACEFD="5"
27 #PS4='$(date +%s.%N) $LINENO: ' 27 ## Busybox date does not support '+%s.%N'. So use the slower python instead.
28 ## Using -S python does not do 'import site' which shortens the command
29 ## to 10 milliseconds.
30 #PS4='$(python -Sc "import time; print(time.time())") $LINENO: '
28 #set -x 31 #set -x
29 32
30 mkdir -p $outdir 33 mkdir -p $outdir
31 34
32 tar -xzf $dir/style.tar.gz -C $outdir 35 tar -xzf $dir/style.tar.gz -C $outdir
82 echo "---------------- merge_and_filter.r ----------------" 85 echo "---------------- merge_and_filter.r ----------------"
83 echo "---------------- merge_and_filter.r ----------------<br />" >> $log 86 echo "---------------- merge_and_filter.r ----------------<br />" >> $log
84 87
85 Rscript $dir/merge_and_filter.r $PWD/summary.txt $PWD/sequences.txt $PWD/mutationanalysis.txt $PWD/mutationstats.txt $PWD/hotspots.txt "$PWD/gapped_aa.txt" $outdir/identified_genes.txt $outdir/merged.txt $outdir/before_unique_filter.txt $outdir/unmatched.txt $method $functionality $unique ${filter_unique} ${filter_unique_count} ${class_filter} ${empty_region_filter} 2>&1 88 Rscript $dir/merge_and_filter.r $PWD/summary.txt $PWD/sequences.txt $PWD/mutationanalysis.txt $PWD/mutationstats.txt $PWD/hotspots.txt "$PWD/gapped_aa.txt" $outdir/identified_genes.txt $outdir/merged.txt $outdir/before_unique_filter.txt $outdir/unmatched.txt $method $functionality $unique ${filter_unique} ${filter_unique_count} ${class_filter} ${empty_region_filter} 2>&1
86 89
87 if [[ "${naive_output}" == "yes" ]] || [[ "$fast" == "no" ]] ; then 90 echo "---------------- creating new IMGT zips ----------------"
88 91 echo "---------------- creating new IMGT zips ----------------<br />" >> $log
89 echo "---------------- creating new IMGT zips ----------------" 92
90 echo "---------------- creating new IMGT zips ----------------<br />" >> $log 93 python $dir/split_imgt_file.py --outdir $outdir $input $outdir/merged.txt \
91 94 --prefix new_IMGT \
92 mkdir $outdir/new_IMGT 95 - IGA IGA1 IGA2 IGG IGG1 IGG2 IGG3 IGG4 IGM IGE
93 96
94 cp $PWD/summary.txt "$outdir/new_IMGT/1_Summary.txt"
95 cp $PWD/gapped_nt.txt "$outdir/new_IMGT/2_IMGT-gapped-nt-sequences.txt"
96 cp $PWD/sequences.txt "$outdir/new_IMGT/3_Nt-sequences.txt"
97 cp $PWD/gapped_aa.txt "$outdir/new_IMGT/4_IMGT-gapped-AA-sequences.txt"
98 cp $PWD/aa.txt "$outdir/new_IMGT/5_AA-sequences.txt"
99 cp $PWD/junction.txt "$outdir/new_IMGT/6_Junction.txt"
100 cp $PWD/mutationanalysis.txt "$outdir/new_IMGT/7_V-REGION-mutation-and-AA-change-table.txt"
101 cp $PWD/mutationstats.txt "$outdir/new_IMGT/8_V-REGION-nt-mutation-statistics.txt"
102 cp $PWD/aa_change_stats.txt "$outdir/new_IMGT/9_V-REGION-AA-change-statistics.txt"
103 cp $PWD/hotspots.txt "$outdir/new_IMGT/10_V-REGION-mutation-hotspots.txt"
104
105 mkdir $outdir/new_IMGT_IGA
106 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA
107
108 mkdir $outdir/new_IMGT_IGA1
109 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA1
110
111 mkdir $outdir/new_IMGT_IGA2
112 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA2
113
114 mkdir $outdir/new_IMGT_IGG
115 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG
116
117 mkdir $outdir/new_IMGT_IGG1
118 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG1
119
120 mkdir $outdir/new_IMGT_IGG2
121 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG2
122
123 mkdir $outdir/new_IMGT_IGG3
124 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG3
125
126 mkdir $outdir/new_IMGT_IGG4
127 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG4
128
129 mkdir $outdir/new_IMGT_IGM
130 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGM
131
132 mkdir $outdir/new_IMGT_IGE
133 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGE
134
135 Rscript $dir/new_imgt.r $outdir/new_IMGT/ $outdir/merged.txt "-" 2>&1
136
137 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA/ $outdir/merged.txt "IGA" 2>&1
138 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA1/ $outdir/merged.txt "IGA1" 2>&1
139 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA2/ $outdir/merged.txt "IGA2" 2>&1
140
141 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG/ $outdir/merged.txt "IGG" 2>&1
142 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG1/ $outdir/merged.txt "IGG1" 2>&1
143 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG2/ $outdir/merged.txt "IGG2" 2>&1
144 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG3/ $outdir/merged.txt "IGG3" 2>&1
145 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG4/ $outdir/merged.txt "IGG4" 2>&1
146
147 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGM/ $outdir/merged.txt "IGM" 2>&1
148
149 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGE/ $outdir/merged.txt "IGE" 2>&1
150
151
152 tmp="$PWD"
153 cd $outdir/new_IMGT/ #tar weirdness...
154 tar -cJf ../new_IMGT.txz *
155
156 cd $outdir/new_IMGT_IGA/
157 tar -cJf ../new_IMGT_IGA.txz *
158
159 cd $outdir/new_IMGT_IGA1/
160 tar -cJf ../new_IMGT_IGA1.txz *
161
162 cd $outdir/new_IMGT_IGA2/
163 tar -cJf ../new_IMGT_IGA2.txz *
164
165 cd $outdir/new_IMGT_IGG/
166 tar -cJf ../new_IMGT_IGG.txz *
167
168 cd $outdir/new_IMGT_IGG1/
169 tar -cJf ../new_IMGT_IGG1.txz *
170
171 cd $outdir/new_IMGT_IGG2/
172 tar -cJf ../new_IMGT_IGG2.txz *
173
174 cd $outdir/new_IMGT_IGG3/
175 tar -cJf ../new_IMGT_IGG3.txz *
176
177 cd $outdir/new_IMGT_IGG4/
178 tar -cJf ../new_IMGT_IGG4.txz *
179
180 cd $outdir/new_IMGT_IGM/
181 tar -cJf ../new_IMGT_IGM.txz *
182
183 cd $outdir/new_IMGT_IGE/
184 tar -cJf ../new_IMGT_IGE.txz *
185
186 cd $tmp
187 fi
188 97
189 echo "---------------- shm_csr.r ----------------" 98 echo "---------------- shm_csr.r ----------------"
190 echo "---------------- shm_csr.r ----------------<br />" >> $log 99 echo "---------------- shm_csr.r ----------------<br />" >> $log
191 100
192 classes="IGA,IGA1,IGA2,IGG,IGG1,IGG2,IGG3,IGG4,IGM,IGE,unmatched" 101 classes="IGA,IGA1,IGA2,IGG,IGG1,IGG2,IGG3,IGG4,IGM,IGE,unmatched"
193 echo "R mutation analysis" 102 echo "R mutation analysis"
194 Rscript $dir/shm_csr.r $outdir/merged.txt $classes $outdir ${empty_region_filter} 2>&1 103 Rscript $dir/shm_csr.r $outdir/merged.txt $classes $outdir ${empty_region_filter} 2>&1
104
105 echo "---------- Split naive memory IGM ---------"
106 echo "---------- Split naive memory IGM ---------<br />" >> $log
107
108 python $dir/igm_naive_mutations.py $outdir/scatter.txt $outdir/igm_naive_mutations.txt \
109 $outdir/igm_naive_memory_mutations.txt
110
111 python $dir/split_imgt_file.py --outdir $outdir $outdir/new_IMGT_IGM.txz \
112 $outdir/igm_naive_mutations.txt \
113 --prefix new_IMGT_IGM_NAIVE -
114
115 python $dir/split_imgt_file.py --outdir $outdir $outdir/new_IMGT_IGM.txz \
116 $outdir/igm_naive_memory_mutations.txt \
117 --prefix new_IMGT_IGM_NAIVE_MEMORY -
195 118
196 echo "---------------- plot_pdfs.r ----------------" 119 echo "---------------- plot_pdfs.r ----------------"
197 echo "---------------- plot_pdfs.r ----------------<br />" >> $log 120 echo "---------------- plot_pdfs.r ----------------<br />" >> $log
198 121
199 echo "Rscript $dir/shm_csr.r $outdir/pdfplots.RData $outdir 2>&1" 122 echo "Rscript $dir/shm_csr.r $outdir/pdfplots.RData $outdir 2>&1"
226 echo "---------------- sequence_overview.r ----------------" 149 echo "---------------- sequence_overview.r ----------------"
227 echo "---------------- sequence_overview.r ----------------<br />" >> $log 150 echo "---------------- sequence_overview.r ----------------<br />" >> $log
228 151
229 mkdir $outdir/sequence_overview 152 mkdir $outdir/sequence_overview
230 153
231 Rscript $dir/sequence_overview.r $outdir/before_unique_filter.txt $outdir/merged.txt $outdir/sequence_overview $classes $outdir/hotspot_analysis_sum.txt ${empty_region_filter} 2>&1 154 python $dir/sequence_overview.py --before-unique $outdir/before_unique_filter.txt \
155 --outdir $outdir/sequence_overview --empty-region-filter ${empty_region_filter}
156 Rscript $dir/nt_overview.r $outdir/merged.txt $outdir/sequence_overview $classes $outdir/hotspot_analysis_sum.txt ${empty_region_filter} 2>&1
232 157
233 echo "<table border='1'>" > $outdir/base_overview.html 158 echo "<table border='1'>" > $outdir/base_overview.html
234 159
235 while IFS=$'\t' read ID class seq A C G T 160 while IFS=$'\t' read ID class seq A C G T
236 do 161 do
440 if [ -e $outdir/aa_histogram_IGE.png ] 365 if [ -e $outdir/aa_histogram_IGE.png ]
441 then 366 then
442 echo "<a href='aa_histogram_IGE.pdf'><img src='aa_histogram_IGE.png'/></a><br />" >> $output 367 echo "<a href='aa_histogram_IGE.pdf'><img src='aa_histogram_IGE.png'/></a><br />" >> $output
443 fi 368 fi
444 369
445 370 count_imgt_lines () {
371 tar -xJf $1 1_Summary.txt
372 # Use a pipe so wc -l does not display the filename
373 wc -l < 1_Summary.txt
374 rm 1_Summary.txt
375 }
446 376
447 if [[ "$fast" == "no" ]] ; then 377 if [[ "$fast" == "no" ]] ; then
448 378
449 379
450 380
465 fi 395 fi
466 396
467 echo "<p>${header_substring}</p></center>" >> $output 397 echo "<p>${header_substring}</p></center>" >> $output
468 398
469 mkdir $outdir/baseline/IGA_IGG_IGM 399 mkdir $outdir/baseline/IGA_IGG_IGM
470 if [[ $(wc -l < $outdir/new_IMGT/1_Summary.txt) -gt "1" ]]; then 400 if [[ "$(count_imgt_lines $outdir/new_IMGT.txz)" -gt "1" ]]; then
471 cd $outdir/baseline/IGA_IGG_IGM 401 cd $outdir/baseline/IGA_IGG_IGM
472 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT.txz "IGA_IGG_IGM_IGE" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline.pdf" "Sequence.ID" "$outdir/baseline.txt" 402 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT.txz "IGA_IGG_IGM_IGE" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline.pdf" "Sequence.ID" "$outdir/baseline.txt"
473 else 403 else
474 echo "No sequences" > "$outdir/baseline.txt" 404 echo "No sequences" > "$outdir/baseline.txt"
475 fi 405 fi
476 406
477 mkdir $outdir/baseline/IGA 407 mkdir $outdir/baseline/IGA
478 if [[ $(wc -l < $outdir/new_IMGT_IGA/1_Summary.txt) -gt "1" ]]; then 408 if [[ "$(count_imgt_lines $outdir/new_IMGT_IGA.txz)" -gt "1" ]]; then
479 cd $outdir/baseline/IGA 409 cd $outdir/baseline/IGA
480 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT_IGA.txz "IGA" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline_IGA.pdf" "Sequence.ID" "$outdir/baseline_IGA.txt" 410 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT_IGA.txz "IGA" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline_IGA.pdf" "Sequence.ID" "$outdir/baseline_IGA.txt"
481 else 411 else
482 echo "No IGA sequences" > "$outdir/baseline_IGA.txt" 412 echo "No IGA sequences" > "$outdir/baseline_IGA.txt"
483 fi 413 fi
484 414
485 mkdir $outdir/baseline/IGG 415 mkdir $outdir/baseline/IGG
486 if [[ $(wc -l < $outdir/new_IMGT_IGG/1_Summary.txt) -gt "1" ]]; then 416 if [[ "$(count_imgt_lines $outdir/new_IMGT_IGG.txz)" -gt "1" ]]; then
487 cd $outdir/baseline/IGG 417 cd $outdir/baseline/IGG
488 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT_IGG.txz "IGG" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline_IGG.pdf" "Sequence.ID" "$outdir/baseline_IGG.txt" 418 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT_IGG.txz "IGG" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline_IGG.pdf" "Sequence.ID" "$outdir/baseline_IGG.txt"
489 else 419 else
490 echo "No IGG sequences" > "$outdir/baseline_IGG.txt" 420 echo "No IGG sequences" > "$outdir/baseline_IGG.txt"
491 fi 421 fi
492 422
493 mkdir $outdir/baseline/IGM 423 mkdir $outdir/baseline/IGM
494 if [[ $(wc -l < $outdir/new_IMGT_IGM/1_Summary.txt) -gt "1" ]]; then 424 if [[ "$(count_imgt_lines $outdir/new_IMGT_IGM.txz)" -gt "1" ]]; then
495 cd $outdir/baseline/IGM 425 cd $outdir/baseline/IGM
496 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT_IGM.txz "IGM" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline_IGM.pdf" "Sequence.ID" "$outdir/baseline_IGM.txt" 426 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT_IGM.txz "IGM" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline_IGM.pdf" "Sequence.ID" "$outdir/baseline_IGM.txt"
497 else 427 else
498 echo "No IGM sequences" > "$outdir/baseline_IGM.txt" 428 echo "No IGM sequences" > "$outdir/baseline_IGM.txt"
499 fi 429 fi
500 430
501 mkdir $outdir/baseline/IGE 431 mkdir $outdir/baseline/IGE
502 if [[ $(wc -l < $outdir/new_IMGT_IGE/1_Summary.txt) -gt "1" ]]; then 432 if [[ "$(count_imgt_lines $outdir/new_IMGT_IGE.txz)" -gt "1" ]]; then
503 cd $outdir/baseline/IGE 433 cd $outdir/baseline/IGE
504 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT_IGE.txz "IGE" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline_IGE.pdf" "Sequence.ID" "$outdir/baseline_IGE.txt" 434 bash $dir/baseline/wrapper.sh 1 1 1 1 0 0 "${baseline_boundaries}" $outdir/new_IMGT_IGE.txz "IGE" "$dir/baseline/IMGTVHreferencedataset20161215.fa" "$outdir/baseline_IGE.pdf" "Sequence.ID" "$outdir/baseline_IGE.txt"
505 else 435 else
506 echo "No IGE sequences" > "$outdir/baseline_IGE.txt" 436 echo "No IGE sequences" > "$outdir/baseline_IGE.txt"
507 fi 437 fi
570 500
571 bash $dir/change_o/makedb.sh $outdir/new_IMGT.txz false false false $outdir/change_o/change-o-db.txt 501 bash $dir/change_o/makedb.sh $outdir/new_IMGT.txz false false false $outdir/change_o/change-o-db.txt
572 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 502 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
573 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones.txt $outdir/change_o/change-o-db-defined_first_clones.txt 2>&1 503 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones.txt $outdir/change_o/change-o-db-defined_first_clones.txt 2>&1
574 504
575 mkdir $outdir/new_IMGT_changeo 505 python $dir/split_imgt_file.py --outdir $outdir --prefix new_IMGT_first_seq_of_clone \
576 cp $outdir/new_IMGT/* $outdir/new_IMGT_changeo 506 $outdir/new_IMGT.txz $outdir/change_o/change-o-db-defined_first_clones.txt \
577 507 "-"
578 Rscript $dir/new_imgt.r $outdir/new_IMGT_changeo $outdir/change_o/change-o-db-defined_first_clones.txt "-" 2>&1 508
579
580 cd $outdir/new_IMGT_changeo
581 tar -cJf ../new_IMGT_first_seq_of_clone.txz *
582 cd $outdir/change_o
583
584 rm -rf $outdir/new_IMGT_changeo
585
586 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 509 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
587 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" 510 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"
588 511
589 if [[ $(wc -l < $outdir/new_IMGT_IGA/1_Summary.txt) -gt "1" ]]; then 512 if [[ "$(count_imgt_lines $outdir/new_IMGT_IGA.txz)" -gt "1" ]]; then
590 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGA.txz false false false $outdir/change_o/change-o-db-IGA.txt 513 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGA.txz false false false $outdir/change_o/change-o-db-IGA.txt
591 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 514 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
592 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones-IGA.txt $outdir/change_o/change-o-db-defined_first_clones-IGA.txt 2>&1 515 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones-IGA.txt $outdir/change_o/change-o-db-defined_first_clones-IGA.txt 2>&1
593 516
594 mkdir $outdir/new_IMGT_IGA_changeo 517 python $dir/split_imgt_file.py --outdir $outdir --prefix new_IMGT_IGA_first_seq_of_clone \
595 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGA_changeo 518 $outdir/new_IMGT.txz $outdir/change_o/change-o-db-defined_first_clones-IGA.txt \
596 519 "-"
597 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGA_changeo $outdir/change_o/change-o-db-defined_first_clones-IGA.txt "-" 2>&1 520
598
599 cd $outdir/new_IMGT_IGA_changeo
600 tar -cJf ../new_IMGT_IGA_first_seq_of_clone.txz *
601
602 rm -rf $outdir/new_IMGT_IGA_changeo
603
604 cd $outdir/change_o
605 else 521 else
606 echo "No IGA sequences" > "$outdir/change_o/change-o-db-defined_clones-IGA.txt" 522 echo "No IGA sequences" > "$outdir/change_o/change-o-db-defined_clones-IGA.txt"
607 echo "No IGA sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGA.txt" 523 echo "No IGA sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGA.txt"
608 fi 524 fi
609 525
610 if [[ $(wc -l < $outdir/new_IMGT_IGG/1_Summary.txt) -gt "1" ]]; then 526 if [[ "$(count_imgt_lines $outdir/new_IMGT_IGG.txz)" -gt "1" ]]; then
611 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGG.txz false false false $outdir/change_o/change-o-db-IGG.txt 527 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGG.txz false false false $outdir/change_o/change-o-db-IGG.txt
612 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 528 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
613 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones-IGG.txt $outdir/change_o/change-o-db-defined_first_clones-IGG.txt 2>&1 529 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones-IGG.txt $outdir/change_o/change-o-db-defined_first_clones-IGG.txt 2>&1
614 530
615 mkdir $outdir/new_IMGT_IGG_changeo 531 python $dir/split_imgt_file.py --outdir $outdir --prefix new_IMGT_IGG_first_seq_of_clone \
616 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGG_changeo 532 $outdir/new_IMGT.txz $outdir/change_o/change-o-db-defined_first_clones-IGG.txt \
617 533 "-"
618 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGG_changeo $outdir/change_o/change-o-db-defined_first_clones-IGG.txt "-" 2>&1 534
619
620 cd $outdir/new_IMGT_IGG_changeo
621 tar -cJf ../new_IMGT_IGG_first_seq_of_clone.txz *
622 rm -rf $outdir/new_IMGT_IGG_changeo
623
624 cd $outdir/change_o
625 else 535 else
626 echo "No IGG sequences" > "$outdir/change_o/change-o-db-defined_clones-IGG.txt" 536 echo "No IGG sequences" > "$outdir/change_o/change-o-db-defined_clones-IGG.txt"
627 echo "No IGG sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGG.txt" 537 echo "No IGG sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGG.txt"
628 fi 538 fi
629 539
630 if [[ $(wc -l < $outdir/new_IMGT_IGM/1_Summary.txt) -gt "1" ]]; then 540 if [[ "$(count_imgt_lines $outdir/new_IMGT_IGM.txz)" -gt "1" ]]; then
631 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGM.txz false false false $outdir/change_o/change-o-db-IGM.txt 541 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGM.txz false false false $outdir/change_o/change-o-db-IGM.txt
632 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 542 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
633 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones-IGM.txt $outdir/change_o/change-o-db-defined_first_clones-IGM.txt 2>&1 543 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones-IGM.txt $outdir/change_o/change-o-db-defined_first_clones-IGM.txt 2>&1
634 544
635 mkdir $outdir/new_IMGT_IGM_changeo 545 python $dir/split_imgt_file.py --outdir $outdir --prefix new_IMGT_IGM_first_seq_of_clone \
636 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGM_changeo 546 $outdir/new_IMGT.txz $outdir/change_o/change-o-db-defined_first_clones-IGM.txt \
637 547 "-"
638 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGM_changeo $outdir/change_o/change-o-db-defined_first_clones-IGM.txt "-" 2>&1 548
639
640 cd $outdir/new_IMGT_IGM_changeo
641 tar -cJf ../new_IMGT_IGM_first_seq_of_clone.txz *
642
643 rm -rf $outdir/new_IMGT_IGM_changeo
644
645 cd $outdir/change_o
646 else 549 else
647 echo "No IGM sequences" > "$outdir/change_o/change-o-db-defined_clones-IGM.txt" 550 echo "No IGM sequences" > "$outdir/change_o/change-o-db-defined_clones-IGM.txt"
648 echo "No IGM sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGM.txt" 551 echo "No IGM sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGM.txt"
649 fi 552 fi
650 553
651 if [[ $(wc -l < $outdir/new_IMGT_IGE/1_Summary.txt) -gt "1" ]]; then 554 if [[ "$(count_imgt_lines $outdir/new_IMGT_IGE.txz)" -gt "1" ]]; then
652 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGE.txz false false false $outdir/change_o/change-o-db-IGE.txt 555 bash $dir/change_o/makedb.sh $outdir/new_IMGT_IGE.txz false false false $outdir/change_o/change-o-db-IGE.txt
653 bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db-IGE.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones-IGE.txt $outdir/change_o/change-o-defined_clones-summary-IGE.txt 556 bash $dir/change_o/define_clones.sh bygroup $outdir/change_o/change-o-db-IGE.txt gene first ham none min complete 3.0 $outdir/change_o/change-o-db-defined_clones-IGE.txt $outdir/change_o/change-o-defined_clones-summary-IGE.txt
654 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones-IGE.txt $outdir/change_o/change-o-db-defined_first_clones-IGE.txt 2>&1 557 Rscript $dir/change_o/select_first_in_clone.r $outdir/change_o/change-o-db-defined_clones-IGE.txt $outdir/change_o/change-o-db-defined_first_clones-IGE.txt 2>&1
655 558
656 mkdir $outdir/new_IMGT_IGE_changeo 559 python $dir/split_imgt_file.py --outdir $outdir --prefix new_IMGT_IGE_first_seq_of_clone \
657 cp $outdir/new_IMGT/* $outdir/new_IMGT_IGE_changeo 560 $outdir/new_IMGT.txz $outdir/change_o/change-o-db-defined_first_clones-IGE.txt \
658 561 "-"
659 Rscript $dir/new_imgt.r $outdir/new_IMGT_IGE_changeo $outdir/change_o/change-o-db-defined_first_clones-IGE.txt "-" 2>&1 562
660
661 cd $outdir/new_IMGT_IGE_changeo
662 tar -cJf ../new_IMGT_IGE_first_seq_of_clone.txz *
663
664 rm -rf $outdir/new_IMGT_IGE_changeo
665
666 cd $outdir/change_o
667 else 563 else
668 echo "No IGE sequences" > "$outdir/change_o/change-o-db-defined_clones-IGE.txt" 564 echo "No IGE sequences" > "$outdir/change_o/change-o-db-defined_clones-IGE.txt"
669 echo "No IGE sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGE.txt" 565 echo "No IGE sequences" > "$outdir/change_o/change-o-defined_clones-summary-IGE.txt"
670 fi 566 fi
671 567
672 cd "$tmp" 568 cd "$tmp"
673
674 rm -rf $outdir/new_IMGT
675 rm -rf $outdir/new_IMGT_IGA/
676 rm -rf $outdir/new_IMGT_IGA1/
677 rm -rf $outdir/new_IMGT_IGA2/
678 rm -rf $outdir/new_IMGT_IGG/
679 rm -rf $outdir/new_IMGT_IGG1/
680 rm -rf $outdir/new_IMGT_IGG2/
681 rm -rf $outdir/new_IMGT_IGG3/
682 rm -rf $outdir/new_IMGT_IGG4/
683 rm -rf $outdir/new_IMGT_IGM/
684 rm -rf $outdir/new_IMGT_IGE/
685 569
686 echo "<div class='tabbertab' title='Clonal Relation' style='width: 7000px;'>" >> $output #clonality tab 570 echo "<div class='tabbertab' title='Clonal Relation' style='width: 7000px;'>" >> $output #clonality tab
687 571
688 function clonality_table { 572 function clonality_table {
689 local infile=$1 573 local infile=$1
858 echo "<tr><td>An IMGT archive with just the matched and filtered IGG2 sequences</td><td><a href='new_IMGT_IGG2.txz' download='new_IMGT_IGG2.txz' >Download</a></td></tr>" >> $output 742 echo "<tr><td>An IMGT archive with just the matched and filtered IGG2 sequences</td><td><a href='new_IMGT_IGG2.txz' download='new_IMGT_IGG2.txz' >Download</a></td></tr>" >> $output
859 echo "<tr><td>An IMGT archive with just the matched and filtered IGG3 sequences</td><td><a href='new_IMGT_IGG3.txz' download='new_IMGT_IGG3.txz' >Download</a></td></tr>" >> $output 743 echo "<tr><td>An IMGT archive with just the matched and filtered IGG3 sequences</td><td><a href='new_IMGT_IGG3.txz' download='new_IMGT_IGG3.txz' >Download</a></td></tr>" >> $output
860 echo "<tr><td>An IMGT archive with just the matched and filtered IGG4 sequences</td><td><a href='new_IMGT_IGG4.txz' download='new_IMGT_IGG4.txz' >Download</a></td></tr>" >> $output 744 echo "<tr><td>An IMGT archive with just the matched and filtered IGG4 sequences</td><td><a href='new_IMGT_IGG4.txz' download='new_IMGT_IGG4.txz' >Download</a></td></tr>" >> $output
861 echo "<tr><td>An IMGT archive with just the matched and filtered IGM sequences</td><td><a href='new_IMGT_IGM.txz' download='new_IMGT_IGM.txz' >Download</a></td></tr>" >> $output 745 echo "<tr><td>An IMGT archive with just the matched and filtered IGM sequences</td><td><a href='new_IMGT_IGM.txz' download='new_IMGT_IGM.txz' >Download</a></td></tr>" >> $output
862 echo "<tr><td>An IMGT archive with just the matched and filtered IGE sequences</td><td><a href='new_IMGT_IGE.txz' download='new_IMGT_IGE.txz' >Download</a></td></tr>" >> $output 746 echo "<tr><td>An IMGT archive with just the matched and filtered IGE sequences</td><td><a href='new_IMGT_IGE.txz' download='new_IMGT_IGE.txz' >Download</a></td></tr>" >> $output
863 747 echo "<tr><td>An IMGT archive with just the matched and filtered naive IGM sequences (mutations below 2%)</td><td><a href='new_IMGT_IGM_NAIVE.txz' download='new_IMGT_IGM_NAIVE.txz' >Download</a></td></tr>" >> $output
748 echo "<tr><td>An IMGT archive with just the matched and filtered naive memory IGM sequences (mutations 2% or higher)</td><td><a href='new_IMGT_IGM_NAIVE_MEMORY.txz' download='new_IMGT_IGM_NAIVE_MEMORY.txz' >Download</a></td></tr>" >> $output
864 echo "</table>" >> $output 749 echo "</table>" >> $output
865 750
866 echo "<br />" >> $output 751 echo "<br />" >> $output
867 cat $dir/shm_downloads.htm >> $output 752 cat $dir/shm_downloads.htm >> $output
868 753