Skip to content

Commit

Permalink
Add --bids-database-dir parameter (PennLINC#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo authored Mar 28, 2024
1 parent 919ccc1 commit d348710
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
10 changes: 10 additions & 0 deletions xcp_d/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ def _bids_filter(value, parser):
"filtering-inputs-with-bids-filter-files"
),
)
g_bids.add_argument(
"--bids-database-dir",
metavar="PATH",
type=Path,
help=(
"Path to a PyBIDS database folder, for faster indexing "
"(especially useful for large datasets). "
"Will be created if not present."
),
)

g_surfx = parser.add_argument_group("Options for CIFTI processing")
g_surfx.add_argument(
Expand Down
4 changes: 2 additions & 2 deletions xcp_d/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,10 @@ def init(cls):
)
),
]
if cls.participant_label:
if cls.participant_label and cls.bids_database_dir is None:
# Ignore any subjects who aren't the requested ones.
ignore_patterns.append(
re.compile(r"sub-(?!" + "|".join(cls.participant_label) + r")\w+")
re.compile(r"sub-(?!(" + "|".join(cls.participant_label) + r")(\b|_))")
)

_indexer = BIDSLayoutIndexer(
Expand Down
2 changes: 2 additions & 0 deletions xcp_d/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def mock_config():
config.execution.work_dir = Path(mkdtemp())
config.execution.fmri_dir = Path(doc.download_example_data(out_dir=mkdtemp()))
config.execution.xcp_d_dir = Path(mkdtemp())
config.execution.bids_database_dir = None
config.execution._layout = None
config.execution.init()

yield
Expand Down

0 comments on commit d348710

Please sign in to comment.