Latest version of pybids doesn't recognize my data organization

Hi fellow neuroimagers,

I’ve been using pybids to go through my data for a while and my life was great so far. Unfortunately, updating pybids to version 0.8.0 changed a few things.

Here is my data organization:

/cerebro/cerebro1/dataset/bmpd
|-- BMPD_template.pdf
|-- CHANGES
|-- code
|-- dataset_description.json
|-- derivatives
|-- participants.tsv
|-- README
|-- sourcedata
|-- sub-P001
|-- sub-P002
|-- sub-P003
|-- sub-P004
|-- sub-P005
|-- sub-P006
|-- sub-P007
|-- sub-P008
|-- sub-P009
|-- sub-P010
|-- sub-P011
|-- sub-Pilot1
|-- sub-Pilot2

And for each participant, here is the data organization:

/cerebro/cerebro1/dataset/bmpd/sub-P001
|-- anat
|   |-- sub-P001_acq-dis3d_T1w.json
|   |-- sub-P001_acq-dis3d_T1w.nii.gz
|   |-- sub-P001_acq-dis3d_T1w_RPI_r_seg_manual.nii.gz
|   |-- sub-P001_run-01_T1w.json
|   |-- sub-P001_run-01_T1w_label_discs.nii.gz
|   |-- sub-P001_run-01_T1w.nii.gz
|   |-- sub-P001_T2w.json
|   `-- sub-P001_T2w.nii.gz
|-- dwi
|   |-- sub-P001_b0-j_dwi.json
|   |-- sub-P001_b0-j_dwi.nii.gz
|   |-- sub-P001_j-_dwi.bval
|   |-- sub-P001_j-_dwi.bvec
|   |-- sub-P001_j-_dwi.json
|   `-- sub-P001_j-_dwi.nii.gz
|-- fmap
|   |-- sub-P001_120_run-01_epi-b1.json
|   |-- sub-P001_120_run-01_epi-b1.nii.gz
|   |-- sub-P001_120_run-02_epi-b1.json
|   |-- sub-P001_120_run-02_epi-b1.nii.gz
|   |-- sub-P001_60_run-01_epi-b1.json
|   |-- sub-P001_60_run-01_epi-b1.nii.gz
|   |-- sub-P001_60_run-02_epi-b1.json
|   |-- sub-P001_60_run-02_epi-b1.nii.gz
|   |-- sub-P001_task-rest_dir-j_run-01_epi.json
|   |-- sub-P001_task-rest_dir-j-_run-01_epi.json
|   |-- sub-P001_task-rest_dir-j_run-01_epi.nii.gz
|   |-- sub-P001_task-rest_dir-j-_run-01_epi.nii.gz
|   |-- sub-P001_task-rest_dir-j_run-02_epi.json
|   |-- sub-P001_task-rest_dir-j-_run-02_epi.json
|   |-- sub-P001_task-rest_dir-j_run-02_epi.nii.gz
|   `-- sub-P001_task-rest_dir-j-_run-02_epi.nii.gz
|-- func
|   |-- sub-P001_task-rest_dir-j-_run-01_bold.json
|   |-- sub-P001_task-rest_dir-j-_run-01_bold.nii.gz
|   |-- sub-P001_task-rest_dir-j-_run-02_bold.json
|   `-- sub-P001_task-rest_dir-j-_run-02_bold.nii.gz
`-- mt
    |-- sub-P001_MT0.json
    |-- sub-P001_MT0.nii.gz
    |-- sub-P001_MT1.json
    |-- sub-P001_MT1.nii.gz
    |-- sub-P001_run-02_T1w.json
    `-- sub-P001_run-02_T1w.nii.gz

When I read my data using BIDSLayout, it only detect the anat folder, as shown below:

print bids.__version__
layout = bids.BIDSLayout('/cerebro/cerebro1/dataset/bmpd/')
print layout.get(subject='P001')

0.8.0 [<BIDSFile filename='sub-P001/anat/sub-P001_acq-dis3d_T1w.nii.gz'>, <BIDSFile filename='sub-P001/anat/sub-P001_acq-dis3d_T1w.json'>, <BIDSFile filename='sub-P001/anat/sub-P001_T2w.nii.gz'>, <BIDSFile filename='sub-P001/anat/sub-P001_run-01_T1w.json'>, <BIDSFile filename='sub-P001/anat/sub-P001_run-01_T1w.nii.gz'>, <BIDSFile filename='sub-P001/anat/sub-P001_T2w.json'>]

Any idea where it could come from?

Many thanks!

Hi @benjamindeleener,

I’d recommend checking your data with the BIDS validator. A number of things stand out to me that should be caught by the validator:

|   |-- sub-P001_b0-j_dwi.nii.gz
|   |-- sub-P001_j-_dwi.bval
|   |-- sub-P001_j-_dwi.bvec
|   `-- sub-P001_j-_dwi.nii.gz

These are not valid BIDS names, as b0-j will be read as a key-value pair and _j-_ will read as key j with no value. My guess would be that these should be:

|   |-- sub-P001_dir-PA_dwi.nii.gz
|   |-- sub-P001_dwi.bval
|   |-- sub-P001_dwi.bvec
|   `-- sub-P001_dir-AP_dwi.nii.gz
sub-P001_120_run-01_epi-b1.nii.gz

This has an un-clarified value 120, and an invalid suffix epi-b1.

These are just a couple examples. I would let the validator identify unknown files. For determining the correct names, the online spec has a good search funciton. And if you need help determining the appropriate name for certain files, feel free to follow-up here.