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

channels.tsv on ds000117 #1003

Open
agramfort opened this issue Apr 25, 2022 · 17 comments
Open

channels.tsv on ds000117 #1003

agramfort opened this issue Apr 25, 2022 · 17 comments
Labels
inheritance issues related to the BIDS inheritance principle

Comments

@agramfort
Copy link
Member

the ds000117 contains a channels.tsv file but it's one file for all runs of a subject and it's not in the meg folder:

https://openneuro.org/datasets/ds000117/versions/1.0.5/file-display/sub-01:ses-meg:sub-01_ses-meg_task-facerecognition_channels.tsv

as the consequence read_raw_bids does not find the file and therefore cannot read the bad channels or the fact the EEG061 and EEG062 are EOG and EEG063 is ECG.

I ran the validator on the dataset and it does not complain about this.

@hoechenberger @sappelhoff @alexrockhill is it a bug of the dataset and validator or mne-bids?

presently I am stuck...

@alexrockhill
Copy link
Contributor

I think probably mne-bids should use that channels sidecar and it's a bug/not-yet-implemented on the mne-bids side. I didn't write that part so I'd have to look into it a bit more but AFAIK the channels does not use hierarchy and just looks for a file at the data level.

@alexrockhill
Copy link
Contributor

From the code, it looks like it should work. If you do mne_bids.path._find_matching_sidecar(bids_path, suffix='channels', extension='.tsv') do you get a the file you linked?

@agramfort
Copy link
Member Author

the search str used is:

".../ds000117/sub-01/**/meg/sub-01_ses-meg*channels.tsv"

so it looks inside "meg" and not in there. It's one level up...

@agramfort
Copy link
Member Author

I ended up moving the files to the meg folder for now...

@alexrockhill
Copy link
Contributor

Maybe mne-bids should search without datatype if datatype doesn't return a match. And then maybe without subject even...

@sappelhoff
Copy link
Member

I think it's a bug in the dataset, see also bids-standard/bids-examples#296

@alexrockhill
Copy link
Contributor

alexrockhill commented Apr 26, 2022

Do you think there would be harm in being more permissive with mne-bids and applying the hierarchical structure even if it's not supported by BIDS? As I've seen, not all datasets fit cleanly into BIDS yet and sometimes this kind of thing is helpful to being maximally flexible as long as the lowest level match is used first.

@hoechenberger
Copy link
Member

Do you think there would be harm in being more permissive with mne-bids and applying the hierarchical structure even if it's not supported by BIDS?

We don't even really apply the hierarchical structure for BIDS-compliant datasets, and I'm one of those who believe that the hierarchical inheritance principle was a big mistake and should be killed in a future BIDS version 😅 But if you want to give its implementation a shot – sure, and good luck 🥸

@adam2392
Copy link
Member

Also not a fan of hierarchical everything. Makes implementation a complex hell.

@alexrockhill
Copy link
Contributor

Haha, well maybe I'll try a PR if I have a bit, I think it can be elegant. Maybe more opinions will come to the defense of hierarchical data structures. They sure do like it in BIDS.

@sappelhoff
Copy link
Member

if you want a deep read on suggested changes to the inheritance principle, you can also see this: bids-standard/bids-specification#1003 and comment with your opinion :)

I think I'd be okay with an implementation of the inheritance principle in mne-bids ... but I would be against implementing support for stuff that's not allowed in BIDS

@alexrockhill
Copy link
Contributor

I agree but I think an important caveat is that if it passes the BIDS-validator and has for some time, even if it's not part of the BIDS-specification, I think that should be supported for backward compatibility for as long as possible.

@jasmainak
Copy link
Member

inheritance principle is necessary for folks who manually curate the datasets since sometimes it's easier to edit one file than multiple files. For jsons you'd have to get a list of dictionaries across levels and merge them (with lower levels taking precedence). I don't know how it would work for tsv though :)

@sappelhoff
Copy link
Member

sappelhoff commented Apr 27, 2022

Afaik, inheritance is not implemented for tsvs (it's not implemented for "data" tsvs ... but it IS implemented for metadata tsvs ... it'd difficult when one would also encode metadata in a data tsv file -- which is possible due to being able to add arbitrary columns to any tsv)

@hoechenberger
Copy link
Member

I agree but I think an important caveat is that if it passes the BIDS-validator and has for some time, even if it's not part of the BIDS-specification, I think that should be supported for backward compatibility for as long as possible.

In fact, we do support some things that are not in compliance with (the most recent revisions of) the specs. So, yeah, I'm okay with being lenient in certain cases, but we'll have to be careful not to allow for too much sloppiness :)

@alexrockhill
Copy link
Contributor

Afaik, inheritance is not implemented for tsvs

Yes, this is a tricky case because some tsvs are data (i.e. _beh.tsv) and some are sidecars (e.g. _channels.tsv). I think the sidecar designation is more important than the file extension in determining inheritance and IMO inheriting sidecar files that are repeated across subjects/sessions/runs is much more DRY and therefore preferable.

@sappelhoff
Copy link
Member

@sappelhoff sappelhoff added the inheritance issues related to the BIDS inheritance principle label Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inheritance issues related to the BIDS inheritance principle
Projects
None yet
Development

No branches or pull requests

6 participants