0
|
1 #!/bin/bash
|
5
|
2 set -e
|
1
|
3 inputFiles=($1)
|
|
4 outputDir=$3
|
|
5 outputFile=$3/index.html #$1
|
|
6 clonalType=$4
|
|
7 species=$5
|
|
8 locus=$6
|
|
9 selection=$7
|
|
10
|
|
11 html=$2
|
0
|
12 dir="$(cd "$(dirname "$0")" && pwd)"
|
|
13 array=("$@")
|
|
14 echo "<html><h3>Progress</h3><table><tr><td>info</td></tr>" > $html
|
|
15 echo "<tr><td>-----------------------------------</td></tr>" >> $html
|
|
16
|
|
17 mkdir $PWD/igblastdatabase
|
|
18 unzip $dir/database.zip -d $PWD/igblastdatabase/
|
|
19 export IGDATA=$PWD/igblastdatabase/
|
|
20
|
|
21 function blastAndParse {
|
|
22 echo "<tr><td>Starting blast of sample $3 of patient $2</td></tr>" >> $html
|
|
23 echo "igblastn -germline_db_V $PWD/igblastdatabase/database/human_gl_V -germline_db_J $PWD/igblastdatabase/database/human_gl_J -germline_db_D $PWD/igblastdatabase/database/human_gl_D -domain_system imgt -query $1 -auxiliary_data $PWD/igblastdatabase/optional_file/human_gl.aux -show_translation -outfmt 3 > $PWD/$4"
|
|
24 /home/galaxy/galaxy/igblast/igblastn -germline_db_V $PWD/igblastdatabase/database/human_gl_V -germline_db_J $PWD/igblastdatabase/database/human_gl_J -germline_db_D $PWD/igblastdatabase/database/human_gl_D -domain_system imgt -query $1 -auxiliary_data $PWD/igblastdatabase/optional_file/human_gl.aux -show_translation -outfmt 3 > $PWD/$4
|
|
25 echo "<tr><td>Finished blast of sample $3 of patient $2</td></tr>" >> $html
|
|
26
|
|
27 echo "<tr><td>Starting parse of sample $3 of patient $2</td></tr>" >> $html
|
1
|
28 perl $dir/igparse.pl $PWD/$4 0 | grep -v "D:" | cut -f2- > "$5"
|
0
|
29 echo "<tr><td>Finished parse of sample $3 of patient $2</td></tr>" >> $html
|
|
30 }
|
|
31
|
|
32 function imgtConvert {
|
|
33 echo "<tr><td>Starting imgt convert of sample $3 of patient $2</td></tr>" >> $html
|
5
|
34 bash $dir/imgt_loader.sh $1 $4 $5
|
0
|
35 echo "<tr><td>Finished conversion of sample $3 of patient $2</td></tr>" >> $html
|
|
36
|
|
37 }
|
|
38
|
1
|
39 id=""
|
0
|
40 forwardSlash="/"
|
|
41 mergerInput=()
|
1
|
42 echo "Before loop"
|
|
43 count=1
|
|
44 for current in "${inputFiles[@]}"
|
|
45 do
|
|
46 if [[ "$current" != *"$forwardSlash"* ]]; then
|
|
47 id="$current"
|
|
48 mergerInput+=($id)
|
|
49 count=1
|
|
50 continue
|
|
51 fi
|
|
52 echo "working on $current"
|
0
|
53 fileName=$(basename $current)
|
|
54 parsedFileName="${fileName%.*}"
|
|
55 parsedFileName="$PWD/$parsedFileName.parsed"
|
|
56 f=$(file $current)
|
|
57 zipType="Zip archive"
|
|
58 if [[ "$f" == *"$zipType"* ]]
|
|
59 then
|
|
60 echo "<tr><td>Sample $count of patient $id is a zip file, using IMGT Loader</td></tr>" >> $html
|
|
61 fileName=$(basename $current)
|
6
|
62 imgtConvert $current $id $count $parsedFileName "${id}_${count}" #&
|
0
|
63 else
|
|
64 echo "<tr><td>Sample $count of patient $id is not a zip file, using igBLASTn</td></tr>" >> $html
|
|
65 blastAndParse $current $id $count $fileName $parsedFileName &
|
|
66 fi
|
|
67 mergerInput+=($parsedFileName)
|
|
68 count=$((count+1))
|
|
69 done
|
|
70 wait
|
|
71
|
1
|
72 echo "after loop"
|
0
|
73
|
|
74 echo "<tr><td>-----------------------------------</td></tr>" >> $html
|
|
75 echo "<tr><td>merging</td></tr>" >> $html
|
|
76
|
5
|
77 python $dir/experimental_design.py ${mergerInput[*]} --output $PWD/merged.txt
|
0
|
78
|
|
79 echo "<tr><td>done</td></tr>" >> $html
|
|
80 echo "<tr><td>-----------------------------------</td></tr>" >> $html
|
|
81 echo "<tr><td>plotting</td></tr>" >> $html
|
|
82
|
5
|
83 echo "after ED"
|
|
84
|
1
|
85 if [ "$locus" == "igh" ] || [ "$locus" == "igk" ] || [ "$locus" == "igl" ]; then
|
|
86 bash $dir/r_wrapper_b.sh $PWD/merged.txt $2 $outputDir $clonalType $species $locus $selection
|
|
87 else
|
|
88 bash $dir/r_wrapper_t.sh $PWD/merged.txt $2 $outputDir $clonalType $species $locus $selection
|
|
89 fi
|
0
|
90
|
|
91
|
1
|
92
|
0
|
93
|
|
94
|
|
95
|
|
96
|
|
97
|
|
98
|