52
|
1 #!/bin/bash
|
|
2 set -e
|
|
3 inputFiles=($1)
|
|
4 outputDir=$3
|
|
5 outputFile=$3/index.html #$1
|
|
6 clonalType=$4
|
|
7 species=$5
|
|
8 locus=$6
|
|
9 filterproductive=$7
|
|
10 clonality_method=$8
|
|
11
|
|
12 html=$2
|
|
13 dir="$(cd "$(dirname "$0")" && pwd)"
|
|
14 array=("$@")
|
|
15 echo "<html><h3>Progress</h3><table><tr><td>info</td></tr>" > $html
|
|
16 echo "<tr><td>-----------------------------------</td></tr>" >> $html
|
|
17
|
|
18 #mkdir $PWD/igblastdatabase
|
|
19 #unzip $dir/database.zip -d $PWD/igblastdatabase/
|
|
20 #export IGDATA=$PWD/igblastdatabase/
|
|
21
|
|
22 echo "python: `which python`"
|
|
23 echo "R: `which R`"
|
|
24 echo "Rscript: `which Rscript`"
|
|
25
|
|
26 id=""
|
|
27 forwardSlash="/"
|
|
28 mergerInput=()
|
|
29 echo "Before loop"
|
|
30 count=1
|
|
31 for current in "${inputFiles[@]}"
|
|
32 do
|
|
33 if [[ "$current" != *"$forwardSlash"* ]]; then
|
|
34 id="$current"
|
|
35 mergerInput+=($id)
|
|
36 count=1
|
|
37 continue
|
|
38 fi
|
|
39 echo "working on $current"
|
|
40 fileName=$(basename $current)
|
|
41 fileName="${fileName%.*}"
|
|
42 parsedFileName="$PWD/$fileName.parsed"
|
|
43 f=$(file $current)
|
|
44 zipType="Zip archive"
|
|
45 zxType="XZ compressed data"
|
|
46 echo "filetype of ${id}: $f"
|
|
47 if [[ "$f" == *"$zipType"* ]] || [[ "$f" == *"$zxType"* ]]
|
|
48 then
|
|
49 echo "<tr><td>Sample $count of patient $id is an archive file, using IMGT Loader</td></tr>" >> $html
|
|
50 fileName=$(basename $current)
|
|
51 bash ${dir}/imgt_loader/imgt_loader.sh $current $parsedFileName "${fileName}"
|
|
52 else
|
|
53 echo "<tr><td>Sample $count of patient $id is not a zip file so assuming fasta/fastq, using igBLASTn</td></tr>" >> $html
|
|
54 bash ${dir}/igblast/igblast.sh $current "$species" $locus $parsedFileName
|
|
55 fi
|
|
56 mergerInput+=($parsedFileName)
|
|
57 count=$((count+1))
|
|
58 done
|
|
59
|
|
60 echo "<tr><td>-----------------------------------</td></tr>" >> $html
|
|
61 echo "<tr><td>merging</td></tr>" >> $html
|
|
62
|
|
63 bash $dir/experimental_design/experimental_design.sh ${mergerInput[*]} $PWD/merged.txt
|
|
64
|
|
65 echo "<tr><td>done</td></tr>" >> $html
|
|
66 echo "<tr><td>-----------------------------------</td></tr>" >> $html
|
|
67 echo "<tr><td>plotting</td></tr>" >> $html
|
|
68
|
|
69 echo "after ED"
|
|
70
|
|
71 bash $dir/report_clonality/r_wrapper.sh $PWD/merged.txt $2 $outputDir $clonalType "$species" "$locus" $filterproductive $clonality_method
|
|
72
|