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).
  • 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.0.tar.gz (587.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.3.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: genoselect-0.3.0.tar.gz
  • Upload date:
  • Size: 587.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.3.0.tar.gz
Algorithm Hash digest
SHA256 03c66b9d5bd9c04e06c5fd9e18d0774e028ca737f15585a3092fb7c5df8afa8f
MD5 8bde6b3f648ebc7709cdfddb3e9ca156
BLAKE2b-256 3a3a9d746becbae212771ee96713a22640c3728638ce4e64a92eefbac296a57a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: genoselect-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa11e29b10828ccb28775a5488e53ad536ceb77b08fd3644ffec3695cc6878a7
MD5 781430e4fe482fb5b7b06b3251267a59
BLAKE2b-256 c13f5296b3f2ba1f828b58b83601d06aa0d10d4c5f51d7d9b9988211293a950c

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