/
ggMatch
executable file
·89 lines (73 loc) · 1.85 KB
/
ggMatch
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
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env bash
SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
configfile=""
threads="10"
sm_params=""
validate=0
action="matchedListToGraph compareToInitial"
function usage() {
echo "ggMatch - Greedy Gene Matching tool"
echo ""
echo " ggMatch [options] <configFile>"
echo ""
echo "Options"
echo " -t <int> : Number of threads to use (default: $threads)"
echo " -s <str> : Additional parameters for snakemake (default: \"\")"
echo " -a <str> : Snakemake action to perform (default \"$action\")"
echo " -p : Create a phylogeny. Requires "phylogeny_reference" to be set in configFile".
echo " -V : Perform a functional validation of the identified genes. Requires interproscan.sh to be in \$PATH."
echo " -v : Ony validate input. Don't run pipeline."
echo ""
echo " See code at https://github.com/thiesgehrmann/ggMatch"
}
while getopts ":t:s:pVa:v" opt; do
case $opt in
t)
threads=$OPTARG
;;
s)
sm_params="$OPTARG"
;;
p)
action="phylogeny"
;;
a)
action="$OPTARG"
;;
V)
action="validate"
;;
v)
validate=1
;;
\?)
echo "Invalid option: $OPTARG" >&2
exit 1
;;
:)
echo "Missing argument for option $OPTARG"
exit 1
;;
esac
done
for i in `seq $((OPTIND-1))`; do
shift
done
configfile="$1"
if [ ! -e "$configfile" ]; then
echo "Error: configFile missing"
usage
exit 1
fi
$SCRIPTDIR/pipeline_components/checkInput.py "$configfile" "$action"
if [ ! $? -eq 0 ]; then
echo "Aborting"
exit 1
fi
if [ $validate -eq 1 ]; then
exit 0
fi
logAction=`echo $action | tr ' ' ','`
md5sum=`md5sum "$configfile" | cut -d\ -f1`
logfile="./ggMatch.$action.$md5sum.log"
snakemake --nolock --use-conda --snakefile "$SCRIPTDIR/Snakefile" --configfile "$configfile" --cores "$threads" $sm_params $action