Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getopt #114

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 53 additions & 5 deletions run_e2e_ver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,65 @@ unset __conda_setup
# <<< conda initialize <<<
############################################################

#############
# help output
#############

function print_usage {
cat <<EOF

Usage: run_e2e_ver.sh -f <input fasta> [-w <working dir>][-c <cpus>][-m <mem>][-d <db path>]

-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`

Expand Down Expand Up @@ -51,7 +100,6 @@ fi
############################################################
# 3. search for templates
############################################################
DB="$PIPEDIR/pdb100_2021Mar03/pdb100_2021Mar03"
if [ ! -s $WDIR/t000_.hhr ]
then
echo "Running hhsearch"
Expand Down
58 changes: 53 additions & 5 deletions run_pyrosetta_ver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,65 @@ unset __conda_setup
# <<< conda initialize <<<
############################################################

#############
# help output
#############

function print_usage {
cat <<EOF

Usage: run_e2e_ver.sh -f <input fasta> [-w <working dir>][-c <cpus>][-m <mem>][-d <db path>]

-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`

Expand Down Expand Up @@ -51,7 +100,6 @@ fi
############################################################
# 3. search for templates
############################################################
DB="$PIPEDIR/pdb100_2021Mar03/pdb100_2021Mar03"
if [ ! -s $WDIR/t000_.hhr ]
then
echo "Running hhsearch"
Expand Down