Skip to content

Commit

Permalink
[ENH] Add descriptors and sample invocations for BIDScoin (nipoppy#267)
Browse files Browse the repository at this point in the history
* add descriptors and sample invocations for BIDSCOIN

* rename descriptors

* expand on descriptions in Boutiques descriptors

* update BIDScoin config/descriptor to not use container (difficult because of GUI components)

* fix test
  • Loading branch information
michellewang authored Jul 11, 2024
1 parent 3dfdcb1 commit 2284c1b
Show file tree
Hide file tree
Showing 9 changed files with 306 additions and 1 deletion.
79 changes: 79 additions & 0 deletions nipoppy_cli/nipoppy/data/descriptors/bidscoiner-4.3.2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "bidscoiner",
"description": "bidscoiner (part of BIDScoin) to run BIDS conversion based on a YAML configuration file (bidsmap). See https://bidscoin.readthedocs.io/en/latest/workflow.html#step-2-running-the-bidscoiner",
"tool-version": "4.3.2+qt5",
"schema-version": "0.5",
"command-line": "bidscoiner [SOURCEFOLDER] [BIDSFOLDER] [PARTICIPANT_LABEL] [BIDSMAP] [FORCE] [CLUSTER] [NATIVESPEC]",
"inputs": [
{
"name": "sourcefolder",
"id": "sourcefolder",
"description": "The study root folder containing the raw source data",
"type": "String",
"optional": false,
"value-key": "[SOURCEFOLDER]"
},
{
"name": "bidsfolder",
"id": "bidsfolder",
"description": "The destination / output folder with the bids data",
"type": "String",
"optional": false,
"value-key": "[BIDSFOLDER]"
},
{
"name": "participant_label",
"id": "participant_label",
"description": "Space separated list of selected sub-# names / folders to be processed (the sub-prefix can be removed). Otherwise all subjects in the sourcefolder will be selected",
"type": "String",
"list": true,
"optional": true,
"command-line-flag": "-p",
"value-key": "[PARTICIPANT_LABEL]"
},
{
"name": "bidsmap",
"id": "bidsmap",
"description": "The study bidsmap file with the mapping heuristics. If the bidsmap filename is just the basename (i.e. no \"/\" in the name) then it is assumed to be located in the current directory or in bidsfolder/code/bidscoin. Default: bidsmap.yaml",
"type": "String",
"optional": true,
"default-value": "bidsmap.yaml",
"command-line-flag": "-b",
"value-key": "[BIDSMAP]"
},
{
"name": "force",
"id": "force",
"description": "Process all subjects, regardless of existing subject folders in the bidsfolder. Otherwise these subject folders will be skipped",
"type": "Flag",
"optional": true,
"command-line-flag": "-f",
"value-key": "[FORCE]"
},
{
"name": "cluster",
"id": "cluster",
"description": "Use the DRMAA library to submit the bidscoiner jobs to a high-performance compute (HPC) cluster",
"type": "Flag",
"optional": true,
"command-line-flag": "-c",
"value-key": "[CLUSTER]"
},
{
"name": "nativespec",
"id": "nativespec",
"description": "Opaque DRMAA argument with native specifications for submitting bidscoiner jobs to the HPC cluster. NB: Use quotes and include at least one space character to prevent premature parsing (default: -l walltime=00:30:00,mem=4gb)",
"type": "String",
"optional": true,
"default-value": "-l walltime=00:30:00,mem=4gb",
"command-line-flag": "-n",
"value-key": "[NATIVESPEC]"
}
],
"tags": {},
"suggested-resources": {
"cpu-cores": 1,
"ram": 1,
"walltime-estimate": 60
}
}
42 changes: 42 additions & 0 deletions nipoppy_cli/nipoppy/data/descriptors/bidseditor-4.3.2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "bidseditor",
"description": "bidseditor (part of BIDScoin) to edit an existing YAML configuration file (bidsmap). See https://bidscoin.readthedocs.io/en/latest/workflow.html#step-1b-running-the-bidseditor",
"tool-version": "4.3.2+qt5",
"schema-version": "0.5",
"command-line": "bidseditor [BIDSFOLDER] [BIDSMAP] [TEMPLATE]",
"inputs": [
{
"name": "bidsfolder",
"id": "bidsfolder",
"description": "The destination folder with the (future) bids data",
"type": "String",
"optional": false,
"value-key": "[BIDSFOLDER]"
},
{
"name": "bidsmap",
"id": "bidsmap",
"description": "The study bidsmap file with the mapping heuristics. If the bidsmap filename is just the basename (i.e. no \"/\" in the name) then it is assumed to be located in the current directory or in bidsfolder/code/bidscoin. Default: bidsmap.yaml",
"type": "String",
"optional": true,
"default-value": "bidsmap.yaml",
"command-line-flag": "-b",
"value-key": "[BIDSMAP]"
},
{
"name": "template",
"id": "template",
"description": "The template bidsmap file with the default heuristics (this could be provided by your institute). If the bidsmap filename is just the basename (i.e. no \"/\" in the name) then it is assumed to be located in the bidscoin config folder. Default: bidsmap_dccn",
"type": "String",
"optional": true,
"command-line-flag": "-t",
"value-key": "[TEMPLATE]"
}
],
"tags": {},
"suggested-resources": {
"cpu-cores": 1,
"ram": 1,
"walltime-estimate": 60
}
}
123 changes: 123 additions & 0 deletions nipoppy_cli/nipoppy/data/descriptors/bidsmapper-4.3.2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"name": "bidsmapper",
"description": "bidsmapper (part of BIDScoin) to create/edit a YAML configuration file (bidsmap). See https://bidscoin.readthedocs.io/en/latest/workflow.html#step-1a-running-the-bidsmapper",
"tool-version": "4.3.2+qt5",
"schema-version": "0.5",
"command-line": "bidsmapper [SOURCEFOLDER] [BIDSFOLDER] [BIDSMAP] [TEMPLATE] [PLUGINS] [SUBPREFIX] [SESPREFIX] [UNZIP] [STORE] [AUTOMATED] [FORCE] [NO_UPDATE]",
"inputs": [
{
"name": "sourcefolder",
"id": "sourcefolder",
"description": "The study root folder containing the raw source data folders",
"type": "String",
"optional": false,
"value-key": "[SOURCEFOLDER]"
},
{
"name": "bidsfolder",
"id": "bidsfolder",
"description": "The destination folder with the (future) bids data and the bidsfolder/code/bidscoin/bidsmap.yaml output file",
"type": "String",
"optional": false,
"value-key": "[BIDSFOLDER]"
},
{
"name": "bidsmap",
"id": "bidsmap",
"description": "The study bidsmap file with the mapping heuristics. If the bidsmap filename is just the basename (i.e. no '/' in the name) then it is assumed to be located in the current directory or in bidsfolder/code/bidscoin. Default: bidsmap.yaml",
"type": "String",
"optional": true,
"default-value": "bidsmap.yaml",
"command-line-flag": "-b",
"value-key": "[BIDSMAP]"
},
{
"name": "template",
"id": "template",
"description": "The bidsmap template file with the default heuristics (this could be provided by your institute). If the bidsmap filename is just the basename (i.e. no '/' in the name) then it is assumed to be located in the bidscoin config folder. Default: bidsmap_dccn",
"type": "String",
"optional": true,
"command-line-flag": "-t",
"value-key": "[TEMPLATE]"
},
{
"name": "plugins",
"id": "plugins",
"description": "List of plugins to be used. Default: the plugin list of the study/template bidsmap)",
"type": "String",
"list": true,
"optional": true,
"command-line-flag": "-p",
"value-key": "[PLUGINS]"
},
{
"name": "subprefix",
"id": "subprefix",
"description": "The prefix common for all the source subject-folders (e.g. 'Pt' is the subprefix if subject folders are named 'Pt018', 'Pt019', ...). Use '*' when your subject folders do not have a prefix. Default: the value of the study/template bidsmap, e.g. 'sub-'",
"type": "String",
"optional": true,
"command-line-flag": "-n",
"value-key": "[SUBPREFIX]"
},
{
"name": "sesprefix",
"id": "sesprefix",
"description": "The prefix common for all the source session-folders (e.g. 'M_' is the subprefix if session folders are named 'M_pre', 'M_post', ..). Use '*' when your session folders do not have a prefix. Default: the value of the study/template bidsmap, e.g. 'ses-'",
"type": "String",
"optional": true,
"command-line-flag": "-m",
"value-key": "[SESPREFIX]"
},
{
"name": "unzip",
"id": "unzip",
"description": "Wildcard pattern to unpack tarball/zip-files in the sub/ses sourcefolder that need to be unzipped (in a tempdir) to make the data readable. Default: the value of the study/template bidsmap",
"type": "String",
"optional": true,
"command-line-flag": "-u",
"value-key": "[UNZIP]"
},
{
"name": "store",
"id": "store",
"description": "Store provenance data samples in the bidsfolder/code/provenance folder (useful for inspecting e.g. zipped or transferred datasets)",
"type": "Flag",
"optional": true,
"command-line-flag": "-s",
"value-key": "[STORE]"
},
{
"name": "automated",
"id": "automated",
"description": "Save the automatically generated bidsmap to disk and without interactively tweaking it with the bidseditor",
"type": "Flag",
"optional": true,
"command-line-flag": "-a",
"value-key": "[AUTOMATED]"
},
{
"name": "force",
"id": "force",
"description": "Discard the previously saved bidsmap and logfile",
"type": "Flag",
"optional": true,
"command-line-flag": "-f",
"value-key": "[FORCE]"
},
{
"name": "no_update",
"id": "no_update",
"description": "Do not update any sub/sesprefixes in or prepend the sourcefolder name to the <<filepath:regex>> expression that extracts the subject/session labels. This is normally done to make the extraction more robust, but could cause problems for certain use cases",
"type": "Flag",
"optional": true,
"command-line-flag": "--no-update",
"value-key": "[NO_UPDATE]"
}
],
"tags": {},
"suggested-resources": {
"cpu-cores": 1,
"ram": 1,
"walltime-estimate": 60
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,27 @@
"UPDATE_DOUGHNUT": true
}
]
},
{
"NAME": "bidscoin",
"VERSION": "4.3.2",
"STEPS": [
{
"NAME": "prepare",
"INVOCATION_FILE": "[[NIPOPPY_DPATH_INVOCATIONS]]/[[NIPOPPY_PIPELINE_NAME]]-[[NIPOPPY_PIPELINE_VERSION]]-prepare.json",
"DESCRIPTOR_FILE": "[[NIPOPPY_DPATH_DESCRIPTORS]]/bidsmapper-[[NIPOPPY_PIPELINE_VERSION]].json"
},
{
"NAME": "edit",
"INVOCATION_FILE": "[[NIPOPPY_DPATH_INVOCATIONS]]/[[NIPOPPY_PIPELINE_NAME]]-[[NIPOPPY_PIPELINE_VERSION]]-edit.json",
"DESCRIPTOR_FILE": "[[NIPOPPY_DPATH_DESCRIPTORS]]/bidseditor-[[NIPOPPY_PIPELINE_VERSION]].json"
},
{
"NAME": "convert",
"INVOCATION_FILE": "[[NIPOPPY_DPATH_INVOCATIONS]]/[[NIPOPPY_PIPELINE_NAME]]-[[NIPOPPY_PIPELINE_VERSION]]-convert.json",
"DESCRIPTOR_FILE": "[[NIPOPPY_DPATH_DESCRIPTORS]]/bidscoiner-[[NIPOPPY_PIPELINE_VERSION]].json"
}
]
}
],
"PROC_PIPELINES": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,27 @@
"UPDATE_DOUGHNUT": true
}
]
},
{
"NAME": "bidscoin",
"VERSION": "4.3.2",
"STEPS": [
{
"NAME": "prepare",
"INVOCATION_FILE": "[[NIPOPPY_DPATH_INVOCATIONS]]/[[NIPOPPY_PIPELINE_NAME]]-[[NIPOPPY_PIPELINE_VERSION]]-prepare.json",
"DESCRIPTOR_FILE": "[[NIPOPPY_DPATH_DESCRIPTORS]]/bidsmapper-[[NIPOPPY_PIPELINE_VERSION]].json"
},
{
"NAME": "edit",
"INVOCATION_FILE": "[[NIPOPPY_DPATH_INVOCATIONS]]/[[NIPOPPY_PIPELINE_NAME]]-[[NIPOPPY_PIPELINE_VERSION]]-edit.json",
"DESCRIPTOR_FILE": "[[NIPOPPY_DPATH_DESCRIPTORS]]/bidseditor-[[NIPOPPY_PIPELINE_VERSION]].json"
},
{
"NAME": "convert",
"INVOCATION_FILE": "[[NIPOPPY_DPATH_INVOCATIONS]]/[[NIPOPPY_PIPELINE_NAME]]-[[NIPOPPY_PIPELINE_VERSION]]-convert.json",
"DESCRIPTOR_FILE": "[[NIPOPPY_DPATH_DESCRIPTORS]]/bidscoiner-[[NIPOPPY_PIPELINE_VERSION]].json"
}
]
}
],
"PROC_PIPELINES": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sourcefolder": "[[NIPOPPY_DPATH_SOURCEDATA]]",
"bidsfolder": "[[NIPOPPY_DPATH_BIDS]]",
"participant_label": [
"[[NIPOPPY_PARTICIPANT_ID]]"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"bidsfolder": "[[NIPOPPY_DPATH_BIDS]]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sourcefolder": "[[NIPOPPY_DPATH_SOURCEDATA]]",
"bidsfolder": "[[NIPOPPY_DPATH_BIDS]]"
}
7 changes: 6 additions & 1 deletion nipoppy_cli/tests/test_default_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ def test_pipeline_runner(
("heudiconv", "0.12.2", "convert"),
("dcm2bids", "3.1.0", "prepare"),
("dcm2bids", "3.1.0", "convert"),
("bidscoin", "4.3.2", "prepare"),
("bidscoin", "4.3.2", "edit"),
("bidscoin", "4.3.2", "convert"),
],
)
def test_bids_conversion_runner(
Expand All @@ -131,7 +134,9 @@ def test_bids_conversion_runner(
simulate=True,
)

runner.pipeline_config.get_fpath_container().touch()
fpath_container = runner.pipeline_config.get_fpath_container()
if fpath_container is not None:
runner.pipeline_config.get_fpath_container().touch()

invocation_str, descriptor_str = runner.run_single(
participant_id=participant_id, session_id=session_id
Expand Down

0 comments on commit 2284c1b

Please sign in to comment.