Reading eprime files to fill events.tsv files automatically

Hi there,

I am using a modified version of heudiconv to convert a huge number of sessions (~ 2500) to BIDS. Part of these sessions are task-based fMRI scans. We managed to convert these fMRI scans using heudiconv, but the events.tsv files that must accompany them remain empty. I do not think heudiconv can fill events.tsv files automatically (pls correct me if I’m wrong).
Now my question is if there is any app or sth to read the behavioural files in our dataset (in .edat format) and convert them to bids-acceptable events.tsv files.
Any other suggestion re this question is also much appreciated.

Thanks a lot!

1 Like

Ahoi hoi @Maryam_Mokhberi,

thanks for the post and welcome to Neurostars, it’s great to have you here!

You’re absolutely right in that heudiconv does not automatically populate events.tsv files.
As far as I know, there’s currently no BIDS App/script that does a full conversion from .edat to events.tsv files. However, @tsalo did something along these lines with convert-eprime. His scripts might be good starting point for you, as tailoring the resulting .csv files to events.tsv files should be fairly straightforward. Also, @tsalo do you perhaps have any other pointers and/or experience you could share regarding this matter?

If you encounter any follow up problems/issues, please don’t hesitate to post again.
HTH, cheers, Peer

1 Like

convert-eprime does a good job of converting the raw text files that are automatically outputted by E-Prime into something like the tab-delimited text files you can export from the edat files, which makes it easier to automate the whole process.

The resulting csvs won’t be events files, though, so you’ll need to use custom code to make those. If you’re familiar with pandas then it’s definitely doable. I can share scripts for some tasks in my lab, but they’re not very readable, nor will they be applicable to anyone else’s tasks.

1 Like

Hi @Maryam_Mokhberi,

I figure something is at least as good as nothing: at the bottom of this “tutorial” there is script that uses @tsalo’s convert-eprime with some pandas manipulations. As @tsalo said, however, your code will almost definitely be different than what I did, but it can be a launching point just to see how the package is used in the wild.

Let me know if you have any questions about the code.

Best,
James

3 Likes

Thanks a lot @PeerHerholz, @jdkent, and @tsalo !
All answers were very helpful! I will take a look at the codes you introduced and will let you know if I have questions again. :slight_smile:

1 Like