annotate complete.sh @ 56:7ae6b6b5d890 draft

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