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

Total release size: 139.9 MB

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

Download URL gen-0.5.1-cp311-abi3-win_amd64.whl
Size 25.8 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
54c549892936527fb4bc2bceba30d73f7fc3732f949a6fecacca8aa0259e1075
BLAKE2b-256 checksum
How to use checksums
fe7181834aaa906b66384c9058ec092feaa5386ee7b7f20ec17e3106d252eb8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL gen-0.5.1-cp311-abi3-manylinux_2_28_x86_64.whl
Size 30.0 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
49227f4519131e65a571fefb5c246bbd384920fe36b528aca4295d5d9d51ed26
BLAKE2b-256 checksum
How to use checksums
163400d2a90a3ee69714d65ec02fe3d75d0e15f23978cc7cbfcdd78326dd57a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

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

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

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

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

Download URL gen-0.5.1-cp311-abi3-macosx_10_12_x86_64.whl
Size 28.1 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
22d46c69eba7955a5eda92936c918b50609bb726deeae700534bc26f73b15f9d
BLAKE2b-256 checksum
How to use checksums
5b2cce5e7047516cc63cbd18b6f87b9425c3f6f48a3a7a5fa3f227f0e69b1a0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for gen 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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