Skip to content

Commit 92a9b99

Browse files
authored
Merge pull request #8 from JDACS4C-IMPROVE/6-missing-preprocesssh
Added interface script for preprocessing
2 parents 4ef5532 + 694e8ba commit 92a9b99

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

preprocess.sh

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
3+
#########################################################################
4+
### THIS IS A TEMPLATE FILE. SUBSTITUTE #PATH# WITH THE MODEL EXECUTABLE.
5+
#########################################################################
6+
7+
# arg 1 CANDLE_DATA_DIR
8+
# arg 2 CANDLE_CONFIG
9+
10+
### Path and Name to your CANDLEized model's main Python script###
11+
12+
# e.g. CANDLE_MODEL=graphdrp_preprocess.py
13+
CANDLE_MODEL_SCRIPT=IGTD_preprocess_improve.py
14+
15+
# Set env if CANDLE_MODEL is not in same directory as this script
16+
IMPROVE_MODEL_DIR=${IMPROVE_MODEL_DIR:-$( dirname -- "$0" )}
17+
18+
# Combine path and name and check if executable exists
19+
CANDLE_MODEL=${IMPROVE_MODEL_DIR}/${CANDLE_MODEL_SCRIPT}
20+
if [ ! -f ${CANDLE_MODEL} ] ; then
21+
echo No such file ${CANDLE_MODEL}
22+
exit 404
23+
fi
24+
25+
26+
if [ $# -lt 2 ] ; then
27+
echo "Illegal number of parameters"
28+
echo "CANDLE_DATA_DIR PARAMS are required"
29+
exit -1
30+
fi
31+
32+
if [ $# -eq 2 ] ; then
33+
CANDLE_DATA_DIR=$1 ; shift
34+
35+
# if $2 is a file, then set candle_config
36+
if [ -f $CANDLE_DATA_DIR/$1 ] ; then
37+
CONFIG_FILE=$1 ; shift
38+
CMD="python ${CANDLE_MODEL} --config_file ${CONFIG_FILE}"
39+
else
40+
CMD="python ${CANDLE_MODEL} $@"
41+
echo "CMD = $CMD"
42+
fi
43+
44+
elif [ $# -ge 3 ] ; then
45+
46+
CANDLE_DATA_DIR=$1 ; shift
47+
48+
# if $2 is a file, then set candle_config
49+
if [ -f $CANDLE_DATA_DIR/$1 ] ; then
50+
echo "$1 is a file"
51+
CANDLE_CONFIG=$1 ; shift
52+
CMD="python ${CANDLE_MODEL} --config_file $CANDLE_CONFIG $@"
53+
echo "CMD = $CMD $@"
54+
55+
# else passthrough $@
56+
else
57+
echo "$1 is not a file"
58+
CMD="python ${CANDLE_MODEL} $@"
59+
echo "CMD = $CMD"
60+
61+
fi
62+
fi
63+
64+
# Display runtime arguments
65+
echo "using CANDLE_DATA_DIR ${CANDLE_DATA_DIR}"
66+
echo "using CANDLE_CONFIG ${CANDLE_CONFIG}"
67+
echo "running command ${CMD}"
68+
69+
# Set up environmental variables and execute model
70+
# source /opt/conda/bin/activate /usr/local/conda_envs/Paccmann_MCA
71+
CANDLE_DATA_DIR=${CANDLE_DATA_DIR} $CMD
72+

0 commit comments

Comments
 (0)