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

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).
  • 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.2.0.tar.gz (74.1 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.2.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for genoselect-0.2.0.tar.gz
Algorithm Hash digest
SHA256 86b94138521885339306ca953838fb34af7b59aceacc4bb14b966bfc4981b958
MD5 adf55f9f702d31b1392014d2f1edb58e
BLAKE2b-256 3153e7eff7409ded9e0e6fc11c8a9fd4459ad39b27f7fc5a067a3f9edcf9f3bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: genoselect-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b96a0cf81fd49632aaa4a95ca2aa452133ef5a70620226e795cbc72b1ea91ed
MD5 0c025ab1c50e60222d29489347d8a2d0
BLAKE2b-256 2fa5584f4365aaed764e93736f6fe7860101a848b061aebd5388723052d55167

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