Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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.2.dev1

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

Total release size: 102.9 MB

Release files / gen-0.3.2.dev1-cp311-abi3-win_amd64.whl

Download URL gen-0.3.2.dev1-cp311-abi3-win_amd64.whl
Size 19.7 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
a9d4da70b5605f93b26a05a6ecafd91a7a1279423a6c6a453c164d36bbaf3f15
BLAKE2b-256 checksum
How to use checksums
2f2454ccd1c9c21b82a55349d031f6c4d4000f1fe510365cd419caa0b71d7d5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.2.dev1-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL gen-0.3.2.dev1-cp311-abi3-manylinux_2_28_x86_64.whl
Size 22.2 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
db93c7a656953de0fc2402f96d74a063885996aee74d2dc8155d8d7beaac28ca
BLAKE2b-256 checksum
How to use checksums
d3816bf44589f9c7e7a1e0491fde53609aaed2d05d8d42b96baf8e12d101f2d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.2.dev1-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL gen-0.3.2.dev1-cp311-abi3-manylinux_2_28_aarch64.whl
Size 21.4 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
626fab093a5978b0b946a84283d31a45b9b73832b21ae72b1e569539cb001316
BLAKE2b-256 checksum
How to use checksums
a435b0e0be8a74fe5a80300b374b0eb3ecc86793aa09ea56611e5658afe9bbd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.2.dev1-cp311-abi3-macosx_11_0_arm64.whl

Download URL gen-0.3.2.dev1-cp311-abi3-macosx_11_0_arm64.whl
Size 18.5 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1e404d0ef2199fd843de603b41524ed697de4ff90661527f3d6dd5b447d61b43
BLAKE2b-256 checksum
How to use checksums
ae55f92e832b7173b636f13cdabd743ec9f852b0814690b6945e1ed4397c7f5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.2.dev1-cp311-abi3-macosx_10_12_x86_64.whl

Download URL gen-0.3.2.dev1-cp311-abi3-macosx_10_12_x86_64.whl
Size 21.0 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
414584c492efefb386c2cf99e62a9120b38bd0a8959a62427ce44573a9a7d356
BLAKE2b-256 checksum
How to use checksums
261f3d39686a29a75d562edde1a05ba2c3facb860709917f5c075c19e39149c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","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.2.dev1 This release

5 release files

0.3.1

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