comparison baseline/wrapper.sh @ 63:8728284105ee draft

Uploaded
author davidvanzessen
date Wed, 06 Dec 2017 08:04:52 -0500
parents c33d93683a09
children
comparison
equal deleted inserted replaced
62:aa8d37bd1930 63:8728284105ee
39 count=0 39 count=0
40 for current in ${inputs[@]} 40 for current in ${inputs[@]}
41 do 41 do
42 f=$(file $current) 42 f=$(file $current)
43 zipType="Zip archive" 43 zipType="Zip archive"
44 if [[ "$f" == *"$zipType"* ]] || [[ "$f" == *"XZ compressed data"* ]] 44 if [[ "$f" == *"Zip archive"* ]] || [[ "$f" == *"XZ compressed data"* ]]
45 then 45 then
46 id=${IDs[$count]} 46 id=${IDs[$count]}
47 echo "id=$id" 47 echo "id=$id"
48 if [[ "$f" == *"Zip archive"* ]] ; then 48 if [[ "$f" == *"Zip archive"* ]] ; then
49 echo "Zip archive" 49 echo "Zip archive"
53 echo "ZX archive" 53 echo "ZX archive"
54 echo "tar -xJf $input -C $PWD/files/" 54 echo "tar -xJf $input -C $PWD/files/"
55 mkdir -p "$PWD/$id/files" 55 mkdir -p "$PWD/$id/files"
56 tar -xJf $current -C "$PWD/$id/files/" 56 tar -xJf $current -C "$PWD/$id/files/"
57 fi 57 fi
58 summaryfile="$PWD/summary_${id}.txt"
59 gappedfile="$PWD/gappednt_${id}.txt"
60 filtered="$PWD/filtered_${id}.txt" 58 filtered="$PWD/filtered_${id}.txt"
61 filecount=`ls -l $PWD/$id/ | wc -l` 59 imgt_1_file="`find $PWD/$id -name '1_*.txt'`"
62 if [[ "$filecount" -eq "2" ]] 60 imgt_2_file="`find $PWD/$id -name '2_*.txt'`"
63 then 61 echo "1_Summary file: ${imgt_1_file}"
64 cat $PWD/$id/*/1_* > $summaryfile 62 echo "2_IMGT-gapped file: ${imgt_2_file}"
65 cat $PWD/$id/*/2_* > $gappedfile 63 echo "filter.r for $id"
66 else 64 Rscript $dir/filter.r ${imgt_1_file} ${imgt_2_file} "$selection" $filtered 2>&1
67 cat $PWD/$id/1_* > $summaryfile
68 cat $PWD/$id/2_* > $gappedfile
69 fi
70 Rscript $dir/filter.r $summaryfile $gappedfile "$selection" $filtered 2>&1
71 65
72 final="$PWD/final_${id}.txt" 66 final="$PWD/final_${id}.txt"
73 cat $filtered | cut -f2,4,7 > $final 67 cat $filtered | cut -f2,4,7 > $final
74 python $dir/script_imgt.py --input $final --ref $ref --output $fasta --id $id 68 python $dir/script_imgt.py --input $final --ref $ref --output $fasta --id $id
75 else 69 else
76 python $dir/script_xlsx.py --input $current --ref $ref --output $fasta 70 python $dir/script_xlsx.py --input $current --ref $ref --output $fasta
77 fi 71 fi
78 count=$((count+1)) 72 count=$((count+1))
79 done 73 done
80
81 if [[ $(wc -l < $fasta) -eq "1" ]]; then
82 echo "No sequences in the fasta file, exiting"
83 exit 0
84 fi
85
86 workdir="$PWD" 74 workdir="$PWD"
87 cd $dir 75 cd $dir
88 echo "file: ${inputs[0]}" 76 echo "file: ${inputs[0]}"
89 #Rscript --verbose $dir/Baseline_Main.r $testID $species $substitutionModel $mutabilityModel $clonal $fixIndels $region ${inputs[0]} $workdir/ $outID 2>&1 77 #Rscript --verbose $dir/Baseline_Main.r $testID $species $substitutionModel $mutabilityModel $clonal $fixIndels $region ${inputs[0]} $workdir/ $outID 2>&1
90 Rscript --verbose $dir/Baseline_Main.r $testID $species $substitutionModel $mutabilityModel $clonal $fixIndels $region $fasta $workdir/ $outID 2>&1 78 Rscript --verbose $dir/Baseline_Main.r $testID $species $substitutionModel $mutabilityModel $clonal $fixIndels $region $fasta $workdir/ $outID 2>&1