-
Notifications
You must be signed in to change notification settings - Fork 5
/
abricate-toxinotype.sh
78 lines (68 loc) · 2.68 KB
/
abricate-toxinotype.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# This script uses Abricate-0.8.11 with custom database for C. perfringens toxins to assign toxinotypes to C. perfringens genomes.
#!/bin/bash
# Raymond Kiu Raymond.Kiu@quadram.ac.uk
#print the options
usage () {
echo ""
echo "This bash script assigns toxinotypes to C. perfringens genome assemblies using ABRicate v1.0.1 (type will be shown on stdout)"
echo "Dependency: ABRicate v1.0.1 with toxinCP database"
echo ""
echo "Usage: $0 [options] FASTAFILE"
echo "Option:"
echo " -h print usage and exit"
echo " -a print author and exit"
echo " -v print version and exit"
echo ""
echo "Version 1.1"
echo "Author: Raymond Kiu Raymond.Kiu@quadram.ac.uk (2020)"
echo "";
}
version () { echo "version 1.1";}
author () { echo "Author: Raymond Kiu Raymond.Kiu@quadram.ac.uk";}
while getopts ':hav' opt;
do
case $opt in
h) usage; exit;;
a) author; exit;;
v) version; exit;;
\?) echo "Invalid option: -$OPTARG" >&2; exit 1;;
:) echo "Missing option argument for -$OPTARG" >&2; exit 1;;
*) echo "Unimplemented option: -$OPTARG" >&2; exit 1;;
esac
done
# skip over the processed options
shift $((OPTIND-1))
#check for mandatory positional parameters
if [ $# -lt 1 ]; then
echo ""
echo "This bash script assigns toxinotypes to C. perfringens genome assemblies using ABRicate v0.8.11"
echo "Dependency: ABRicate v0.8.11 with toxinCP database"
echo ""
echo "Usage: $0 [options] FASTAFILE"
echo "Option:"
echo " -h print usage and exit"
echo " -a print author and exit"
echo " -v print version and exit"
echo ""
echo "Version 1.1"
echo "Author: Raymond Kiu Raymond.Kiu@quadram.ac.uk (2020)"
echo "";
exit 1
fi
abricate --quiet --db toxinCP $1 |awk '{if($10>90 && $11>90)print $6}'|sort -u|grep -E -x 'plc|cpb|etx|iap|ibp|cpe|netB'|awk '{print}' ORS=''> $1-toxins
grep -E -x -c "plc" $1-toxins|awk '{if ($0==1) print "A"}'
grep -E -x -c "cpbetxplc" $1-toxins|awk '{if ($0==1) print "B"}'
grep -E -x -c "cpbplc" $1-toxins|awk '{if ($0==1) print "C"}'
grep -E -x -c "cpbcpeplc" $1-toxins|awk '{if ($0==1) print "C"}'
grep -E -x -c "etxplc" $1-toxins|awk '{if ($0==1) print "D"}'
grep -E -x -c "cpeetxplc" $1-toxins|awk '{if ($0==1) print "D"}'
grep -E -x -c "iapibpplc" $1-toxins|awk '{if ($0==1) print "E"}'
grep -E -x -c "cpeiapibpplc" $1-toxins|awk '{if ($0==1) print "E"}'
grep -E -x -c "iapplc" $1-toxins|awk '{if ($0==1) print "E"}'
grep -E -x -c "ibpplc" $1-toxins|awk '{if ($0==1) print "E"}'
grep -E -x -c "cpeiapplc" $1-toxins|awk '{if ($0==1) print "E"}'
grep -E -x -c "cpeibpplc" $1-toxins|awk '{if ($0==1) print "E"}'
grep -E -x -c "cpeplc" $1-toxins|awk '{if ($0==1) print "F"}'
grep -E -x -c "netBplc" $1-toxins|awk '{if ($0==1) print "G"}'
rm $1-toxins
exit 1;