Skip to main content

scikit-learn-compatible genomic prediction and selection from SNP marker data

Project description

genoselect

scikit-learn-compatible genomic prediction and selection from SNP marker data.

PyPI Python Downloads tests License: MIT DOI

Genomic selection is dominated by R packages (rrBLUP, BGLR, sommer). genoselect brings a clean, Pythonic, scikit-learn-compatible toolkit to the same problem: fit, cross-validate, and benchmark genomic-prediction models from 0/1/2 marker matrices, with a properly implemented GBLUP by REML at its core.

Features

  • VanRaden genomic relationship matrix [vanraden_grm].
  • GBLUP by REML — the Endelman (2011) spectral method, with equivalent ridge-regression marker effects for out-of-sample prediction (GBLUP).
  • A common model interface — GBLUP, elastic net, random forest, gradient boosting, and a stacked super-learner ensemble, all as scikit-learn estimators (make_model, available_models).
  • Breeding-relevant cross-validation — k-fold and leave-group-out, reporting predictive ability honestly (cross_validate, benchmark).
  • GWAS — single-marker association (gwas) with PC structure correction, plus position-aware manhattan and qq_plot helpers.
  • Read your own dataread_vcf, read_plink, read_hapmap load VCF / PLINK / HapMap files into 0/1/2 matrices (pure-Python, no extra deps).
  • Simulation and QCsimulate_population, qc_markers, impute_markers.

Install

pip install genoselect

Or from source:

git clone https://github.com/mqfarooqi1/genoselect
cd genoselect && pip install -e .

Quick start

import genoselect as gs

# simulate a population with a heritable trait
pop = gs.simulate_population(n=250, m=800, n_qtl=40, h2=0.5, seed=1)

# fit GBLUP and inspect heritability + breeding values
fit = gs.GBLUP().fit(pop.geno, pop.pheno)
print(fit.h2_)            # estimated genomic heritability
print(fit.gebv_[:5])      # genomic estimated breeding values

# predict new genotypes
pred = fit.predict(pop.geno[:10])

# benchmark several models by cross-validation
cv = gs.benchmark(pop.geno, pop.pheno, k=5, random_state=1)
print(cv.summary())

Load your own data instead of simulating:

gd = gs.read_vcf("genotypes.vcf.gz")     # or read_plink("data"), read_hapmap("data.hmp.txt")
fit = gs.GBLUP().fit(gd.geno, phenotypes)

Because the estimators follow the scikit-learn API, they compose with the wider ecosystem (Pipeline, GridSearchCV, cross_val_score, …).

Methods

The genomic relationship matrix follows VanRaden (2008, doi:10.3168/jds.2007-0980); the mixed-model solver follows Endelman (2011, doi:10.3835/plantgenome2011.08.0024); the genomic-selection framework follows Meuwissen, Hayes & Goddard (2001, doi:10.1093/genetics/157.4.1819).

Tests

pip install -e ".[test]"
pytest

Author: Muhammad Farooqi · MIT licensed. A Python companion to the R package GSbench.

Project details


Download files

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

Source Distribution

genoselect-0.3.1.tar.gz (492.7 kB view details)

Uploaded Source

Built Distribution

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

genoselect-0.3.1-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file genoselect-0.3.1.tar.gz.

File metadata

  • Download URL: genoselect-0.3.1.tar.gz
  • Upload date:
  • Size: 492.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for genoselect-0.3.1.tar.gz
Algorithm Hash digest
SHA256 87fd8e5bf54d5d5bf23ec6884e9482061914ba0f9008244a44e5e0e04296e776
MD5 f0c74720dc222a65a7757bc6ed4637fb
BLAKE2b-256 ce2aee1644ff036231d9860112de0fa3d8366c9678eeb410b0a510ecb6b22a5e

See more details on using hashes here.

File details

Details for the file genoselect-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: genoselect-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for genoselect-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60c1752ccf6be8484a366d69b91fae5b77a106220fad5b8d0e640de626496de0
MD5 3610d2a47e747f81acd3e154cfdc7dd1
BLAKE2b-256 d80d3f47fea0ae61e1c18a48edd6122120b4085f4b8e326eb836e2703d30d075

See more details on using hashes here.

Supported by

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