Mercurial > repos > davidvanzessen > baseline_bayesian_estimation
comparison wrapper.sh @ 2:94fada165724 draft
Uploaded
author | davidvanzessen |
---|---|
date | Wed, 13 Aug 2014 07:32:38 -0400 |
parents | e8dd8474aecb |
children | 38c038c17d0c |
comparison
equal
deleted
inserted
replaced
1:e8dd8474aecb | 2:94fada165724 |
---|---|
6 substitutionModel=$3 | 6 substitutionModel=$3 |
7 mutabilityModel=$4 | 7 mutabilityModel=$4 |
8 clonal=$5 | 8 clonal=$5 |
9 fixIndels=$6 | 9 fixIndels=$6 |
10 region=$7 | 10 region=$7 |
11 input=$8 | 11 inputs=$8 |
12 outDir=$9 | 12 inputs=($inputs) |
13 #mkdir $outDir | 13 IDs=$9 |
14 outID=${10} | 14 IDs=($IDs) |
15 outFile=${11} | 15 ref=${10} |
16 outFile2=${12} | 16 output=${11} |
17 outID="result" | |
18 | |
19 echo "testID = $testID" | |
20 echo "species = $species" | |
21 echo "substitutionModel = $substitutionModel" | |
22 echo "mutabilityModel = $mutabilityModel" | |
23 echo "clonal = $clonal" | |
24 echo "fixIndels = $fixIndels" | |
25 echo "region = $region" | |
26 echo "inputs = ${inputs[@]}" | |
27 echo "IDs = ${IDs[@]}" | |
28 echo "ref = $ref" | |
29 echo "output = $output" | |
30 echo "outID = $outID" | |
31 | |
32 fasta="$PWD/baseline.fasta" | |
33 | |
34 | |
35 count=0 | |
36 for current in ${inputs[@]} | |
37 do | |
38 f=$(file $current) | |
39 zipType="Zip archive" | |
40 if [[ "$f" == *"$zipType"* ]] | |
41 then | |
42 id=${IDs[$count]} | |
43 echo "id=$id" | |
44 unzip $current -d $PWD/$id/ >> $PWD/unziplog.log | |
45 filename="$PWD/gappednt_${id}.txt" | |
46 cat $PWD/$id/*/2_* | cut -f2,4,7 > $filename | |
47 python $dir/script_imgt.py --input $filename --ref $ref --output $fasta --id $id | |
48 else | |
49 python $dir/script_xlsx.py --input $current --ref $ref --output $fasta | |
50 fi | |
51 count=$((count+1)) | |
52 done | |
53 workdir="$PWD" | |
54 cd $dir | |
55 Rscript --verbose $dir/Baseline_Main.r $testID $species $substitutionModel $mutabilityModel $clonal $fixIndels $region $fasta $workdir/ $outID 2>&1 | |
56 | |
57 echo "$workdir/${outID}.txt" | |
58 | |
59 rows=`tail -n +2 $workdir/${outID}.txt | grep -n 'Group' | grep -Eoh '^[0-9]+' | tr '\n' ' '` | |
60 rows=($rows) | |
61 unset rows[${#rows[@]}-1] | |
17 | 62 |
18 cd $dir | 63 cd $dir |
19 Rscript --verbose $dir/Baseline_Main.r $testID $species $substitutionModel $mutabilityModel $clonal $fixIndels $region $input $dir/ $outID 2>&1 | 64 Rscript --verbose $dir/comparePDFs.r $workdir/${outID}.RData $output ${rows[@]} 2>&1 |
20 | 65 |
21 mv $dir/${outID}.txt $outFile | |
22 mv $dir/${outID}.RData $outFile2 | |
23 | 66 |
24 #tail -n+2 $outDir/${outID}.txt > $outDir/tmp.txt | |
25 #echo "<html><table border='1'><thead>" >> $outFile | |
26 #echo "<tr><th>Type</th><th>ID</th><th>Observed_CDR_R</th><th>Observed_CDR_S</th><th>Observed_FWR_R</th><th>Observed_FWR_S</th><th>Expected_CDR_R</th><th>Expected_CDR_S</th><th>Expected_FWR_R</th><th>Expected_FWR_S</th><th>Focused_Sigma_CDR</th><th>Focused_CIlower_CDR</th><th>Focused_CIupper_CDR</th><th>Focused_Sigma_FWR</th><th>Focused_CIlower_FWR</th><th>Focused_CIupper_FWR</th><th>Focused_P_CDR</th><th>Focused_P_FWR</th></tr></thead><tbody>" >> $outFile | |
27 #while read Type ID Observed_CDR_R Observed_CDR_S Observed_FWR_R Observed_FWR_S Expected_CDR_R Expected_CDR_S Expected_FWR_R Expected_FWR_S Focused_Sigma_CDR Focused_CIlower_CDR Focused_CIupper_CDR Focused_Sigma_FWR Focused_CIlower_FWR Focused_CIupper_FWR Focused_P_CDR Focused_P_FWR | |
28 #do | |
29 # echo "<tr><td>$Type</td><td>$ID</td><td>$Observed_CDR_R</td><td>$Observed_CDR_S</td><td>$Observed_FWR_R</td><td>$Observed_FWR_S</td><td>$Expected_CDR_R</td><td>$Expected_CDR_S</td><td>$Expected_FWR_R</td><td>$Expected_FWR_S</td><td>$Focused_Sigma_CDR</td><td>$Focused_CIlower_CDR</td><td>$Focused_CIupper_CDR</td><td>$Focused_Sigma_FWR</td><td>$Focused_CIlower_FWR</td><td>$Focused_CIupper_FWR</td><td>$Focused_P_CDR</td><td>$Focused_P_FWR</td></tr>" >> $outFile | |
30 #done < $outDir/tmp.txt | |
31 #echo "</tbody></table></html>" >> $outFile | |
32 #rm $outDir/tmp.txt | |
33 | 67 |
68 | |
69 |