-
Notifications
You must be signed in to change notification settings - Fork 0
/
quast.sh
executable file
·57 lines (47 loc) · 1.15 KB
/
quast.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
#!/bin/bash
# Copyright 2021 Anurag Priyam, Queen Mary University of London.
set -eo pipefail
usage() {
cat <<EOF
quast.sh --genome-size value --output-dir value assembly.fa
CompareGenomeQualities wrapper script for QUAST.
--help View this message
-o, --output-dir Output directory. Required.
-g, --genome-size Estimated genome size. Required.
EOF
exit
}
msg() {
echo >&2 -e "${1-}"
}
die() {
local msg=$1
local code=${2-1} # default exit status 1
msg "$msg"
exit "$code"
}
while :; do
case "${1-}" in
-h | --help) usage ;;
-g | --genome-size)
genome_size=${2}
shift 2
;;
-o | --output-dir)
output_dir=${2}
shift 2
;;
-?*) die "Unknown option: $1" ;;
*) break ;;
esac
done
assembly=$1
# If we did not get all the required parameters, print usage and exit.
[[ -z $genome_size || -z $output_dir || -z $assembly ]] && usage
# Check assembly file exists, is not-emptry, and readable.
if [[ ! -s ${assembly} || ! -r ${assembly} ]]; then
die "${assembly} doesn't exist, or is empty, or not readable"
fi
# Run quast.
quast --fast -t 1 -e -m 0 --est-ref-size ${genome_size} \
-o ${output_dir} ${assembly}