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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastrho-0.1.1.tar.gz (416.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastrho-0.1.1-py3-none-any.whl (60.6 kB view details)

Uploaded Python 3

File details

Details for the file fastrho-0.1.1.tar.gz.

File metadata

  • Download URL: fastrho-0.1.1.tar.gz
  • Upload date:
  • Size: 416.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fastrho-0.1.1.tar.gz
Algorithm Hash digest
SHA256 875ba99bc2f67c3106d7f1cf41f6d96b70725f79796515a1c7d9969741dc202c
MD5 3d1c6d7d722625e9212748775f35437a
BLAKE2b-256 b60b123e7dbad035d3c242858463e4d73c71ef8d2f62dba355e03fed04de5271

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastrho-0.1.1.tar.gz:

Publisher: publish.yml on kevinkorfmann/fastrho

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastrho-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: fastrho-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 60.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fastrho-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0595aecf3a237625de3abe785eb2c830040d216389f6e9a949885de12ae6a1ff
MD5 26e37bc81450cd3a24f5829937897d79
BLAKE2b-256 5d9712af797cd74c3e1468a9b9a363e3dfedd9d9d43b5ccf0fdccdb77774b814

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastrho-0.1.1-py3-none-any.whl:

Publisher: publish.yml on kevinkorfmann/fastrho

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page