annotate complete.sh @ 52:124b7fd92a3e draft

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