Table of Contents
Fetching ...

Snakemaker: Seamlessly transforming ad-hoc analyses into sustainable Snakemake workflows with generative AI

Marco Masera, Alessandro Leone, Johannes Köster, Ivan Molineris

TL;DR

Biology software pipelines suffer from reproducibility and sustainability issues due to evolving tools and ad-hoc scripts. Snakemaker introduces a generative AI-powered workflow transformer that non-invasively converts shell history and IPython notebooks into Snakemake workflows, while tracking environments and documenting changes. It provides two working modes (Shell and Notebook) and an integrated chat assistant, all implemented as a VSCode extension with GitHub Copilot integration. The approach includes a structured pipeline for shell tracking (context integration, rule drafting, config extraction, post-processing, validation) and a DAG-based notebook decomposition that resolves a global notebook state into file-based dependencies. The results show reliable workflow extraction, adherence to best practices, and a practical path toward reproducible, maintainable bioinformatics analyses.

Abstract

Reproducibility and sustainability present significant challenges in bioinformatics software development, where rapidly evolving tools and complex workflows often result in short-lived or difficult-to-adapt pipelines. This paper introduces Snakemaker, a tool that leverages generative AI to facilitate researchers build sustainable data analysis pipelines by converting unstructured code into well-defined Snakemake workflows. Snakemaker non-invasively tracks the work performed in the terminal by the researcher, analyzes execution patterns, and generates Snakemake workflows that can be integrated into existing pipelines. Snakemaker also supports the transformation of monolithic Ipython Notebooks into modular Snakemake pipelines, resolving the global state of the notebook into discrete, file-based interactions between rules. An integrated chat assistant provides users with fine-grained control through natural language instructions. Snakemaker generates high-quality Snakemake workflows by adhering to the best practices, including Conda environment tracking, generic rule generation and loop unrolling. By lowering the barrier between prototype and production-quality code, Snakemaker addresses a critical gap in computational reproducibility for bioinformatics research.

Snakemaker: Seamlessly transforming ad-hoc analyses into sustainable Snakemake workflows with generative AI

TL;DR

Biology software pipelines suffer from reproducibility and sustainability issues due to evolving tools and ad-hoc scripts. Snakemaker introduces a generative AI-powered workflow transformer that non-invasively converts shell history and IPython notebooks into Snakemake workflows, while tracking environments and documenting changes. It provides two working modes (Shell and Notebook) and an integrated chat assistant, all implemented as a VSCode extension with GitHub Copilot integration. The approach includes a structured pipeline for shell tracking (context integration, rule drafting, config extraction, post-processing, validation) and a DAG-based notebook decomposition that resolves a global notebook state into file-based dependencies. The results show reliable workflow extraction, adherence to best practices, and a practical path toward reproducible, maintainable bioinformatics analyses.

Abstract

Reproducibility and sustainability present significant challenges in bioinformatics software development, where rapidly evolving tools and complex workflows often result in short-lived or difficult-to-adapt pipelines. This paper introduces Snakemaker, a tool that leverages generative AI to facilitate researchers build sustainable data analysis pipelines by converting unstructured code into well-defined Snakemake workflows. Snakemaker non-invasively tracks the work performed in the terminal by the researcher, analyzes execution patterns, and generates Snakemake workflows that can be integrated into existing pipelines. Snakemaker also supports the transformation of monolithic Ipython Notebooks into modular Snakemake pipelines, resolving the global state of the notebook into discrete, file-based interactions between rules. An integrated chat assistant provides users with fine-grained control through natural language instructions. Snakemaker generates high-quality Snakemake workflows by adhering to the best practices, including Conda environment tracking, generic rule generation and loop unrolling. By lowering the barrier between prototype and production-quality code, Snakemaker addresses a critical gap in computational reproducibility for bioinformatics research.
Paper Structure (8 sections, 3 figures)

This paper contains 8 sections, 3 figures.

Figures (3)

  • Figure 1: Bash commands conversion pipeline. The current workflow is included in the model's context (a) before generating the new rules (b). A second LLM pass extracts the config (c) and a post-processing step performs some fixes and merges rules with the previous workflow (d). The new workflow is fed to Snakemake (e.1); if errors arise (e.1b) they are either fed to the LLM for direct fixing (e.2b) or follow a two-step pipeline (e.2a). The resulting rule return in the pipeline from postprocessing.
  • Figure 2: Notebook conversion pipeline. The input notebook is parsed with regex and the LLM (a.1, a.2) to transform and annotate cells with read and write sets and cells' states. The DAG is built from the annotated cells (b), and in case of errors a second LLM pass is performed (b.1). The user can modify the cells' annotations (b.2) and consequently the DAG. The DAG is then fed to the LLM to generate additional code blocks and Snakemake rules (c); the user can manually change them (c.1), in which case the LLM pass is repeated to propagate changes. The set of rules and scripts can then be fed to the conversion pipeline described in figure \ref{['fig:bash']} from step b.
  • Figure 3: Screenshot from Snakemaker GUI. Bash conversion feature.