bioflow: one-line comparative-genomics recipes + Tier-A SDK, orchestrated over per-tool Docker BioContainers.
Project description
bioflow
๐ Documentation: https://hope9901.github.io/bioflow/
A bioinformatics SDK + cookbook for one-line comparative-genomics analyses on a single workstation with local Docker. Each tool runs in its own container (no native installs), each recipe is one CLI call, and a privacy-first LLM companion is available when you want it.
What you get
- 19 cookbook recipes invokable as one-liners:
- Comparative genomics (8): pangenome, ANI, phylogeny, GWAS, gene-family evolution, AMR/VF catalogue, COG enrichment, NCBI download.
- Per-pipeline (11): prokaryote_assembly, eukaryote_assembly, rnaseq_deg, metagenomics_profile, metagenome_assembly, scrna_seq, chip_seq, atac_seq, methylation_wgbs, proteomics_dda, germline_variants.
- 110 tools registered across 16 categories, all pulled as BioContainer images at run time โ nothing to install on the host beyond Docker + Python.
- Hardware-aware: every tool is classified
installable/runnable_slow/incompatibleagainst your CPU / RAM / GPU / arch. - Input-hash caching: re-running a recipe with unchanged inputs returns in seconds.
- Privacy-first LLM companion (optional): terminology Q&A, sanitized error diagnosis, tool-registration assist. Disabled by default.
Install
From a git checkout (for development / editing recipes):
git clone https://github.com/hope9901/bioflow
cd bioflow
pip install -e .
# Verify host (Docker, RAM, disk, registry, โฆ) in one command
bioflow doctor
As a package (the tool registry is bundled into the wheel):
pip install bioflowkit # PyPI distribution name (from 0.2.0)
bioflow doctor # CLI + Python import stay `bioflow`
bioflow recipe list # works from any directory
Why the two names? The PyPI namespace
bioflowwas taken in 2018. Everything else โfrom bioflow import stage,bioflowCLI,https://github.com/hope9901/bioflowโ is unchanged.
As a container (no Python setup needed):
docker build -f docker/core/Dockerfile -t bioflow .
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$PWD":/workspace -v /refs:/refs \
bioflow recipe run prokaryote_assembly --r1 ... --r2 ... --out /workspace/out
The orchestrator mounts the host Docker socket and launches each tool as a sibling container (not Docker-in-Docker).
Optional one-time setup for the LLM companion
bioflow setup # detects CPU/RAM/GPU, recommends a backend
bioflow setup --backend disabled # explicit no-LLM mode (default)
bioflow setup --backend anthropic # cloud (needs ANTHROPIC_API_KEY env)
bioflow setup --backend ollama # local Ollama instance
Writes ~/.bioflow/config.yaml. Nothing is sent to any model until you
opt in. See LLM companion for the safety model.
Quick start โ Cookbook recipes
Eight curated end-to-end pipelines. Run from the CLI; no Python required.
bioflow recipe list # show every recipe + its DAG
bioflow recipe show pangenome # render the DAG without running
bioflow recipe run pangenome --taxon Dickeya --max 13 --out ./out
bioflow recipe run pangenome --taxon Pectobacterium --dry-run
Comparative genomics
| Recipe | One-line description |
|---|---|
download_taxon |
Every RefSeq assembly of a taxon (no Docker) |
pangenome |
NCBI fetch โ parallel Prokka โ Roary |
phylogeny |
Single-copy core โ MAFFT ร N โ IQ-TREE ML |
ani_matrix |
All-vs-all FastANI |
gwas |
Scoary over a Roary GPA |
cafe_evolution |
CAFE5 gene-family expansion / contraction |
amr_vf_catalogue |
ABRicate ร N genomes ร M DBs |
cog_enrichment |
DIAMOND vs COG-2024 โ per-bucket categories |
One recipe per pipeline area
| Recipe | Pipeline | One-line description |
|---|---|---|
prokaryote_assembly |
Genome assembly | fastp โ SPAdes โ QUAST โ Prokka |
eukaryote_assembly |
Genome assembly | NanoPlot โ Flye โ Medaka โ compleasm (long-read) |
rnaseq_deg |
RNA-seq DEG | fastp โ Salmon โ DESeq2 (tximport bridge) |
metagenomics_profile |
Metagenomics | fastp โ Kraken2 โ Bracken |
metagenome_assembly |
Metagenomics | fastp โ MEGAHIT โ minimap2 โ MetaBAT2 โ CheckM2 |
scrna_seq |
scRNA-seq | STARsolo โ Scanpy (10x, license-free) |
chip_seq |
ChIP-seq | TrimGalore โ Bowtie2 โ Picard โ MACS3 โ HOMER |
atac_seq |
ATAC-seq | TrimGalore โ Bowtie2 โ Picard โ MACS3 โ TOBIAS |
methylation_wgbs |
Bisulfite | TrimGalore โ Bismark โ methylKit |
proteomics_dda |
LC-MS/MS | msconvert โ Comet โ Percolator (open-source) |
germline_variants |
Variant calling | fastp โ BWA โ GATK โ bcftools โ SnpEff |
Recipes use input-hash caching automatically โ a second run with the same inputs returns in seconds. Failed stages retry with bumped resources where configured (e.g. CAFE5 โ 2ร RAM).
Verify your machine
Run this first after install:
bioflow doctor # 12-point host self-check
bioflow doctor --json # CI-friendly structured output
doctor verifies Python, the Docker CLI + daemon, the docker socket
(sibling-container path), CPU / RAM / disk, the registry, and your
config + workspace directories โ each failure prints a one-line fix hint
and the command exits non-zero on the first FAIL.
Deeper inspection:
bioflow hw # CPU / RAM / GPU / disk profile
bioflow tools # all tools, grouped by compatibility
bioflow tools --category assembly # filter by category
bioflow tools --recommend genome_assembly # ranked preset picks for this host
Reference databases
Some pipelines need external databases (Pfam, eggNOG, BUSCO, etc.).
bioflow ships a small catalog with a progress-bar downloader.
bioflow db list # show available DBs
bioflow db fetch busco_bacteria --dest /refs
bioflow db verify busco_bacteria --dest /refs
| Key | Size | Used by |
|---|---|---|
busco_bacteria |
0.07 GB | busco |
busco_insecta |
0.08 GB | busco |
busco_vertebrata |
0.30 GB | busco |
pfam |
0.50 GB | interproscan |
dfam_curated |
2.00 GB | repeatmasker, earlgrey |
uniprot_sprot |
0.25 GB | braker3 |
eggnog |
8.50 GB | eggnog_mapper |
Preset pipelines vs recipes โ which do I use?
bioflow ships two entry points for the same workflows:
Recipe (bioflow recipe run) |
Preset (bioflow recommend --preset) |
|
|---|---|---|
| Defined in | Python (@stage + @pipeline) |
YAML (declarative chain of tool IDs) |
| Customisation | Edit Python; full control flow, fan-out, retry | Edit YAML; swap tool IDs |
| Hardware filter | Per-stage cpu/ram_gb declared in @stage |
Whole-preset score from registry YAMLs |
| Best for | Active execution, tuning, custom logic | Picking the recommended chain on this host |
Presets that have a matching recipe are linked via a recipe: field โ
e.g. prokaryote_denovo_short.yaml points to the prokaryote_assembly
recipe. Pick whichever surface fits your workflow.
Preset pipelines (multi-stage YAML path)
For workloads that don't fit the cookbook recipes (single-sample read QC โ assembly โ annotation), use the preset pipelines:
cp examples/config_prokaryote_short.yaml my_config.yaml
# edit my_config.yaml โ set r1/r2 paths and workdir
bioflow recommend --preset prokaryote_denovo_short --config my_config.yaml
bioflow recommend --preset prokaryote_denovo_short --config my_config.yaml --dry-run
Or build a custom plan interactively:
bioflow custom --pipeline genome_assembly --out my_plan.yaml
bioflow run my_plan.yaml
Available presets:
| Preset | Pipeline | Species | Data type | Mode |
|---|---|---|---|---|
prokaryote_denovo_short |
genome_assembly | prokaryote | short | de_novo |
prokaryote_denovo_hybrid |
genome_assembly | prokaryote | hybrid | de_novo |
eukaryote_denovo_hifi |
genome_assembly | eukaryote | long_hifi | de_novo |
eukaryote_denovo_hybrid |
genome_assembly | eukaryote_small | hybrid | de_novo |
eukaryote_resequencing |
genome_assembly | eukaryote | short | resequencing |
rnaseq_deseq2_standard |
rnaseq_deg | eukaryote | short | de_novo |
metagenomics_kraken2_standard |
metagenomics | any | short | profiling |
metagenomics_metaphlan4_standard |
metagenomics | any | short | profiling |
scrna_seq_10x_seurat |
scrna_seq | eukaryote | short | de_novo |
scrna_seq_10x_scanpy |
scrna_seq | any | short | de_novo |
chip_seq_standard |
chip_seq | any | short | peak_calling |
atac_seq_standard |
atac_seq | any | short | peak_calling |
methylation_bismark_wgbs |
methylation | any | short | wgbs |
proteomics_msfragger_dda |
proteomics | any | ms_dda | dda |
Pipeline stages (overview)
| Pipeline | Stages | Example tools |
|---|---|---|
| Genome Assembly & Annotation (6) | Read QC ยท Assembly ยท Assembly QC ยท Repeat masking (eukaryote) ยท Structural annotation ยท Functional annotation | fastp ยท SPAdes/hifiasm/Flye ยท QUAST/BUSCO ยท RepeatModeler ยท Prokka/BRAKER ยท eggNOG-mapper |
| RNA-seq DEG (4) | QC ยท Alignment/Quant ยท DEG ยท Enrichment | fastp ยท STAR/Salmon ยท DESeq2 ยท clusterProfiler |
| Metagenomics (5) | QC ยท Host removal ยท Taxonomic ยท Functional ยท Diff-abundance | fastp ยท KneadData ยท Kraken2/MetaPhlAn4 ยท HUMAnN3 ยท LEfSe |
| scRNA-seq (5) | Demux/Align ยท QC ยท Cluster ยท Marker ยท Trajectory | Cell Ranger ยท Scanpy/Seurat ยท Monocle3 |
| ChIP-seq / ATAC-seq (5) | QC ยท Align ยท Peak call ยท Annotation/Coverage ยท Motif | TrimGalore ยท Bowtie2 ยท MACS3 ยท HOMER/deepTools ยท TOBIAS |
| Bisulfite Methylation (4) | QC ยท Bisulfite align ยท Extract ยท DMR | TrimGalore ยท Bismark ยท MethylKit |
| LC-MS/MS Proteomics (5) | Convert ยท Search ยท FDR ยท Quant ยท Stats | msconvert ยท MSFragger ยท Percolator ยท FragPipe/MaxQuant |
LLM companion
bioflow ships a thin LLM helper that never runs as part of the critical execution path โ it only proposes text the user reviews.
| Capability | Data sent to model | Default |
|---|---|---|
bioflow llm explain "<term>" |
the term + 1 category word | safe; runs once a backend is configured |
bioflow llm diagnose --stage โฆ --command โฆ --stderr โฆ |
command + last 2 KB of stderr, redacted | opt-in |
bioflow llm new-tool --tool prokka --help-file h.txt |
tool name + its public --help output |
opt-in |
bioflow llm suggest --tool prokka --intent "..." |
tool name + user-typed intent | opt-in |
bioflow llm redact (stdin โ stdout) |
nothing โ local-only utility | always works |
bioflow llm audit |
nothing โ reads local log | always works |
Backends: disabled (default) ยท ollama (local) ยท anthropic
(cloud) ยท openai (cloud).
Auto-redaction before every diagnose call replaces:
C:\Users\* / /Users/* / /home/* โ <USER>, workspace path โ
<WORKSPACE>, emails โ <EMAIL>, IPv4 โ <IP>, 40+ char tokens โ
<TOKEN>, plus any custom regex you supply.
Daily cost cap (cloud backends only): set daily_cost_cap_usd in
~/.bioflow/config.yaml (or BIOFLOW_LLM_DAILY_CAP_USD env var). Any
call whose pre-estimate would push the day's cumulative spend above the
cap is refused โ no token is sent. Inspect today's usage with
bioflow llm audit.
Resolution order for every LLM knob:
explicit argument โ env var โ ~/.bioflow/config.yaml โ disabled.
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CLI recipe / recommend / custom / run / db / setup / llm โ
โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโ
โ Python SDK + Orchestrator โ
โ @stage ยท @pipeline ยท cache ยท retry โ
โ Hardware filter ยท Report builder โ
โโโโโโโโฌโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ โ
โโโโโโโโโโโโผโโโโโโโ โโโโโโโโโโผโโโโโโโโโโโโโโโโโ
โ Tool Registry โ โ Docker Engine โ
โ 58 YAML tools โ โ Sibling-container ptn โ
โ in 15 categoriesโ โ Live log streaming โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
bioflow is never a daemon. Every command spins up briefly, does its
work, and exits.
Development
pip install -e ".[dev]"
python -m pytest tests/unit -q # 426 unit tests
python -m pytest tests/integration/ # requires Docker daemon
Project layout
bioflow/
cli.py CLI: hw ยท tools ยท recommend ยท custom ยท run ยท db ยท ncbi ยท update ยท recipe ยท setup ยท llm
sdk.py @stage / @pipeline / parallel='auto' / cache / retry
report.py HTML report accumulator (Report.add_section / add_figure / โฆ)
io.py CRLF-safe text, atomic write, HTTP download with retry
recipes/ 8 cookbook pipelines (auto-registered)
llm/ Opt-in LLM companion (explain / diagnose / new-tool / suggest / audit)
core/ Hardware profiler ยท registry loader ยท runner ยท planner ยท checkpoint ยท NCBI
registry/
schema.yaml JSON Schema for tool YAMLs
tools/ 58 tools in 15 categories (qc, assembly, alignment, comparative_genomics, โฆ)
presets/ 14 curated preset YAMLs
examples/ config_*.yaml for each pipeline + *_demo.py for the SDK
data/test/ Synthetic fixtures (ecoli_small, rnaseq_toy)
docker/ core/Dockerfile + docker-compose.yml (sibling-container)
docs/MAINTAINER.md Scheduled-update workflow (read this only if you own the GitHub repo)
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bioflowkit-0.2.0.tar.gz.
File metadata
- Download URL: bioflowkit-0.2.0.tar.gz
- Upload date:
- Size: 2.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f449e31f8aa89fafe1b17187565c7889672f489dd4e8213920d96e925a4bfae1
|
|
| MD5 |
4ea6e85e5187a615767dd747cec31948
|
|
| BLAKE2b-256 |
dc2e451739afff5820b6623483697d04254a924fbbd81b63eb369326fc52126c
|
Provenance
The following attestation bundles were made for bioflowkit-0.2.0.tar.gz:
Publisher:
release.yml on hope9901/bioflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bioflowkit-0.2.0.tar.gz -
Subject digest:
f449e31f8aa89fafe1b17187565c7889672f489dd4e8213920d96e925a4bfae1 - Sigstore transparency entry: 1798440221
- Sigstore integration time:
-
Permalink:
hope9901/bioflow@7a599d625d25b9ef4095f4331be4c6418b030dc3 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/hope9901
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7a599d625d25b9ef4095f4331be4c6418b030dc3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bioflowkit-0.2.0-py3-none-any.whl.
File metadata
- Download URL: bioflowkit-0.2.0-py3-none-any.whl
- Upload date:
- Size: 251.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0735a8a0fb5c342a2b53ef8160a607b6c7b2508c103da90809058461d508b95
|
|
| MD5 |
76fbb78c60b5b3e83fcdca3918f8bda8
|
|
| BLAKE2b-256 |
b3651320eeaf8a2f99959bd7faae1617d9457d3e52bf6d9c310e9e637d8258c5
|
Provenance
The following attestation bundles were made for bioflowkit-0.2.0-py3-none-any.whl:
Publisher:
release.yml on hope9901/bioflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bioflowkit-0.2.0-py3-none-any.whl -
Subject digest:
d0735a8a0fb5c342a2b53ef8160a607b6c7b2508c103da90809058461d508b95 - Sigstore transparency entry: 1798440375
- Sigstore integration time:
-
Permalink:
hope9901/bioflow@7a599d625d25b9ef4095f4331be4c6418b030dc3 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/hope9901
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7a599d625d25b9ef4095f4331be4c6418b030dc3 -
Trigger Event:
push
-
Statement type: