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
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:
-
Loading your own data or the bundled Holstein-Friesian dataset
-
Building LD matrices for each chromosome
-
Estimating Mendelian sampling (co)variances
-
Deriving haplotype-based similarity
-
Applying selection strategies using advanced metrics.
Citation
If you use PyMSQ in academic work, please cite the following papers:
-
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.
-
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.
-
Zenodo (software version v0.1.3): 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pymsq-0.1.3.tar.gz.
File metadata
- Download URL: pymsq-0.1.3.tar.gz
- Upload date:
- Size: 691.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10a8beb58ac5bd0c177d37f53c7a0198167430df6c8560024beaa9845f5142e2
|
|
| MD5 |
6072d04afb392b190d9c6e104c33606e
|
|
| BLAKE2b-256 |
088048217c41165d188867a94460ab8df59a68857f842255a9387e01935b2bfc
|
File details
Details for the file pymsq-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pymsq-0.1.3-py3-none-any.whl
- Upload date:
- Size: 851.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a062d6eb63d69bb95d15fa3be738fcae81df6b9bcb7614a472e7d4363979969
|
|
| MD5 |
a961d31891f3f50c632e84be445b6849
|
|
| BLAKE2b-256 |
ab338077a80d517d27fb1a36e1cbb2ae2ca03e8a33914e852da5b9227e278c32
|