Skip to content

Commit

Permalink
refactor: update bin/redirect from xavier
Browse files Browse the repository at this point in the history
  • Loading branch information
kelly-sovacool committed Sep 10, 2024
1 parent b78a111 commit 96b5627
Showing 1 changed file with 34 additions and 23 deletions.
57 changes: 34 additions & 23 deletions bin/redirect
Original file line number Diff line number Diff line change
@@ -1,39 +1,50 @@
#!/usr/bin/env bash

# This is a wrapper for spook python script
# This is a wrapper for the pipeline script
# It:
# - loads require modules
# - loads require modules and conda environments
# - parses the variables directly to the python script

SCRIPTNAME="$0"
SCRIPTDIRNAME=$(readlink -f $(dirname "$SCRIPTNAME"))
SCRIPTDIRNAME=$(readlink -f $(dirname "$BASH_SOURCE"))

# add "bin" to PATH
if [[ ":$PATH:" != *":${SCRIPTDIRNAME}:"* ]];then
export PATH=${PATH}:${SCRIPTDIRNAME}
fi

TOOLDIR=$(dirname "$SCRIPTDIRNAME")
TOOLNAME=$(basename "$SCRIPTNAME")
echo $TOOLNAME

# find out if you are running on biowulf or frce
hpc_name=$(scontrol show config | grep ClusterName | sed "s/^.*= //")
# load conda
# if [[ "$HOSTNAME" == "biowulf.nih.gov" ]];then
# . "/data/CCBR_Pipeliner/db/PipeDB/Conda/etc/profile.d/conda.sh"
# elif [[ "$HOSTNAME" == "fsitgl-head01p.ncifcrf.gov" ]];then
# . "/mnt/projects/CCBR-Pipelines/resources/miniconda3/etc/profile.d/conda.sh"
# fi
# conda activate py311
if [[ $hpc_name == biowulf ]]; then
. "/data/CCBR_Pipeliner/db/PipeDB/Conda/etc/profile.d/conda.sh"
conda activate py311
elif [[ $hpc_name == fnlcr ]]; then
. "/mnt/projects/CCBR-Pipelines/resources/miniconda3/etc/profile.d/conda.sh"
conda activate py311
else
echo "You are NOT running on BIOWULF or on FRCE"
echo "Please make sure that:"
echo " - py311 conda environment is activated"
echo " - singularity is in PATH"
echo " - snakemake is in PATH"
fi
# if not on biowulf or frce then
# use py311.environment.yml in resources folder to create the py311 conda environment
# and load py311

# load required modules
# module purge
# module load singularity
# if [[ "$HOSTNAME" == "biowulf.nih.gov" ]];then
# module load snakemake
# elif [[ "$HOSTNAME" == "fsitgl-head01p.ncifcrf.gov" ]];then
# # snakemake module on FRCE does not work as expected
# # use the conda installed version of snakemake instead
# export PATH="/mnt/projects/CCBR-Pipelines/bin:$PATH"
# fi
# if running somewhere other than biowulf or frce, then ensure that
# - singularity
# - snakemake
# are in PATH
if [[ $hpc_name == biowulf ]];then
module load singularity snakemake/7
elif [[ $hpc_name == fnlcr ]];then
# snakemake module on FRCE does not work as expected
# use the conda installed version of snakemake instead
module load singularity
export PATH="/mnt/projects/CCBR-Pipelines/bin:$PATH"
fi

${TOOLDIR}/${TOOLNAME} "$@" || true
${TOOLDIR}/aspen "$@" || true

0 comments on commit 96b5627

Please sign in to comment.