forked from wu-lab-uva/AMPHORA2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runAMPHORA2.sh
executable file
·79 lines (68 loc) · 1.87 KB
/
runAMPHORA2.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
#! /bin/bash -l
# Set the environment
module use /home/users/claczny/.local/resif/mysoftware/modules/all/
module use /work/projects/ecosystem_biology/local_tools/privatemodules/
module use /opt/apps/resif/devel/v1.0-20150402/lcsb/all/
module load AMPHORA2/parallelized3
# Check for command line args.
OPTIND=1 #reset for getopts
INFILE=""
CPUS=1
OUTDIR=""
DNA="-DNA"
function show_help { echo "Usage: `basename $0` -i <INFILE (fasta)> -o <OUTSUMMARY (tsv)> [mandatory] -d <OUTDIR> -c <CPUS> -p [optional]" >&2 ; exit 1; }
while getopts "h:?:d:c:i:o:p" opt; do
case "$opt" in
h|\?)
show_help
exit 0
;;
d) OUTDIR=${OPTARG}
;;
c) CPUS=${OPTARG}
;;
i) INFILE=${OPTARG}
;;
o) OUTSV=${OPTARG}
;;
p) DNA=""
;;
esac
done
if [ -z "${INFILE}" ] || [ -z "${CPUS}" ] || [ -z "${OUTSV}" ];
then
show_help
fi
CPUSTRING=""
if [ $CPUS -gt 1 ];
then
CPUSTRING="-CPUs ${CPUS}"
fi
#run commands: MarkerScanner MarkAlignTrim Phylotyping for fasta with bacterial dna, contig or genome
OLDIR=$PWD
if [ -z "$OUTDIR" ];
then
CMD="perl $AMPHORA2_home/Scripts/MarkerScanner.pl ${DNA} -Bacteria ${INFILE}"
echo ${CMD}
eval ${CMD}
CMD="perl $AMPHORA2_home/Scripts/MarkerAlignTrim.pl -WithReference ${CPUSTRING}"
echo ${CMD}
eval ${CMD}
CMD="perl $AMPHORA2_home/Scripts/Phylotyping.pl ${CPUSTRING} > ${OLDIR}/${OUTSV}"
echo ${CMD}
eval ${CMD}
else
CMD="perl $AMPHORA2_home/Scripts/MarkerScanner.pl ${DNA} -Bacteria -Outdir ${OUTDIR} ${INFILE}"
echo ${CMD}
eval ${CMD}
CMD="perl $AMPHORA2_home/Scripts/MarkerAlignTrim.pl -WithReference ${CPUSTRING} -Directory ${OUTDIR}"
echo ${CMD}
eval ${CMD}
echo "changing dir to ${OUTDIR}"
cd ${OUTDIR}
CMD="perl $AMPHORA2_home/Scripts/Phylotyping.pl ${CPUSTRING} > ${OLDIR}/${OUTSV}"
echo ${CMD}
eval ${CMD}
echo "changing dir to ${OLDIR}"
cd ${OLDIR}
fi