-
Notifications
You must be signed in to change notification settings - Fork 0
/
prokka_annot.sh
executable file
·63 lines (50 loc) · 1.15 KB
/
prokka_annot.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
#!/bin/bash
genomes="./"
cpus=35
out_dir="prokk_out"
display_help(){
echo "Usage: $0 -g <genomes_directory> -c <cpus> -o <output_directory>" #$0 is the name of the script
echo "Options:"
echo " -g Genomes directory to fasta files (default: ./)"
echo " -c Number of CPUs (default: 35)"
echo " -o Output directory (default: out_dir)"
exit 0
}
while getopts ":g:c:o:" opt
do
case $opt in
g)
genomes="$OPTARG"
;;
c)
cpus="$OPTARG"
;;
o)
out_dir="$OPTARG"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
if [ "$#" -eq 0 ]
then
display_help
fi
if [ ! -d "$out_dir" ]
then
mkdir -p "$out_dir"
fi
cpus=$(($cpus))
for file in $(ls "$genomes"/*.fasta)
do
striped="$(basename $file | cut -d'.' -f1)"
dest="${out_dir}"/"$striped"_prokka
#mkdir -p "$dest"
prokka --outdir "$dest" --prefix "$striped" "$file" --cpus "${cpus}"
done