Skip to main content

fastrho

Fine-scale recombination maps from population genotypes, without per-dataset training.

API tests 31 tests passing PyPI Documentation Tested on Python 3.10 and 3.12 Research alpha

fastrho method schematic showing SNP feature tokens, bidirectional state-space inference, and interval-level recombination-rate output

fastrho is a research package for amortized, fine-scale recombination-map inference. A bidirectional Mamba-2 encoder-decoder reads one order-invariant feature token per SNP and estimates the population-scaled recombination rate for every adjacent-SNP interval.

What it does

Input Phased or compatible unphased population genotypes, including single-contig VCFs
Output Adjacent-SNP interval estimates and optional 0-based, half-open BED maps
Inference One pretrained model with overlapping-context inference; no per-dataset retraining
Backbone Bidirectional Mamba-2 state-space encoder-decoder
Rates Population-scaled rho and absolute rate conditional on the recorded Ne_used
Stage Public research alpha

Installation

Install the CPU package and common VCF/DataFrame helpers from PyPI:

python -m pip install "fastrho[io]"

GPU inference requires Linux, an NVIDIA GPU, and compatible PyTorch, CUDA, and Mamba-SSM builds. For the fully locked inference environment, clone the public source repository:

git clone https://github.com/kevinkorfmann/fastrho.git
cd fastrho
uv sync --frozen --extra inference --extra io
source .venv/bin/activate

Inference is tested on Python 3.10 and 3.12. uv is recommended for inference because the lockfile also records the extension build requirements. CPU-only VCF inspection, simulation, and data conversion do not load the model. Record the environment used for a run with its checkpoint IDs.

Download the verified model bundle

The domain-randomized-v1 release contains the checkpoint and its required feature-statistics companion. Keep the two files together; feat_stats.npz is part of the trained model and must not be recomputed from a prediction cohort.

fastrho-fetch-model \
  --model-id domain-randomized-v1 \
  --output-dir downloaded-models

The public, checksummed model artifacts are also available from the domain-randomized-v1 release.

Make a map

fastrho predict \
  --vcf cohort.vcf.gz \
  --chrom chr1 \
  --checkpoint downloaded-models/domain-randomized-v1/model.ckpt \
  --stats downloaded-models/domain-randomized-v1/feat_stats.npz \
  --mutation-rate 1.5e-8 \
  --ne 10000 \
  --input-mode auto \
  --missing drop-site \
  --window-size 50000 \
  --out chr1.50kb.bed

VCF input is restricted to one contig per prediction call. Missing sites are dropped rather than imputed as reference, and positions are converted to 0-based, half-open BED coordinates. input_mode="auto" distinguishes phased from unphased genotype separators; it cannot establish ancestral polarization.

Python API

from pathlib import Path
import fastrho

bundle = Path("downloaded-models/domain-randomized-v1")

pred = fastrho.quick_map_from_vcf(
    "cohort.vcf.gz",
    bundle / "model.ckpt",
    bundle / "feat_stats.npz",
    contig="chr1",
    mutation_rate=1.5e-8,
    Ne=10_000,
    input_mode="auto",
    missing="drop-site",
    device="cuda:0",
)

df = fastrho.to_dataframe(pred, chrom="chr1")
fastrho.write_bed(pred, "chr1.50kb.bed", chrom="chr1", window_size=50_000)

Before interpreting a map

An LD-based estimate is a population recombination map, not a direct observation of contemporary crossovers. Demographic history, structure, inversions, selection, relatedness, selfing, and gene conversion can change the signal. For a new cohort, record the checkpoint and statistics hashes, input view, filtering, mutation rate, effective population size, coordinates, and reporting window; then evaluate split-sample repeatability, realistic simulations, or an independent map.

Documentation

The public documentation contains the software guide, method schematic, and synthetic example.

Verification

python -m pytest tests/test_io_api.py tests/test_phase1_target.py \
  tests/test_phase2_features.py tests/test_stitching.py
python scripts/release_check.py
python -m build

Citation and license

Citation metadata are provided in CITATION.cff. Code is licensed under the MIT License; external datasets and pretrained weights retain their own licenses and terms.

Metadata

Release files for fastrho 0.1.1

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

Source distribution (sdist)

Source distribution for fastrho 0.1.1
File Size Uploaded
fastrho-0.1.1.tar.gz 416.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastrho 0.1.1
File Interpreter ABI Platform
fastrho-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 476.6 kB

Release files / fastrho-0.1.1.tar.gz

Download URL fastrho-0.1.1.tar.gz
Size 416.0 kB
Tags Source
SHA-256 checksum
How to use checksums
875ba99bc2f67c3106d7f1cf41f6d96b70725f79796515a1c7d9969741dc202c
BLAKE2b-256 checksum
How to use checksums
b60b123e7dbad035d3c242858463e4d73c71ef8d2f62dba355e03fed04de5271
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / fastrho-0.1.1-py3-none-any.whl

Download URL fastrho-0.1.1-py3-none-any.whl
Size 60.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0595aecf3a237625de3abe785eb2c830040d216389f6e9a949885de12ae6a1ff
BLAKE2b-256 checksum
How to use checksums
5d9712af797cd74c3e1468a9b9a363e3dfedd9d9d43b5ccf0fdccdb77774b814
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 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