Skip to content

Commit

Permalink
Merge pull request #111 from CCBR/redirect
Browse files Browse the repository at this point in the history
refactor: update bin/redirect from RENEE
  • Loading branch information
kelly-sovacool authored Aug 20, 2024
2 parents 5e5e382 + e65d1e2 commit 761cb61
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 32 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Increased memory for rules: BWA mem, qualimap, kraken. gatk_contamination is not localrule. (#89, @samarth8392)
- Added new human test dataset for github workflow (#27, @samarth8392)
- fixes minor bug in GUI related to choosing the correct default target file (#108, @samarth8392)
- Fix bug in the driver script that caused the snakemake module not to be loaded on biowulf in some cases. (#111, @kelly-sovacool)

## XAVIER 3.0.3

Expand Down
46 changes: 14 additions & 32 deletions bin/redirect
Original file line number Diff line number Diff line change
@@ -1,43 +1,26 @@
#!/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


function load_module_if_needed {
module_name=$1
x=$(type -P $module_name)
if [[ -z $x ]];then
module load $module_name
fi
}

SCRIPTNAME="$BASH_SOURCE"
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
nbiowulf=$(scontrol show config | grep -i -c biowulf)
if [[ "$nbiowulf" > 0 ]];then ISBIOWULF=true; else ISBIOWULF=false;fi
nfrce=$(scontrol show config | grep -i -c fsitgl)
if [[ "$nfrce" > 0 ]];then ISFRCE=true; else ISFRCE=false;fi

hpc_name=$(scontrol show config | grep ClusterName | sed "s/^.*= //")
# load conda
if [[ $ISBIOWULF == true ]];then
. "/data/CCBR_Pipeliner/db/PipeDB/Conda/etc/profile.d/conda.sh"
if [[ $hpc_name == biowulf ]]; then
. "/data/CCBR_Pipeliner/db/PipeDB/Conda/etc/profile.d/conda.sh"
conda activate py311
elif [[ $ISFRCE == true ]];then
. "/mnt/projects/CCBR-Pipelines/resources/miniconda3/etc/profile.d/conda.sh"
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"
Expand All @@ -55,13 +38,12 @@ fi
# - singularity
# - snakemake
# are in PATH
if [[ $ISBIOWULF == true ]];then
load_module_if_needed singularity
load_module_if_needed snakemake/7
elif [[ $ISFRCE == true ]];then
# snakemake module on FRCE does not work as expected
# use the conda installed version of snakemake instead
load_module_if_needed load singularity
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

Expand Down

0 comments on commit 761cb61

Please sign in to comment.