diff --git a/carlisle b/carlisle index 0ecb92d..21ab605 100755 --- a/carlisle +++ b/carlisle @@ -66,6 +66,9 @@ function usage() { *) runlocal : run without submitting to sbatch *) runtest: run on cluster with included hg38 test dataset 2. WORKDIR: [Type: String]: Absolute or relative path to the output folder with write permissions. + + Optional Arguments: + *) -f / --force: Force flag will re-initialize a previously initialized workdir " } @@ -88,7 +91,9 @@ function init() { # 2. copying essential files like config.yaml and samples.tsv into the workdir # 3. setting up logs and stats folders # create output folder - if [ -d $WORKDIR ];then err "Folder $WORKDIR already exists!"; fi + if [[ -d $WORKDIR ]] && [[ -z $FORCEFLAG ]]; then + err "Folder $WORKDIR already exists! If you'd like to re-initialize use the -f/--force flag $FORCEFLAG|" + fi mkdir -p $WORKDIR # copy essential files @@ -384,6 +389,9 @@ function main(){ -w=*|--workdir=*) WORKDIR="${i#*=}" ;; + -f|--force) + FORCEFLAG="ON" + ;; -v|--version) get_version && exit 0 ;; diff --git a/docs/user-guide/run.md b/docs/user-guide/run.md index 3c203d0..1ce403e 100644 --- a/docs/user-guide/run.md +++ b/docs/user-guide/run.md @@ -20,6 +20,7 @@ The following explains each of the command options: - Preparation Commands - init (REQUIRED): This must be performed before any Snakemake run (dry, local, cluster) can be performed. This will copy the necessary config, manifest and Snakefiles needed to run the pipeline to the provided output directory. + - the -f/--force flag can be used in order to re-initialize a workdir that has already been created - dryrun (OPTIONAL): This is an optional step, to be performed before any Snakemake run (local, cluster). This will check for errors within the pipeline, and ensure that you have read/write access to the files needed to run the full pipeline. - Processing Commands - local: This will run the pipeline on a local node. NOTE: This should only be performed on an interactive node.