annotate imgt_loader/imgt_loader.sh @ 54:81b3eb11ed2c draft

"planemo upload commit 6c0195cc4de6a34e2c46d875be4fc2157a21cdf6"
author rhpvorderman
date Tue, 16 Nov 2021 15:42:32 +0000
parents 0ef7f80ea061
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 input=$1
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
3 output=$2
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
4 name=$3
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
5 dir="$(cd "$(dirname "$0")" && pwd)"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
6 mkdir -p $PWD/$name/files
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
7 f=$(file $input)
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
8 zip7Type="7-zip archive"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
9 tarType="tar archive"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
10 bzip2Type="bzip2 compressed"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
11 gzipType="gzip compressed"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
12 zipType="Zip archive"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
13 rarType="RAR archive"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
14 zxType="XZ compressed data"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
15
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
16 if [[ "$f" == *"$zip7Type"* ]]; then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
17 echo "7-zip"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
18 echo "Trying: 7za e $input -o$PWD/files/"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
19 7za e $input -o$PWD/$name/files
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
20 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
21
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
22 if [[ "$f" == *"$tarType"* ]]
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
23 then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
24 echo "tar archive"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
25 echo "Trying: tar xvf $input -C $PWD/files/"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
26 tar -xvf $input -C $PWD/$name/files
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
27 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
28
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
29 if [[ "$f" == *"$bzip2Type"* ]]
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
30 then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
31 echo "bzip2 compressed data"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
32 echo "Trying: tar jxf $input -C $PWD/files/"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
33 tar -jxf $input -C $PWD/$name/files
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
34 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
35
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
36 if [[ "$f" == *"$gzipType"* ]]
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
37 then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
38 echo "gzip compressed data"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
39 echo "Trying: tar xvzf $input -C $PWD/files/"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
40 tar -xvzf $input -C $PWD/$name/files
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
41 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
42
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
43 if [[ "$f" == *"$zipType"* ]]
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
44 then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
45 echo "Zip archive"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
46 echo "Trying: unzip $input -d $PWD/files/"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
47 unzip $input -d $PWD/$name/files > $PWD/unziplog.log
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
48 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
49
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
50 if [[ "$f" == *"$rarType"* ]]
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
51 then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
52 echo "RAR archive"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
53 echo "Trying: unrar e $input $PWD/files/"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
54 unrar e $input $PWD/$name/files
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
55 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
56
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
57 if [[ "$f" == *"$zxType"* ]]
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
58 then
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
59 echo "xz compressed data"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
60 echo "Trying: tar -xJf $input -C $PWD/files/"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
61 tar xJf $input -C $PWD/$name/files
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
62 fi
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
63 find $PWD/$name/files -iname "1_*" -exec cat {} + > $PWD/$name/summ.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
64 find $PWD/$name/files -iname "3_*" -exec cat {} + > $PWD/$name/sequences.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
65 find $PWD/$name/files -iname "4_*" -exec cat {} + > $PWD/$name/gapped_aa.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
66 find $PWD/$name/files -iname "5_*" -exec cat {} + > $PWD/$name/aa.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
67 find $PWD/$name/files -iname "6_*" -exec cat {} + > $PWD/$name/junction.txt
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
68
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
69 echo "summ.txt `cat $PWD/$name/summ.txt | wc -l`"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
70 echo "aa.txt `cat $PWD/$name/aa.txt | wc -l`"
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
71
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
72 #python $dir/imgt_loader.py --summ $PWD/$name/summ.txt --aa $PWD/$name/aa.txt --junction $PWD/$name/junction.txt --output $output
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
73
0ef7f80ea061 Uploaded
davidvanzessen
parents: 52
diff changeset
74 Rscript --verbose $dir/imgt_loader.r $PWD/$name/summ.txt $PWD/$name/sequences.txt $PWD/$name/aa.txt $PWD/$name/junction.txt $PWD/$name/gapped_aa.txt $output 2>&1