How to set --filter-preproc_bold in denoise-fmri (CBS server)

I’m currently using the bids app denoise-fmri on the CBS server. My data has multiple tasks in the func folder which is throwing the error:

ConfigError in file /cifs/open_data_hbn/denoise-fmri/denoise_fmri/workflow/Snakefile, line 18:
More than one snakemake filename for preproc_bold, taking the first. To correct this, use the --filter_preproc_bold option to narrow the search.

How can I set this option “filter_preproc_bold” to specify using only one of the tasks/spaces? My code looks something like the following:

/directory/denoise-fmri/denoise_fmri/run.py /directory/bids_data /directory/denoised_data participant -np

With the filter:

/directory/denoise-fmri/denoise_fmri/run.py /directory/bids_data /directory/denoised_data --filter_preproc_bold task-taskname_space-MNI_res-01_desc-preproc_bold.nii.gz participant -np

Which throws a value error. I’m not sure exactly how or where to invoke the argument and can’t seem to find much information online. Thanks in advance!

I’m not too familiar with the bids app itself, but I believe you should be able to filter by using the flag similar to: --filter_preproc_bold task=<task_name>, replacing <task_name> with your task.

Thanks for the reply! It still doesn’t seem to be working. It’s odd because it seems to recognize the filters but can’t find the data with those labels:

Config file config/snakebids.yml is extended by additional config specified via the command line.
No input files found for snakebids component preproc_bold:
filters:
suffix: bold
desc: preproc
extension: .nii.gz
datatype: func
task: movieTP
space: MNI152NLin2009cAsym_res-02

I have a somewhat inefficient workaround for now but just wondering if there’s a solution.

Would you be able to provide an example of the movie task filename and the directory it is in (e.g. is it in the /directory/bids_data/ folder)?

From the filters you showed above, I am guessing it looks something like
/directory/bids_data/sub-{subject}/func/sub-{subject}_space-MNI152NLin2009cAsym_res-02_task-movieTP_desc-preproc_bold.nii.gz?

It looks like:

/cifs/open_data_hbn/data/student_data/student_bids/sub-NRADA709231/sub-NRADA709231_task-movieTP_space-MNI152NLin2009cAsym_res-02_desc-preproc_bold.nii.gz

And the denoise-fmri program is in cifs/open_data_hbn

Would you also be able to provide a portion (see below) of the config file for the bids app - it should be the /cifs/open_data_hbn/denoise_fmri/denoise_fmri/config/snakebids.yml file.

There should be a section in that file similar to:

pybids_inputs:
  preproc_bold:
    filters:
      suffix: 'bold'
      desc: 'preproc'
      extension: '.nii.gz'
      scope: 'derivatives'
      invalid_filters: 'allow'

This is what I have:

pybids_inputs:
  preproc_bold:
    filters:
      suffix: bold
      desc: preproc
      extension: .nii.gz
      # scope: derivatives    # raw, derivatives (or can be pipeline name too!)
      # invalid_filters: allow
      datatype: func
      # run: true
    wildcards:
      - subject
      - session
      - task
      - acquisition
      - run
      - space
      - res

Ahh okay, I am not sure if this was a typo, but this may be the cause of the issue. The filters are looking for a file in a sub-directory named func (as suggested by the datatype: func in the filters). You can try to either comment out the datatype filter by adding a # in front to that line (similar to scope, invalid_filters, etc.), though I am not sure if this will work.

Alternatively, you can move the fMRI scans to a folder named “func” within the subject folder (e.g.
/cifs/open_data_hbn/data/student_data/student_bids/sub-NRADA709231/func/sub-NRADA709231_task-movieTP_space-MNI152NLin2009cAsym_res-02_desc-preproc_bold.nii.gz).

That was a typo, the data is in a func folder.

I think I figured it out though. I also had to specify the task and space in --filter_preproc_mask and --filter_confounds (task only) in addition to --filter_preproc_bold. Makes sense!

Thanks for your time @tkai

1 Like

Hey there. Thanks for your input. I have tried that, but still facing some issues. Would you mind giving me a step-by-step guide on how to set the filter preproc_bold in the denoise fMRI CBS server? I am a bit stuck.

Thanks in advance.

Hi @Domvat, this is the whole command I used to denoise all subject files in a folder:

for i in $(cat ./data/student_data/test.txt); do /cifs/open_data_hbn/denoise-fmri/denoise_fmri/run.py /cifs/open_data_hbn/data/student_data/student_bids/$i /cifs/open_data_hbn/data/student_data/test_results participant --fwhm 0 --filter_preproc_bold task=movieTP space=MNI152NLin2009cAsym --filter_preproc_mask task=movieTP space=MNI152NLin2009cAsym --filter_confounds task=movieTP -np; done

I found that in order to use filter_preproc_bold, I had to set the task AND the space AND also set filter_preproc_mask and filter_confounds (task only). Your data should be in BIDS format.

1 Like

May be this is in BIDS format.
How can I change it?

BIDS is a standardized way of organizing neuroimaging data (bids.neuroimaging.io). My data was already in BIDS so I do not have previous experience converting it. Maybe autobids can help you (https://github.com/khanlab/autobids)? There appears to be tutorials on the BIDS site as well.