0.5 to 0.8+

Note

Be sure to also migrate your run.py file to the new snakebids 0.12 syntax!

Starting in version 0.8, snakebids.generate_inputs() returns a BidsInputs object instead of a dict. This requires a change in the way info is accessed. The previous dict had top-level keys such as "input_lists". After selecting such a key, you would pass the name of a component to get the information sought:

1config.update(snakebids.generate_inputs(
2    bids_dir=config['bids_dir'],
3    pybids_inputs=config['pybids_inputs'],
4    use_bids_inputs=False,
5))
6
7config["input_lists"]["t1w"]

Now, the components are top level keys, and the type of property being requested is accessed using an attribute:

1inputs = snakebids.generate_inputs(
2    bids_dir=config['bids_dir'],
3    pybids_inputs=config['pybids_inputs'],
4)
5
6inputs["t1w"].entities

Note that the old behaviour can still be achieved by setting use_bids_inputs=False, as shown in the above example. However, we encourage all users to upgrade to take advantage of all the new features Snakebids has to offer.

1. Assign generate_inputs() to a variable called inputs

Because generate_inputs() no longer returns a dict, you cannot use it to update config, as was previously recommended. The new best practice is to assign its return to a variable called inputs:

1inputs = snakebids.generate_inputs(
2    bids_dir=config['bids_dir'],
3    pybids_inputs=config['pybids_inputs'],
4)

2. Change references to config

All references to config['<attr>']['<comp>'], where <attr> is one of 'input_path', 'input_zip_lists', 'input_lists', or 'input_wildcards', must be updated to input['<comp>'].<attr>. The following regexes may be helpful for search and replace:

# match
config\[([\x22\x27])(input_path|input_zip_lists|input_lists|input_wildcards)\1\]\[([\x22\x27])(\w+)\3\]

# replace
inputs["\4"].\2

In addition, all references to config['<attr>'] where <attr> is one of 'sessions', 'subjects', or 'subj_wildcards' must be updated to input.<attr>. The following regexes may be helpful:

# match
config\[([\x22\x27])(sessions|subjects|subj_wildcards)\1\]

# replace
inputs.\2

3. Update attribute names into modern forms

Although the previous attribute names are being kept around as aliases, we recommend you update to the more modern, sleeker equivalents. Replacements should be made according to the following table:

4. Switch to expand() method

Calls to snakemake’s expand() should be replaced with the new expand() method available on BidsComponent. See the section in 0.7-0.8 migration guide for more details.