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]

Without the extra, Python plot calls fall back to a readable textual graph rendering and explain how to install the widget.

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.3.1

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.3.1
File
gen-0.3.1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
gen-0.3.1-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details
gen-0.3.1-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details
gen-0.3.1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
gen-0.3.1-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 101.7 MB

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

Download URL gen-0.3.1-cp311-abi3-win_amd64.whl
Size 19.5 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b036f8e344c15a6a0feec6fceadb8aaca4558657c4cacd50dfef58256f026ad4
BLAKE2b-256 checksum
How to use checksums
92f5a3be852e698b2af6c5ddcef26021bfe10e5fddea701058df762bee113bb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.3.1-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL gen-0.3.1-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
06ae3bd4f93ad9ac92ce2b16211a95803d3c1b96031ca7e0aa028db4b38ecea0
BLAKE2b-256 checksum
How to use checksums
93181b78a9d57098e5444d68f7ac45d7a4962400d5be4b20e609a701016137ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.3.1-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL gen-0.3.1-cp311-abi3-manylinux_2_28_aarch64.whl
Size 21.2 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
31125bba21c8a9087d8b136da9c55d37124981b2f09ebe2e40e3456be36f4bb0
BLAKE2b-256 checksum
How to use checksums
6635a03d3290af0ff315ffc2d2ed2ee3a69b9963ccbf64242206ea790765ed76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.3.1-cp311-abi3-macosx_11_0_arm64.whl

Download URL gen-0.3.1-cp311-abi3-macosx_11_0_arm64.whl
Size 18.3 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
596113faf23bd5a450bda20cbdab9544d30c19b7ae8c0a0dca391d3ad14af591
BLAKE2b-256 checksum
How to use checksums
438dfffc7909d12e3500f992a7f619e69fdd8bc961a780789c6fa5b4142854bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.3.1-cp311-abi3-macosx_10_12_x86_64.whl

Download URL gen-0.3.1-cp311-abi3-macosx_10_12_x86_64.whl
Size 20.8 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
f37a746699dba7a48903fe44770dc0789994524d541bb5c1caca02f9664f2a6a
BLAKE2b-256 checksum
How to use checksums
39631cb9da75a10012bf61cb10d88ab6ade564d9d9320e583bf52cc6a6b366d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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

This release

0.3.1 This release

5 release files

0.3.0

5 release files

0.2.2

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