clusterExecution.sh 1008 Bytes
Newer Older
Philipp Spohr's avatar
Philipp Spohr committed
1
2
3
4
5
6
#!/bin/bash

module load Singularity/3.5.2
module load Miniconda/3_snakemake
module load Snakemake/5.10.0

Jan Hoeckesfeld's avatar
Jan Hoeckesfeld committed
7
8
export SINGULARITY_CACHEDIR=/tmp/.singularity-$(id -u)

Philipp Spohr's avatar
Philipp Spohr committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
while getopts "p:j:" opt
do
   case $opt in
       p) projectID="$OPTARG" ;;
       j) maxNrOfConcurrentJobs="$OPTARG" ;;
   esac
done

if [ -z "$projectID" ] || [ -z "$maxNrOfConcurrentJobs" ] #|| [ -z "$reportFile" ]
then
   echo "Usage: clusterExecution -p projectID -j maxNrOfConcurrentJobs -r reportFile"
   exit 1
fi

mkdir -p clusterLogs

type snakemake >/dev/null 2>&1 || { echo >&2 "I require snakemake but it's not installed or added to your path.  Aborting..."; exit 1; }

Jan Hoeckesfeld's avatar
Jan Hoeckesfeld committed
27
snakemake --jobs $maxNrOfConcurrentJobs --use-singularity --use-conda --reason --jobscript cluster/jobscript.sh --cluster "qsub -e clusterLogs/{rule}.{wildcards}.{jobid}.errors -o clusterLogs/{rule}.{wildcards}.{jobid}.output -A ${projectID} -l select=1:ncpus={params.cpus}:ngpus={params.gpus}:mem={params.mem} -l walltime={params.walltime}" --restart-times 3
Philipp Spohr's avatar
Philipp Spohr committed
28