Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore all subjects except the requested ones in BIDSLayout initialization #3235

Closed
tsalo opened this issue Feb 22, 2024 · 0 comments · Fixed by #3236
Closed

Ignore all subjects except the requested ones in BIDSLayout initialization #3235

tsalo opened this issue Feb 22, 2024 · 0 comments · Fixed by #3236
Labels
BIDS effort: low Estimated low effort task impact: low Estimated low impact task
Milestone

Comments

@tsalo
Copy link
Collaborator

tsalo commented Feb 22, 2024

What would you like to see added in fMRIPrep?

I believe the BIDSLayout initialization might take less time on large datasets if the ignore patterns included a regular expression to select any participant folders except the ones requested by the user.

ignore_patterns = [
    'code',
    'stimuli',
    'sourcedata',
    'models',
    re.compile(r'^\.'),
    re.compile(
        r'sub-[a-zA-Z0-9]+(/ses-[a-zA-Z0-9]+)?/(beh|dwi|eeg|ieeg|meg|perf)'
    ),
]
if cls.participant_label:
    # Ignore any subjects who aren't the requested ones.
    ignore_patterns.append(re.compile(r'sub-(?!' + '|'.join(cls.participant_label) + r')\w+'))

_indexer = BIDSLayoutIndexer(
    validate=False,
    ignore=ignore_patterns
)

Do you have any interest in helping implement the feature?

Yes

Additional information / screenshots

This stems from a similar request in QSIPrep (PennLINC/qsiprep#513).

@tsalo tsalo added impact: low Estimated low impact task effort: low Estimated low effort task BIDS labels Feb 22, 2024
@effigies effigies added this to the 24.0.0 milestone Feb 29, 2024
effigies added a commit that referenced this issue Mar 9, 2024
Closes #3235.

## Changes proposed in this pull request

- Incorporate a regular expression in the `ignore` list of the
`BIDSLayoutIndexer` that flags subjects who are _not_ in
`Config.participant_label` (when provided).

---------

Co-authored-by: Chris Markiewicz <effigies@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BIDS effort: low Estimated low effort task impact: low Estimated low impact task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants