0
|
1 #!/bin/bash
|
|
2 dir="$(cd "$(dirname "$0")" && pwd)"
|
|
3
|
|
4 testID=$1
|
|
5 species=$2
|
|
6 substitutionModel=$3
|
|
7 mutabilityModel=$4
|
|
8 clonal=$5
|
|
9 fixIndels=$6
|
|
10 region=$7
|
2
|
11 inputs=$8
|
|
12 inputs=($inputs)
|
|
13 IDs=$9
|
|
14 IDs=($IDs)
|
|
15 ref=${10}
|
|
16 output=${11}
|
3
|
17 selection=${12}
|
2
|
18 outID="result"
|
|
19
|
|
20 echo "testID = $testID"
|
|
21 echo "species = $species"
|
|
22 echo "substitutionModel = $substitutionModel"
|
|
23 echo "mutabilityModel = $mutabilityModel"
|
|
24 echo "clonal = $clonal"
|
|
25 echo "fixIndels = $fixIndels"
|
|
26 echo "region = $region"
|
|
27 echo "inputs = ${inputs[@]}"
|
|
28 echo "IDs = ${IDs[@]}"
|
|
29 echo "ref = $ref"
|
|
30 echo "output = $output"
|
|
31 echo "outID = $outID"
|
|
32
|
|
33 fasta="$PWD/baseline.fasta"
|
|
34
|
|
35
|
|
36 count=0
|
|
37 for current in ${inputs[@]}
|
|
38 do
|
|
39 f=$(file $current)
|
|
40 zipType="Zip archive"
|
|
41 if [[ "$f" == *"$zipType"* ]]
|
|
42 then
|
|
43 id=${IDs[$count]}
|
|
44 echo "id=$id"
|
|
45 unzip $current -d $PWD/$id/ >> $PWD/unziplog.log
|
3
|
46 summaryfile="$PWD/summary_${id}.txt"
|
|
47 gappedfile="$PWD/gappednt_${id}.txt"
|
|
48 filtered="$PWD/filtered_${id}.txt"
|
|
49 cat $PWD/$id/*/1_* > $summaryfile
|
|
50 cat $PWD/$id/*/2_* > $gappedfile
|
|
51 Rscript $dir/filter.r $summaryfile $gappedfile "$selection" $filtered
|
|
52
|
|
53 final="$PWD/final_${id}.txt"
|
|
54 cat $filtered | cut -f2,4,7 > $final
|
|
55 python $dir/script_imgt.py --input $final --ref $ref --output $fasta --id $id
|
2
|
56 else
|
|
57 python $dir/script_xlsx.py --input $current --ref $ref --output $fasta
|
|
58 fi
|
|
59 count=$((count+1))
|
|
60 done
|
|
61 workdir="$PWD"
|
|
62 cd $dir
|
|
63 Rscript --verbose $dir/Baseline_Main.r $testID $species $substitutionModel $mutabilityModel $clonal $fixIndels $region $fasta $workdir/ $outID 2>&1
|
|
64
|
|
65 echo "$workdir/${outID}.txt"
|
|
66
|
|
67 rows=`tail -n +2 $workdir/${outID}.txt | grep -n 'Group' | grep -Eoh '^[0-9]+' | tr '\n' ' '`
|
|
68 rows=($rows)
|
|
69 unset rows[${#rows[@]}-1]
|
0
|
70
|
|
71 cd $dir
|
2
|
72 Rscript --verbose $dir/comparePDFs.r $workdir/${outID}.RData $output ${rows[@]} 2>&1
|
0
|
73
|
|
74
|
2
|
75
|
0
|
76
|
2
|
77
|