Snakebids: Flexible Input Interfaces for BIDS Apps

Presented During:

Monday, June 24, 2024: 5:45 PM - 7:00 PM
COEX  
Room: Grand Ballroom 103  

Poster No:

2272 

Submission Type:

Abstract Submission 

Authors:

Peter Van Dyken1, Tristan Kuehn2, Jason Kai3, Ali Khan4

Institutions:

1Schulich School of Medicine and Dentistry, London, Ontario, 2BrainsCAN, Western University, London, Ontario, 3Robarts Research Institute, Western University, London, Ontario, 4University of Western Ontario, London, Ontario

First Author:

Peter Van Dyken, BSc  
Schulich School of Medicine and Dentistry
London, Ontario

Co-Author(s):

Tristan Kuehn, MSc  
BrainsCAN, Western University
London, Ontario
Jason Kai  
Robarts Research Institute, Western University
London, Ontario
Ali Khan  
University of Western Ontario
London, Ontario

Introduction:

The increasing popularity of the Brain Imaging Data Structure (BIDS) specification for neuroimaging data (Gorgolewski et al., 2016) has led to a flourishing of workflows known as BIDS Apps (Gorgolewski et al., 2017). With a standardized data structure enforced by BIDS, a wide variety of workflows can be easily applied to neuroimaging datasets from any arbitrary source. This not only simplifies app development, but makes it easier to share generic analysis code for future replication. Nevertheless, even with the BIDS specification, a wide diversity of data formatting persists, especially for derived files. This makes it challenging to design BIDS Apps consuming derivative files with nonstandard naming conventions. To ensure workflows remain generic even in the absence of specific naming conventions, we present snakebids, a Python library leveraging pybids to create generic interfaces between BIDS Apps and datasets.

Methods:

Snakebids defines a component as a set of files corresponding to the same type of data, for instance, a T1w image file, the bvecs for a diffusion image, or a pial surface mesh. Each component is defined by a set of fixed and variable characteristics. For instance, all paths in a T1w component may have suffix of T1w, but vary across several subjects and session. In snakebids, fixed features are selected using filters, and variable features are defined using wildcards. In a snakebids app, these features are configured with sensible defaults by the developer. Within the app, snakebids provides tools to derive new paths based on the input components. Wildcards can either be carried forward to the derived paths (e.g. for subject-specific analyses) or merged together (e.g. averaging across subjects in a group-wise analysis). Finally, snakebids automatically creates BIDS apps populated with options allowing users to set the filters and wildcards of each component. Thus, when running a snakebids app, users can provide specific filters to select the correct input files out of their dataset.
Supporting Image: snakebids-schematic.png
   ·Graphical overview of snakebids
 

Results:

Snakebids has been integrated into over a dozen workflows at various states of maturity. The most prominent example is hippunfold (DeKraker et al., 2022), which relies on snakebids to retrieve T1w, T2w, and diffusion weighted components, along with an optional segmentation. scattr, a snakebids app that identifies connections between specified ROIs (using methods introduced in (Kai, Khan, Haast, & Lau, 2022)), leverages snakebids' flexible input interface to consume existing freesurfer outputs, avoiding redundant computations. Beyond this, our group has several unpublished snakebids apps to process MR and EEG data. These have been used in multi-dataset analyses (reports in preparation), applying the same methodology to multiple datasets despite differences in naming conventions.

Conclusions:

The flexible interfaces from snakebids offer three advantages. First, it makes it easier to package methodologies as BIDS apps, reducing the barrier of effective code sharing. Second, it facilitates multi-dataset and mega-analysis by allowing the tuning of apps to different datasets without burdensome formatting requirements on dataset maintainers. Third, snakebids makes it easy to compose multiple BIDS apps together, freeing developers to produce smaller, more focused BIDS apps with better reliability and maintainability. snakebids is under active development, but is mature enough for production use, with full documentation and near 100% test coverage. Thus far, snakebids has been developed around the snakemake workflow framework (Mölder et al., 2021), and all current snakebids apps are written in snakemake. However, the principles of snakebids are broadly applicable across all Python based workflows, and future releases will highlight it as a framework agnostic solution for generic BIDS workflows.

Modeling and Analysis Methods:

Methods Development 2

Neuroinformatics and Data Sharing:

Workflows 1
Informatics Other

Keywords:

Informatics
Open-Source Code
Open-Source Software
Workflows

1|2Indicates the priority used for review

Provide references using author date format

DeKraker, J. (2022). Automated hippocampal unfolding for morphometry and subfield segmentation with HippUnfold. eLife, 11, e77945.
Gorgolewski, K. J. (2017). BIDS apps: Improving ease of use, accessibility, and reproducibility of neuroimaging data analysis methods. PLOS Computational Biology, 13(3), e1005209.
Gorgolewski, K. J. (2016). The brain imaging data structure, a format for organizing and describing outputs of neuroimaging experiments. Scientific Data, 3(1), 160044.
Kai, J. (2022). Mapping the subcortical connectome using in vivo diffusion MRI: Feasibility and reliability. NeuroImage, 262, 119553.
Mölder, F. (2021). Sustainable data analysis with Snakemake. F1000Research.