From af612dba701b2ef43e9e9547306b12470bfe68b0 Mon Sep 17 00:00:00 2001 From: Ali Khan Date: Thu, 16 Jan 2025 17:21:57 -0500 Subject: [PATCH 1/2] replace mkdtemp() as default workdir with "work" was causing a number of issues because it was using /tmp and also a new folder for each run.. This makes it a subfolder of the output folder like it used to be, though we don't archive it up by default.. --- hippunfold/config/snakebids.yml | 8 ++++---- hippunfold/workflow/Snakefile | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hippunfold/config/snakebids.yml b/hippunfold/config/snakebids.yml index 5ac42e30..3047fe96 100644 --- a/hippunfold/config/snakebids.yml +++ b/hippunfold/config/snakebids.yml @@ -291,10 +291,10 @@ parse_args: --workdir: help: | - Folder for storing working files. If not specified, a temporary folder - will be made in your system's temp directory (e.g. /tmp). You can also - use environment variables when setting the workdir, e.g. --workdir '$SLURM_TMPDIR'. - default: null + Folder for storing working files. If not specified, will be in "work/" subfolder + in the output folder. You can also use environment variables when setting the + workdir, e.g. --workdir '$SLURM_TMPDIR'. + default: work type: str diff --git a/hippunfold/workflow/Snakefile b/hippunfold/workflow/Snakefile index 5cbfc74d..6f22980a 100644 --- a/hippunfold/workflow/Snakefile +++ b/hippunfold/workflow/Snakefile @@ -95,8 +95,6 @@ wildcard_constraints: template="[a-zA-Z0-9]+", -if config["workdir"] == None: - config["workdir"] = mkdtemp() work = os.path.expandvars(config["workdir"]) root = os.path.expandvars(config["root"]) From bbd4f64714354218965e0ef29e5f6de9dc26eb8c Mon Sep 17 00:00:00 2001 From: Ali Khan Date: Tue, 21 Jan 2025 15:50:20 -0500 Subject: [PATCH 2/2] bugfix for hippb500 workflow was broken in dev-v2.0.0, this makes some minor workflow updates (adding constraints, ruleorders) to unbreak it.. --- hippunfold/workflow/rules/common.smk | 4 +++- hippunfold/workflow/rules/gifti.smk | 2 +- hippunfold/workflow/rules/native_surf.smk | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hippunfold/workflow/rules/common.smk b/hippunfold/workflow/rules/common.smk index 5277ec98..90e6e9ef 100644 --- a/hippunfold/workflow/rules/common.smk +++ b/hippunfold/workflow/rules/common.smk @@ -272,6 +272,8 @@ def get_final_output(): if "corobl" in ref_spaces: + ruleorder: equivolume_coords > laplace_coords_hipp > laplace_coords_dentate > copy_coords_to_results + rule copy_coords_to_results: input: os.path.join(work, "{pre}_space-corobl_{post}{suffix}.{ext}"), @@ -284,7 +286,7 @@ if "corobl" in ref_spaces: rule copy_xfm_to_results: input: - os.path.join(work, "{pre}_{fromto,from|to}-corobl_{post}{suffix}.{ext}"), + os.path.join(work, "{pre}_{fromto}-corobl_{post}{suffix}.{ext}"), output: os.path.join( root, "{pre,[^/].+}_{fromto,from|to}-corobl_{post}{suffix,xfm}.{ext}" diff --git a/hippunfold/workflow/rules/gifti.smk b/hippunfold/workflow/rules/gifti.smk index 4c98a347..409168ac 100644 --- a/hippunfold/workflow/rules/gifti.smk +++ b/hippunfold/workflow/rules/gifti.smk @@ -187,7 +187,7 @@ rule affine_gii_to_native: datatype="surf", den="{density}", suffix="{surfname}.surf.gii", - space="{native_modality}", + space="{native_modality,T1w|T2w}", hemi="{hemi}", label="{autotop,hipp|dentate}", **inputs.subj_wildcards diff --git a/hippunfold/workflow/rules/native_surf.smk b/hippunfold/workflow/rules/native_surf.smk index a454ced1..c7c6271a 100644 --- a/hippunfold/workflow/rules/native_surf.smk +++ b/hippunfold/workflow/rules/native_surf.smk @@ -752,7 +752,7 @@ rule affine_gii_corobl_to_modality: root=root, datatype="surf", suffix="{surfname}.surf.gii", - space="{native_modality}", + space="{native_modality,T1w|T2w}", hemi="{hemi}", label="{autotop,hipp|dentate}", **inputs.subj_wildcards