Skip to content

Commit

Permalink
Update run.py and config for snakebids 0.12.x
Browse files Browse the repository at this point in the history
- Remove standard bids-app options from config (no longer necessary)
- Refactor run.py to work with new version
  • Loading branch information
kaitj committed Feb 24, 2024
1 parent b0a6e02 commit 56843ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 41 deletions.
31 changes: 0 additions & 31 deletions scattr/config/snakebids.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-<participant_label> 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-<participant_label> 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
Expand Down
21 changes: 11 additions & 10 deletions scattr/run.py
Original file line number Diff line number Diff line change
@@ -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__":
Expand Down

0 comments on commit 56843ad

Please sign in to comment.