annotate imgt_loader/imgt_loader.sh @ 3:beaa487ecf43 draft

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