fastrho
Fine-scale recombination maps from population genotypes, without per-dataset training.
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
Clone the public source repository and create the locked environment:
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 and requires Linux, an NVIDIA GPU, and a CUDA toolchain
compatible with the locked PyTorch and Mamba-SSM builds. uv is recommended 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.
python3 scripts/fetch_model_release.py \
--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.
- Quickstart
- Python API
- Use fastrho with your dataset
- Interpret the output
- Checkpoints
- Known-answer simulation
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastrho-0.1.0.tar.gz.
File metadata
- Download URL: fastrho-0.1.0.tar.gz
- Upload date:
- Size: 413.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b02e5a040aff467ee045696c1e305288de126b0c7851965ab41a935f87dfd203
|
|
| MD5 |
d91a74fa8f0bca3875cc2e22bd63ac42
|
|
| BLAKE2b-256 |
b72781d6ebdd415e1fe87092b48e083490900bec4777b0e098cad8131d35d002
|
Provenance
The following attestation bundles were made for fastrho-0.1.0.tar.gz:
Publisher:
publish.yml on kevinkorfmann/fastrho
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastrho-0.1.0.tar.gz -
Subject digest:
b02e5a040aff467ee045696c1e305288de126b0c7851965ab41a935f87dfd203 - Sigstore transparency entry: 2319539943
- Sigstore integration time:
-
Permalink:
kevinkorfmann/fastrho@24b4b1329c8bf2353ec3e8da67579fa0e0010db8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/kevinkorfmann
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@24b4b1329c8bf2353ec3e8da67579fa0e0010db8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file fastrho-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fastrho-0.1.0-py3-none-any.whl
- Upload date:
- Size: 58.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
245c96b91b1f8ec0b2957a21a5f28098be92a9f3d10a976befcb5582b6e9df89
|
|
| MD5 |
30717947bd0994fcf4b7175be8b3e147
|
|
| BLAKE2b-256 |
a1b68d23bb8ac81005469e7c119a8a8e2944aaca1463723cd6c4ea1b44e195a7
|
Provenance
The following attestation bundles were made for fastrho-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on kevinkorfmann/fastrho
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastrho-0.1.0-py3-none-any.whl -
Subject digest:
245c96b91b1f8ec0b2957a21a5f28098be92a9f3d10a976befcb5582b6e9df89 - Sigstore transparency entry: 2319540230
- Sigstore integration time:
-
Permalink:
kevinkorfmann/fastrho@24b4b1329c8bf2353ec3e8da67579fa0e0010db8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/kevinkorfmann
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@24b4b1329c8bf2353ec3e8da67579fa0e0010db8 -
Trigger Event:
release
-
Statement type: