Skip to main content

Gen

CI Crates.io PyPI License: Apache 2.0

Gen brings version control to genetic sequences. With it, you can track variants and edits to genes or whole genomes, across multiple generations and lineages. You can clone genome repositories, create branches, make edits, and push changes to a shared remote using the same workflow developers know from Git. It works across FASTA files, VCFs, GenBank records, and other common bioinformatics formats. Under the hood, Gen stores data as a sequence graph, allowing a single repository to represent a reference genome, known variants, and engineered modifications without repeatedly storing the same sequence.

Checking out a branch, merging in sequencing results, and browsing the combined graph in the terminal viewer

Install

Gen client: prebuilt binaries and installers are on the releases page for macOS, Linux (x64 / arm64), and Windows.

You can also install it with a package manager:

pip install gen
uv tool install gen
cargo install gen

Python package: pip install gen also installs the Python package. Install the jupyter extra to include an interactive graph widget for Jupyter and other anywidget-compatible notebooks:

pip install gen[jupyter]

R package: Install on macOS (Apple silicon) using the remotes package:

install.packages("remotes")
remotes::install_url(
  "https://github.com/genhub-bio/gen/releases/download/v0.2.0/genr_0.2.0-macos-arm64.tgz"
)

Windows builds are published as genr-windows-<version>.zip on the same releases page.

Quick start

Set up a repository

gen init
gen import fasta reference.fa --reference hg38

Branch, update, and inspect

# Branch before making changes
gen checkout --branch experiment/na12878

# Apply variants from a VCF
gen update vcf variants.vcf --reference hg38 --sample NA12878

# Review the operation log
gen operations

# Browse the graph in the terminal
gen view

Push to a remote

In order to upload data to a remote repository, you have to add a remote repository (call it origin here), log in to authenticate and optionally make it the default remote for this repository, and then run the push command:

gen remote add origin https://www.genhub.bio/api/repos/<user>/<repo>
gen remote login origin
gen remote set-default origin
gen push

Subsequent pushes from this repository only need gen push.

Python and R bindings

The Python package lets you import, edit, and export sequence graphs from Python. The R package covers the same workflows and interoperates with Bioconductor types such as DNAStringSet and GRanges. The jupyter extra adds an interactive widget for graph visualization and exploration. Remote operations (push and pull) require the client for now.

Example Python code to initialize or load a repository, import a sequence as reference, applying variants from a VCF file, and viewing the resulting sequence graph:

import gen

repo = gen.Repository(".")
repo.import_reference_fasta("reference.fa", "hg38")
sample = repo.update_with_vcf("variants.vcf", reference="hg38", sample="NA12878")[0]
sample.plot()

Equivalent R code:

library(genr)

repo <- Repository(".")
repo$import_reference_fasta("reference.fa", reference = "hg38")
sample <- repo$update_with_vcf(filename = "variants.vcf", sample = "NA12878", reference = "hg38")[[1]]
plot(sample)

Features

  • Every import, update, and merge is a recorded operation. You can roll back to any prior state with gen checkout, compare two branches with gen view-diff, or share a set of changes as a patch file.
  • Gen can import from FASTA, GenBank, GFA, VCF, GAF, and combinatorial part libraries, and export to FASTA, GenBank, or GFA for downstream tools like vg or Bandage.
  • Sequence search works across all paths in a graph, including IUPAC ambiguity codes, via gen search or repo.search() in Python and R.
  • GFF3 annotation tracks are visible in both the terminal viewer and the interactive widget.
  • For combinatorial library design, you define a parts list and a slot table; Gen builds the graph of all combinations without enumerating the sequences explicitly.
  • gen clone, gen push, and gen pull work against network-mounted filesystems or genhub.bio. Any public repository is clonable with a single URL.
  • The R package includes direct import from Bioconductor DNAStringSet and GRanges objects.

Designed for AI agents

Agents can interact with Gen through the command line or the Python API, which was designed with AI agents in mind. Nearly every user action has a programmatic equivalent, with methods returning samples and sequence graphs as Python objects that can be passed directly into subsequent operations. Graph visualizations in Python notebooks include embedded text representations that LLMs can interpret directly. Because every operation is recorded in the repository, agents can inspect history, compare revisions, and recover from failures.

Screenshots

Claude Code session using the Gen Python module to inspect a sequence variant DNA graph and its translated protein graph, identifying which of two SNPs is non-synonymous
Python: Claude reasons about a DNA graph and its protein translation, concluding that one of two SNPs is silent.
RStudio viewer showing an annotated expression-cassette graph with a highlighted restriction site at the TEF1p to crtE_native junction
R: finding a restriction site that stradles the junction between parts, from yeast_expression_library.Rmd.

Example workflows

  • Model a yeast cross: cross two beer-yeast strains from the 1002 Yeast Genomes collection, building the combined graph from either VCF variant calls or whole-genome alignment.
  • Explore a brewing-yeast variant graph in Python: analyse the FLO11 locus on a 9.1 kb S. cerevisiae chrIX fragment, searching and navigating the variant graph in the interactive widget.
  • Screen a combinatorial library in R: build a combinatorial YTK expression-cassette library, easily detecting a restriction site that appears only at one part junction, not in any individual part.

Data model

Gen represents sequences as a sequence graph: nodes hold sequence fragments, edges connect them, and any linear sequence is reconstructed by walking a defined path. New variants extend the graph without splitting existing nodes, so node IDs remain stable across updates. This differs from the segment graph model used by tools like vg, where the reference sequence is split into pieces to accommodate each variant; Gen converts between the two formats on GFA export. See docs/coordinates.md for a full explanation with diagrams.

Documentation

Full command reference, Python and R API docs, and tutorials are at genhub.bio/docs.

Building from source

Requires a Rust toolchain (rustup).

git clone https://github.com/genhub-bio/gen.git
cd gen
cargo build --release
# binary at ./target/release/gen

For Python and R bindings, see gen-python/README.md and gen-r/README.md.

Metadata

Release files for gen 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for gen 0.2.2
File
gen-0.2.2-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
gen-0.2.2-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details
gen-0.2.2-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details
gen-0.2.2-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
gen-0.2.2-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 101.3 MB

Release files / gen-0.2.2-cp311-abi3-win_amd64.whl

Download URL gen-0.2.2-cp311-abi3-win_amd64.whl
Size 19.4 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
396c9fea27b026d56dfcd5799075f867d843df73f6cbe334e2d817883d059bff
BLAKE2b-256 checksum
How to use checksums
99b5c8030e1fa8bb6facf34d068f38b842bcb94507ebf7645ba3bc6bf9cbc459
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gen-0.2.2-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL gen-0.2.2-cp311-abi3-manylinux_2_28_x86_64.whl
Size 21.9 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
9459859615af51e19692f9846db71fd25dd94494dcbc52b1531fdc3129d4a76d
BLAKE2b-256 checksum
How to use checksums
83d2e1823728aaaffc495c837bf4e5e1dbc4eb5f7ba4851bb8cd1609f9960c5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gen-0.2.2-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL gen-0.2.2-cp311-abi3-manylinux_2_28_aarch64.whl
Size 21.1 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
d0d32277602a9cce5eb52360791227fa3a03ce097b12364d183d156927146feb
BLAKE2b-256 checksum
How to use checksums
3d844b0dc3afc1dc8a9a63d5e1d94cfca313e322a446ce69ac78a2c60f1e31d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gen-0.2.2-cp311-abi3-macosx_11_0_arm64.whl

Download URL gen-0.2.2-cp311-abi3-macosx_11_0_arm64.whl
Size 18.2 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3e63e6ca82750f2f61af5e87ab78e129645502c3dffcc8a3a7dfb0f29a946e27
BLAKE2b-256 checksum
How to use checksums
ba3046639cfc2e1427050619380c69f1ba3fe7c68e1206f5e00c4ebdde3a12c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gen-0.2.2-cp311-abi3-macosx_10_12_x86_64.whl

Download URL gen-0.2.2-cp311-abi3-macosx_10_12_x86_64.whl
Size 20.7 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4f516e2f4e900b74628e5e6011b25a0b7806fb70d9b1dc30752ffc4c646961eb
BLAKE2b-256 checksum
How to use checksums
53de79abe09b2fe2c6d1a2d1f3eb33d66ad797e8a01d857b6649e04703068775
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.4.0

5 release files

0.3.1

5 release files

0.3.0

5 release files

This release

0.2.2 This release

5 release files

0.2.0

12 release files

0.1.22

9 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page