From 56cc736dc6a6c397a6cf5f761da9a1453528ab81 Mon Sep 17 00:00:00 2001 From: Ben Cronheim Date: Thu, 3 Mar 2022 14:24:23 -0500 Subject: [PATCH 1/3] Implement getopt for run_e2e_ver.sh --- run_e2e_ver.sh | 58 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/run_e2e_ver.sh b/run_e2e_ver.sh index 572b343..5edc0e5 100755 --- a/run_e2e_ver.sh +++ b/run_e2e_ver.sh @@ -12,16 +12,65 @@ unset __conda_setup # <<< conda initialize <<< ############################################################ +############# +# help output +############# + +function print_usage { +cat < [-w ][-c ][-m ] + + -f, --fasta Path to fasta input + -w, --wd Path to working directory (default: your current dir) + -c, --cpus CPU cores (default: 8) + -m, --mem Memory in Gigabytes (default: 64) + -d, --db Database directory (default: pdb100_2021Mar03/pdb100_2021Mar03 in script dir) + +EOF +exit 2 +} + +################ +# default values +################ + SCRIPT=`realpath -s $0` export PIPEDIR=`dirname $SCRIPT` - +WDIR=$(pwd) CPU="8" # number of CPUs to use MEM="64" # max memory (in GB) +DB="$PIPEDIR/pdb100_2021Mar03/pdb100_2021Mar03" + +################## +# argument parsing +################## + +PARSED_ARGUMENTS=$(getopt -a -n run_e2e_ver.sh -o f:w:c:m:d: --long fasta:,wdir:,cpus:,mem:,db: -- "$@") +if [ $? != 0 ]; then + print_usage +fi -# Inputs: -IN="$1" # input.fasta -WDIR=`realpath -s $2` # working folder +eval set -- "$PARSED_ARGUMENTS" +while : +do + case "$1" in + -f | --fasta) IN="$2" ; shift 2 ;; + -w | --wdir) WDIR="$2" ; shift 2 ;; + -c | --cpus) CPU="$2" ; shift 2 ;; + -m | --mem) MEM="$2" ; shift 2 ;; + -d | --db) DB="$2" ; shift 2;; + -h | --help) print_usage ;; + # -- means the end of the args; drop this and break out of the while loop + --) shift; break ;; + *) print_usage ;; + esac +done +if [ -z "$IN" ]; then + echo -e "\n-f|--fasta is a required option" + print_usage +fi LEN=`tail -n1 $IN | wc -m` @@ -51,7 +100,6 @@ fi ############################################################ # 3. search for templates ############################################################ -DB="$PIPEDIR/pdb100_2021Mar03/pdb100_2021Mar03" if [ ! -s $WDIR/t000_.hhr ] then echo "Running hhsearch" From 6971cf11d8b71e6e26385bfcf2402d7633eb9b80 Mon Sep 17 00:00:00 2001 From: Ben Cronheim Date: Thu, 3 Mar 2022 14:27:21 -0500 Subject: [PATCH 2/3] Implement getopt for run_pyrosetta_ver.sh --- run_pyrosetta_ver.sh | 58 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/run_pyrosetta_ver.sh b/run_pyrosetta_ver.sh index 53a6787..ca0d9a4 100755 --- a/run_pyrosetta_ver.sh +++ b/run_pyrosetta_ver.sh @@ -12,16 +12,65 @@ unset __conda_setup # <<< conda initialize <<< ############################################################ +############# +# help output +############# + +function print_usage { +cat < [-w ][-c ][-m ] + + -f, --fasta Path to fasta input + -w, --wd Path to working directory (default: your current dir) + -c, --cpus CPU cores (default: 8) + -m, --mem Memory in Gigabytes (default: 64) + -d, --db Database directory (default: pdb100_2021Mar03/pdb100_2021Mar03 in script dir) + +EOF +exit 2 +} + +################ +# default values +################ + SCRIPT=`realpath -s $0` export PIPEDIR=`dirname $SCRIPT` - +WDIR=$(pwd) CPU="8" # number of CPUs to use MEM="64" # max memory (in GB) +DB="$PIPEDIR/pdb100_2021Mar03/pdb100_2021Mar03" + +################## +# argument parsing +################## -# Inputs: -IN="$1" # input.fasta -WDIR=`realpath -s $2` # working folder +PARSED_ARGUMENTS=$(getopt -a -n run_e2e_ver.sh -o f:w:c:m:d: --long fasta:,wdir:,cpus:,mem:,db: -- "$@") +if [ $? != 0 ]; then + print_usage +fi +eval set -- "$PARSED_ARGUMENTS" +while : +do + case "$1" in + -f | --fasta) IN="$2" ; shift 2 ;; + -w | --wdir) WDIR="$2" ; shift 2 ;; + -c | --cpus) CPU="$2" ; shift 2 ;; + -m | --mem) MEM="$2" ; shift 2 ;; + -d | --db) DB="$2" ; shift 2;; + -h | --help) print_usage ;; + # -- means the end of the args; drop this and break out of the while loop + --) shift; break ;; + *) print_usage ;; + esac +done + +if [ -z "$IN" ]; then + echo -e "\n-f|--fasta is a required option" + print_usage +fi LEN=`tail -n1 $IN | wc -m` @@ -51,7 +100,6 @@ fi ############################################################ # 3. search for templates ############################################################ -DB="$PIPEDIR/pdb100_2021Mar03/pdb100_2021Mar03" if [ ! -s $WDIR/t000_.hhr ] then echo "Running hhsearch" From b372ea6ca64d977939f44893583dfab8ddf7ed87 Mon Sep 17 00:00:00 2001 From: Ben Cronheim Date: Thu, 3 Mar 2022 14:36:32 -0500 Subject: [PATCH 3/3] Add -d to Usage in help output --- run_e2e_ver.sh | 2 +- run_pyrosetta_ver.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/run_e2e_ver.sh b/run_e2e_ver.sh index 5edc0e5..02da945 100755 --- a/run_e2e_ver.sh +++ b/run_e2e_ver.sh @@ -19,7 +19,7 @@ unset __conda_setup function print_usage { cat < [-w ][-c ][-m ] +Usage: run_e2e_ver.sh -f [-w ][-c ][-m ][-d ] -f, --fasta Path to fasta input -w, --wd Path to working directory (default: your current dir) diff --git a/run_pyrosetta_ver.sh b/run_pyrosetta_ver.sh index ca0d9a4..5e99409 100755 --- a/run_pyrosetta_ver.sh +++ b/run_pyrosetta_ver.sh @@ -19,7 +19,7 @@ unset __conda_setup function print_usage { cat < [-w ][-c ][-m ] +Usage: run_e2e_ver.sh -f [-w ][-c ][-m ][-d ] -f, --fasta Path to fasta input -w, --wd Path to working directory (default: your current dir)