Snakebids is configured with a YAML (or JSON) file that extends the standard snakemake config file with variables that snakebids uses to parse an input BIDS dataset and expose the snakebids workflow to the command line.

Config Variables#


A dictionary that describes each type of input you want to grab from an input BIDS dataset. Snakebids will parse your dataset with generate_inputs(), converting each input type into a BidsComponent. The value of each item should be a dictionary with keys filters and wildcards.

The value of filters should be a dictionary where each key corresponds to a BIDS entity, and the value specifies which values of that entity should be grabbed. The dictionary for each input is sent to the PyBIDS’ get() function . filters can be set according to a few different formats:

  • string: specifies an exact value for the entity. In the following example:

    2  bold:
    3    filters:
    4      suffix: 'bold'
    5      extension: '.nii.gz'
    6      datatype: 'func'

    the bold component would match any paths under the func/ datatype folder, with the suffix bold and the extension .nii.gz.

  • boolean: constrains presence or absence of the entity without restricting its value. False requires that the entity be absent, while True requires that the entity be present, regardless of value.

    2  derivs:
    3    filters:
    4      datatype: 'func'
    5      desc: True # or true, or yes
    6      acquisition: False # or false, or no

    The above example maps all paths in the func/ datatype folder that have a _desc- entity but do not have the _acq- entity.

In addition, the special filter regex_search can be set to true, which causes all other filters in the component to use regex matching instead of exact matching.

The value of wildcards should be a list of BIDS entities. Snakebids collects the values of any entities specified and saves them in the entities and zip_lists entries of the corresponding BidsComponent. In other words, these are the entities to be preserved in output paths derived from the input being described. Placing an entity in wildcards does not require the entity be present. If an entity is not found, it will be left out of entities. To require the presence of an entity, place it under filters set to true.

In the following (YAML-formatted) example, the bold input type is specified. BIDS files with the datatype func, suffix bold, and extension .nii.gz will be grabbed, and the subject, session, acquisition, task, and run entities of those files will be left as wildcards. The task entity must be present, but there must not be any desc.

 2  bold:
 3    filters:
 4      suffix: 'bold'
 5      extension: '.nii.gz'
 6      datatype: 'func'
 7      task: true
 8      desc: false
 9    wildcards:
10      - subject
11      - session
12      - acquisition
13      - task
14      - run


PyBIDS allows for the use of a cached layout to be used in order to reduce the time required to index a BIDS dataset. A path (if provided) to save the pybids layout. If None or '' is provided, the layout is not saved or used. The path provided must be absolute, otherwise the database will not be used.


A boolean determining whether the existing layout should be be updated. Default behaviour does not update the existing database if one is used.


A list of analysis levels in the BIDS app. Typically, this will include participant and/or group. Note that the default (YAML) configuration file expects this mapping to be identified with the anchor analysis_levels to be aliased by parse_args.


A mapping from the name of each analysis_level to the list of rules or files to be run for that analysis level.


A dictionary of command-line parameters to make available as part of the BIDS app. Each item of the mapping is passed to argparse’s add_argument function. A number of default entries are present in a new snakebids project’s config file that structure the BIDS app’s CLI, but additional command-line arguments can be added as necessary.


A boolean that determines whether debug statements are printed during parsing. Should be disabled (False) if you’re generating DAG visualization with snakemake.


A boolean (or path(s) to derivatives datasets) that determines whether snakebids will search in the derivatives subdirectory of the input dataset.