Pybids query bids dataset & specific derivatives dataset

pybids
bids
#1

Hi All,

Problem

I want to index a bids dataset and a specific derivatives directory in a single layout.
(And I want to do it in a way that’s considered best practice)

Question

What is the “correct” way to index a bids dataset and a derivatives dataset?

My Current Solution

from bids.layout import BIDSLayout

bids_dir = '/home/james/test/BetterDirectoryStructure/3-Experiment/2-data/bids'
deriv_dir = '/home/james/test/BetterDirectoryStructure/3-Experiment/2-data/bids/derivatives/fmriprep'

lay = BIDSLayout([(bids_dir, ['bids']), (deriv_dir, ['bids', 'derivatives'])], include='sub-*')

Note: I used include='sub-*' as a general way to ignore other folders and only collect the subject specific information (this will not be applicable for all derivatives, but it is useful for my application). Is it doing what I expect (e.g. only checking the root level directory for folders/files that match the sub-* regex)? Rambling on, I should probably also include a *.json entry to include top level jsons.

Thanks!
James

Issues with BIDSLayout in Nipype
#2

This looks like it should be fine, though there may be some unintended fallout from setting the include parameter.

1 Like