Skip to main content

A Python package for fast Mendelian sampling (co)variance and haplotype-based similarity in genomic selection

Project description

PyMSQ: a Python package for fast Mendelian sampling (co)variance and haplotype-based similarity in genomic selection

DOI

PyMSQ is an open-source Python package that enables breeders, geneticists, and quantitative biologists to estimate Mendelian sampling–related metrics—including variance, covariance, and haplotype-based similarities—in both plant and animal species. For simplicity, PyMSQ consists of a single module, msq.

Key Features

  • Within-Family Covariance
    Constructs population-specific covariance matrices that capture within-family linkage disequilibrium, reflecting recombination patterns and phased marker data.

  • Mendelian Sampling (Co)Variance
    Estimates Mendelian sampling variance (MSV) for single or multiple traits, as well as covariances (MSCs), crucial for maintaining genetic diversity and controlling inbreeding.

  • Similarity Matrices
    Computes haplotype-based similarity matrices between individuals (or zygotes), focusing on shared heterozygous segments that drive within-family genetic variation.

  • Selection Criteria
    Offers functions to derive selection strategies (e.g., GEBVs, usefulness criteria, index-based approaches) that leverage MSV/MSC or similarity measures.

Installation

PyMSQ is available on PyPI and can be installed via:

python -m pip install PyMSQ

Basic Usage

Below is a minimal example illustrating how to import PyMSQ and call its core functions:

from PyMSQ import msq  # Imports the msq module

# Example: Loading an included dataset
data = msq.load_package_data()

# Deriving expected LD matrices
ld_matrices = msq.expldmat(data['chromosome_data'], data['group_data'])

# Estimating Mendelian sampling (co)variances
msv = msq.msvarcov(
    gmat      = data['genotype_data'],
    gmap      = data['chromosome_data'],
    meff      = data['marker_effect_data'],
    exp_ldmat = ld_matrices,
    group     = data['group_data']
)

# Constructing similarity matrices
similarity = msq.simmat(
    gmat      = data['genotype_data'],
    gmap      = data['chromosome_data'],
    meff      = data['marker_effect_data'],
    group     = data['group_data'],
    exp_ldmat = ld_matrices
)

Tutorial

A tutorial detailing each function’s parameters, usage examples, and best practices can be found here. This tutorial walks you through:

  1. Loading your own data or the bundled Holstein-Friesian dataset,

  2. Building LD matrices for each chromosome,

  3. Estimating Mendelian sampling (co)variances,

  4. Deriving haplotype-based similarity,

  5. Applying selection strategies using advanced metrics.

Citation

If you use PyMSQ in academic work, please cite the following papers:

  1. Musa, A. A., & Reinsch, N. (2026). PyMSQ: a Python package for fast Mendelian sampling (co)variance and haplotype-based similarity in genomic selection. BMC Bioinformatics, https://doi.org/10.1186/s12859-026-06392-5.

  2. Musa, A. A., & Reinsch, N. (2025). A similarity matrix for hedging haplotype diversity among parents in genomic selection. Journal of Animal Breeding and Genetics, https://doi.org/10.1111/jbg.12930.

  3. Zenodo (software version v0.1.2): https://doi.org/10.5281/zenodo.18643470

Funding

This study was supported by the Bundesanstalt für Landwirtschaft und Ernährung (BLE) under Grant 281B101516.

Getting Help

  • Issues & Feature Requests If you encounter bugs, have feature requests, or need additional clarification, please open an issue on the PyMSQ GitHub repository.

  • License PyMSQ is released under the MIT License, allowing both academic and commercial use.

Happy analyzing! We hope PyMSQ supports your work in breeding, helping you balance short-term genetic gains with the long-term preservation of essential haplotype diversity.

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

pymsq-0.1.2.tar.gz (690.9 kB view details)

Uploaded Source

Built Distribution

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

pymsq-0.1.2-py3-none-any.whl (850.9 kB view details)

Uploaded Python 3

File details

Details for the file pymsq-0.1.2.tar.gz.

File metadata

  • Download URL: pymsq-0.1.2.tar.gz
  • Upload date:
  • Size: 690.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for pymsq-0.1.2.tar.gz
Algorithm Hash digest
SHA256 50a1481c3aba7821e64d48fc1c2196d5b736e754435a4b346062f68aca6dc7d6
MD5 874cc59e1e6599127aab61bb1fa90596
BLAKE2b-256 2269177d7853b26f4e10408a602c52fc92d6c53e7e391215047839d8ff08e036

See more details on using hashes here.

File details

Details for the file pymsq-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pymsq-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 850.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for pymsq-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b97461b174195f5e00e8e6c8957025b970b2e5a7ec53eab76bae999549a3ea5c
MD5 dae8042010ac10d64fe2d45933cecca5
BLAKE2b-256 93106a5e8a90540cfcdd0add6c270ebb9d1938a9e41451b901f4367d16f36450

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