From 56843ad8f0636f566fac831b0319e85befd28bc9 Mon Sep 17 00:00:00 2001 From: Jason Kai Date: Sat, 24 Feb 2024 10:08:22 -0500 Subject: [PATCH] Update run.py and config for snakebids 0.12.x - Remove standard bids-app options from config (no longer necessary) - Refactor run.py to work with new version --- scattr/config/snakebids.yml | 31 ------------------------------- scattr/run.py | 21 +++++++++++---------- 2 files changed, 11 insertions(+), 41 deletions(-) diff --git a/scattr/config/snakebids.yml b/scattr/config/snakebids.yml index b5b8c802..e3940dad 100644 --- a/scattr/config/snakebids.yml +++ b/scattr/config/snakebids.yml @@ -56,37 +56,6 @@ pybids_inputs_dwi: # Configuration for the command-line parameters to make available # passed on the argparse add_argument() parse_args: - #--- core BIDS-app options --- (do not modify below) ---# - bids_dir: - help: The directory with the input dataset formatted according to the - BIDS standard. - - output_dir: - help: The directory where the output files should be stored. If you are - running group level analysis, this folder should be prepopulated - with the results of the participant level analysis. - - analysis_level: - help: Level of the analysis that will be performed - choices: *analysis_levels - - --participant_label: - help: The label(s) of the participant(s) that should be analyzed. The label - corresponds to sub- from the BIDS spec (so it does - not include "sub-"). If this parameter is not provided, all subjects - will be analyzed. Multiple participants can be specified with a space - seperated list. - nargs: "+" - - --exclude_participant_label: - help: The label(s) of the participant(s) that should be excluded. The label - corresponds to sub- from the BIDS spec (so it does - not include "sub-"). If this parameter is not provided, all subjects - will be analyzed. Multiple participants can be specified with a space - sepearated list. - nargs: "+" - #-----------------------------------------------------# - #--- additional BIDS-app options --- (add in below) --# --slurm_tmpdir: help: "Flag to indicate use of SLURM temporary directory. A temporary diff --git a/scattr/run.py b/scattr/run.py index 0d15d63d..00626a56 100644 --- a/scattr/run.py +++ b/scattr/run.py @@ -1,22 +1,23 @@ #!/usr/bin/env python -import os +from pathlib import Path -from snakebids.app import SnakeBidsApp -from snakebids.cli import add_dynamic_args +from snakebids import bidsapp, plugins def get_parser(): """Exposes parser for sphinx doc generation, cwd is the docs dir""" - app = SnakeBidsApp("../scattr", skip_parse_args=True) - add_dynamic_args( - app.parser, app.config["parse_args"], app.config["pybids_inputs"] - ) - return app.parser + app = bidsapp.app([plugins.SnakemakeBidsApp("../scattr")]) + return app.build_parser().parser def main(): - app = SnakeBidsApp(os.path.abspath(os.path.dirname(__file__))) - app.run_snakemake() + app = bidsapp.app( + [ + plugins.SnakemakeBidsApp(Path(__file__).resolve().parent), + plugins.Version(distribution="scattr"), + ] + ) + app.run() if __name__ == "__main__":