annotate complete.sh @ 13:d3ebaa2d2fe0 draft

Uploaded
author davidvanzessen
date Tue, 20 Dec 2016 06:02:44 -0500
parents 54f6756bacb1
children d5d203d38c8a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
1 #!/bin/bash
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
2 set -e
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
3 inputFiles=($1)
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
4 outputDir=$3
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
5 outputFile=$3/index.html #$1
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
6 clonalType=$4
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
7 species=$5
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
8 locus=$6
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
9 filterproductive=$7
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
10 clonality_method=$8
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
11
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
12 html=$2
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
13 dir="$(cd "$(dirname "$0")" && pwd)"
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
14 array=("$@")
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
15 echo "<html><h3>Progress</h3><table><tr><td>info</td></tr>" > $html
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
16 echo "<tr><td>-----------------------------------</td></tr>" >> $html
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
17
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
18 #mkdir $PWD/igblastdatabase
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
19 #unzip $dir/database.zip -d $PWD/igblastdatabase/
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
20 #export IGDATA=$PWD/igblastdatabase/
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
21
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
22 id=""
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
23 forwardSlash="/"
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
24 mergerInput=()
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
25 echo "Before loop"
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
26 count=1
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
27 for current in "${inputFiles[@]}"
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
28 do
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
29 if [[ "$current" != *"$forwardSlash"* ]]; then
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
30 id="$current"
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
31 mergerInput+=($id)
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
32 count=1
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
33 continue
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
34 fi
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
35 echo "working on $current"
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
36 fileName=$(basename $current)
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
37 fileName="${fileName%.*}"
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
38 parsedFileName="$PWD/$fileName.parsed"
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
39 f=$(file $current)
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
40 zipType="Zip archive"
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
41 zxType="XZ compressed data"
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
42 if [[ "$f" == *"$zipType"* ]] || [[ "$f" == *"$zxType"* ]]
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
43 then
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
44 echo "<tr><td>Sample $count of patient $id is an archive file, using IMGT Loader</td></tr>" >> $html
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
45 fileName=$(basename $current)
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
46 bash ${dir}/imgt_loader/imgt_loader.sh $current $parsedFileName "${fileName}"
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
47 else
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
48 echo "<tr><td>Sample $count of patient $id is not a zip file so assuming fasta/fastq, using igBLASTn</td></tr>" >> $html
7
54f6756bacb1 Uploaded
davidvanzessen
parents: 0
diff changeset
49 bash ${dir}/igblast/igblast.sh $current "$species" $locus $parsedFileName
0
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
50 fi
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
51 mergerInput+=($parsedFileName)
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
52 count=$((count+1))
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
53 done
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
54
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
55 echo "<tr><td>-----------------------------------</td></tr>" >> $html
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
56 echo "<tr><td>merging</td></tr>" >> $html
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
57
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
58 bash $dir/experimental_design/experimental_design.sh ${mergerInput[*]} $PWD/merged.txt
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
59
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
60 echo "<tr><td>done</td></tr>" >> $html
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
61 echo "<tr><td>-----------------------------------</td></tr>" >> $html
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
62 echo "<tr><td>plotting</td></tr>" >> $html
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
63
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
64 echo "after ED"
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
65
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
66 bash $dir/report_clonality/r_wrapper.sh $PWD/merged.txt $2 $outputDir $clonalType "$species" "$locus" $filterproductive $clonality_method
afe85eb6572e Uploaded
davidvanzessen
parents:
diff changeset
67