genoio reads VCF/BCF, PLINK1, PLINK2, and BGEN genotype sources into Python
matrices. The public API is Python; the file readers are Rust. This pairing
keeps the interface simple while moving parsing and matrix construction into
compiled, efficient code.
It is built for downstream genetics tools that need stable matrix contracts: samples on rows, variants on columns, and metadata aligned to returned matrices, blocks, or regions.
To install the most recent release:
pip install genoioOr the latest:
pip install git+https://github.com/mancusolab/genoio.gitFor complete documentation and examples, see the documentation site.
import genoio
ds = genoio.pfile("data/chr22_hg38")
samples = ds.samples()
y = load_phenotype_vector(samples["iid"])
C = load_covariates(samples["iid"])
with ds.iter_blocks(10_000, return_variants=True) as blocks:
for X, variants in blocks:
# X has shape (samples, variants_in_this_block).
# `y` and `C` must be aligned to the rows described by `samples`.
association_scan(X, y, C, variants=variants)Use read(...) for one matrix, iter_blocks(...) for streaming scans, and
iter_regions(...) for interval-based workflows.
MIT. See LICENSE.
genoio was developed by members of the Mancuso Lab with assistance from Codex,
following the practices described in the
scientific-software-playbook
and coding-skills repositories.