-
Notifications
You must be signed in to change notification settings - Fork 9
/
runNEO_prepare
executable file
·82 lines (74 loc) · 2.38 KB
/
runNEO_prepare
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
#! /usr/bin/env bash
# Generate configure file before computation.
# input file and HLA must provide
####################################
### Parsing option using getopts ###
####################################
# i or --input: input maf (or vcf -> enhancement)path
# o or --output: output directory path
# --HLA: HLA file path
# --mode: maf or vcf ? -> enhancement
# --seq: workflow? -> enhancement
optspec=":hi:o:-:"
while getopts "$optspec" optchar; do
case "${optchar}" in
-)
case "${OPTARG}" in
loglevel)
val="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
echo "Parsing option: '--${OPTARG}', value: '${val}'" >&2;
;;
HLA)
val="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
echo "The HLA path is $val";
PATH_HLA=$val
;;
*)
if [ "$OPTERR" = 1 ] && [ "${optspec:0:1}" != ":" ]; then
echo "Unknown option --${OPTARG}" >&2
fi
;;
esac;;
h)
echo "usage: $0 [-i <input_file>] [-o <output_dir>] [--HLA <HLA_file>]" >&2
exit 2
;;
i)
echo "The input file path is $OPTARG"
maffiles=$OPTARG
;;
o)
echo "The output directory path is $OPTARG"
OUTPUT=$OPTARG
;;
*)
if [ "$OPTERR" != 1 ] || [ "${optspec:0:1}" = ":" ]; then
echo "Non-option argument: '-${OPTARG}'" >&2
exit 2
fi
;;
esac
done
# if variable name is not set, show help info
if [ ! -n "$maffiles" ]; then
runNEO_prepare -h
exit
fi
if [ ! -n "$OUTPUT" ]; then
OUTPUT=`pwd`
fi
if [ ! -n "$PATH_HLA" ]; then
runNEO_prepare -h
exit
fi
# generate a args file
echo "Configuration file generating..."
ShellDIR=$(cd `dirname $0`; pwd)
source $ShellDIR/configureArgs
cat $ShellDIR/configureArgs | grep -v "^##" | grep -v "ShellDIR" > $(pwd)/inputArgs.txt
echo "maffiles=$maffiles" >> $(pwd)/inputArgs.txt
echo "OUTPUT=$OUTPUT" >> $(pwd)/inputArgs.txt
echo "PATH_HLA=$PATH_HLA" >> $(pwd)/inputArgs.txt
echo "ShellDIR=$ShellDIR" >> $(pwd)/inputArgs.txt
echo "Configure file inputArgs.txt has been successfully generated in current directory."
echo "Please modify nessary arguments and run runNEO_run to start the pipeline."