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