Skip to content

Repository files navigation

genoio

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.

Install

To install the most recent release:

pip install genoio

Or the latest:

pip install git+https://github.com/mancusolab/genoio.git

Documentation

For complete documentation and examples, see the documentation site.

Quick Example

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.

License

MIT. See LICENSE.


Notes

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.

About

Minimalist API for parsing genotype files into Numpy data structures, backed by Rust.

Topics

Resources

Code of conduct

Stars

10 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages