Mercurial > repos > davidvanzessen > combined_immune_repertoire_pipeline
comparison combined.sh @ 0:4e3df2384422 draft
Uploaded
author | davidvanzessen |
---|---|
date | Wed, 20 Nov 2013 10:00:28 -0500 |
parents | |
children | 9b2567a3ecc9 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4e3df2384422 |
---|---|
1 #!/bin/bash | |
2 | |
3 export IGDATA=/home/david/Galaxy/galaxy-dist/toolsheddependencies/igBlastn/1.0.0/davidvanzessen/igblast_human/1c64c977624e/ncbi-igblast-1.0.0/; | |
4 | |
5 html=${@:(-2):1} | |
6 imageDir=${@:(-1):1} | |
7 dir="$(cd "$(dirname "$0")" && pwd)" | |
8 fileCount=`expr $# - 2` | |
9 array=("$@") | |
10 echo "<html><h3>Progress</h3><table><tr><td>info</td></tr>" > $html | |
11 echo "<tr><td>-----------------------------------</td></tr>" >> $html | |
12 limit=`expr $fileCount / 2` | |
13 | |
14 function blastAndParse { | |
15 echo "<tr><td>Starting blast of $2</td></tr>" >> $html | |
16 fileName=$(basename $1) | |
17 $IGDATA/bin/igblastn -germline_db_V $IGDATA/database/human_gl_V -germline_db_J $IGDATA/database/human_gl_J -germline_db_D $IGDATA/database/human_gl_D -domain_system imgt -query $1 -auxiliary_data $IGDATA/optional_file/human_gl.aux -show_translation -outfmt 3 > $PWD/$fileName | |
18 echo "<tr><td>Finished blast of $2</td></tr>" >> $html | |
19 | |
20 echo "<tr><td>Starting parse of $2</td></tr>" >> $html | |
21 parsedFileName="${fileName%.*}" | |
22 parsedFileName="$parsedFileName.parsed" | |
23 perl $dir/igparse.pl $PWD/$fileName 0 | grep -v "D:" | cut -f2- > $parsedFileName | |
24 echo "<tr><td>Finished parse of $2</td></tr>" >> $html | |
25 } | |
26 | |
27 for ((i=0;i<$fileCount;i=$((i+2)))) | |
28 do | |
29 next=$((i+1)) | |
30 blastAndParse ${array[$i]} ${array[$next]} & | |
31 done | |
32 wait | |
33 | |
34 | |
35 | |
36 echo "<tr><td>-----------------------------------</td></tr>" >> $html | |
37 echo "<tr><td>merging</td></tr>" >> $html | |
38 | |
39 count=0 | |
40 for ((i=0;i<$fileCount;i=$((i+2)))) | |
41 do | |
42 id=$((i+1)) | |
43 place=$((count+limit)) | |
44 fn=$(basename ${array[$i]}) | |
45 fn="${fn%.*}" | |
46 mergeInputs[$count]="$PWD/$fn.parsed" | |
47 mergeIDs[$place]=${array[$id]} | |
48 count=$((count+1)) | |
49 done | |
50 | |
51 python $dir/igblastmerge.py --input ${mergeInputs[*]} --id ${mergeIDs[*]} --output $PWD/merged.txt | |
52 | |
53 echo "<tr><td>done</td></tr>" >> $html | |
54 echo "<tr><td>-----------------------------------</td></tr>" >> $html | |
55 echo "<tr><td>plotting</td></tr>" >> $html | |
56 | |
57 | |
58 inputFile=$PWD/merged.txt | |
59 outputFile=$html | |
60 outputDir=$imageDir | |
61 mkdir $outputDir | |
62 Rscript --verbose $dir/RScript.r $inputFile $outputDir $outputDir 2>&1 | |
63 echo "<html>" > $outputFile | |
64 echo "<img src='VPlot.png'/>" >> $outputFile | |
65 echo "<img src='DPlot.png'/>" >> $outputFile | |
66 echo "<img src='JPlot.png'/>" >> $outputFile | |
67 | |
68 samples=`cat $outputDir/samples.txt` | |
69 count=1 | |
70 echo "<table border='1'>" >> $outputFile | |
71 for sample in $samples; do | |
72 echo "<tr><td colspan='3' height='100'></td>" >> $outputFile | |
73 echo "<tr><td colspan='3'><h1>$sample</h1></td></tr>" >> $outputFile | |
74 echo "<tr><td><h2>V-D Heatmap:</h2></td><td><h2>V-J Heatmap:</h2></td><td><h2>D-J Heatmap:</h2></td></tr><tr>" >> $outputFile | |
75 mv "$outputDir/HeatmapVD_$sample.png" "$outputDir/VD_$sample.png" | |
76 echo "<td><img src='VD_$sample.png'/></td>" >> $outputFile | |
77 mv "$outputDir/HeatmapVJ_$sample.png" "$outputDir/VJ_$sample.png" | |
78 echo "<td><img src='VJ_$sample.png'/></td>" >> $outputFile | |
79 mv "$outputDir/HeatmapDJ_$sample.png" "$outputDir/DJ_$sample.png" | |
80 echo "<td><img src='DJ_$sample.png'/></td></tr>" >> $outputFile | |
81 count=$((count+1)) | |
82 done | |
83 echo "</table>" >> $outputFile | |
84 | |
85 echo "</html>" >> $2 | |
86 | |
87 | |
88 #r_wrapper.sh $in_file $out_file $out_file.files_path | |
89 | |
90 echo "<tr><td>done</td></tr>" >> $html |