No project description provided
Project description
PLINKFORMATTER
plinkformatter transforms genotype and phenotype inputs into PLINK-compatible
artifacts for downstream linear mixed-model workflows (primarily PyLMM).
This repository is based on the original R workflow implemented in:
plinkformatter/IGNORE_misc/pyLMM_utils.Rtests/IGNORE_MISC/hao_v2/pyLMM_analysis_NonDO.R
The Python implementation keeps the same core workflow while improving maintainability, testability, and performance for large PED/MAP datasets.
Prerequisites
- Python 3.8+
- Poetry
- PLINK 2.0 (required for PLINK integration tests and full pipeline runs)
Install dependencies:
poetry install
If plink2 is not on your PATH, set PLINK2_PATH explicitly.
PowerShell example:
$env:PLINK2_PATH = "C:\path\to\plink2.exe"
Running Tests
Run all commands from the repository root.
1) Fast test pass (no external PLINK dependency)
poetry run pytest -q tests/test_generate_pheno_plink_fast.py
2) PLINK utility tests
These include PLINK-facing behavior and may require a working plink2 binary.
poetry run pytest -q tests/test_plink_utils.py
3) Full test suite
poetry run pytest -q tests
Test output flags
-q: quiet output (compact summary)-s: show stdout/stderr (print, logs written to console)
Example:
poetry run pytest -s -q tests/test_generate_pheno_plink_fast.py
Workflow Parity with R
The Python pipeline mirrors the same logical stages as the R scripts:
- Extract/normalize phenotype rows for selected measure IDs.
- Generate per-measure, sex-specific
.ped/.map/.phenofiles. - Build
.bed/.bim/.famwith PLINK. - Align
.phenoordering to.famand recompute rank-Z on retained samples. - Compute kinship (PyLMM3 or PLINK-based path).
Performance Design (Large PED Files)
A major difference from older dataframe-heavy patterns is how PED is handled in
generate_pheno_plink_fast.py:
- It does not load the full PED into a pandas DataFrame.
- It builds a compact byte-offset index (
strain -> file position) once. - It seeks directly to needed PED rows and writes outputs in a streaming manner.
This avoids high memory usage and scales better for large genotype files than
pandas.read_csv() on full PED content.
Publishing to PyPI
- Update version:
poetry version patch
- Build:
poetry build
- Configure repository and token:
poetry config repositories.pypi https://upload.pypi.org/legacy/
poetry config pypi-token.pypi pypi-YourActualTokenHere
- Publish:
poetry publish
Project details
Release history Release notifications | RSS feed
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 plinkformatter-0.1.79.tar.gz.
File metadata
- Download URL: plinkformatter-0.1.79.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.13 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a8e0bc0753f6cd22c170a37ef96f59a0551f0bde1c5dccc3e6c36bcf84cf69b
|
|
| MD5 |
9837b7a8e9ddbc3a9eb5ad3f47a6a304
|
|
| BLAKE2b-256 |
a2f4e4f41140eb17ccc1cc04161c12d1b736caed8046e7da617ab78fc6420bf8
|
File details
Details for the file plinkformatter-0.1.79-py3-none-any.whl.
File metadata
- Download URL: plinkformatter-0.1.79-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.13 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad3c1574111ed95b4347a628a823f715ac4a778dcb257adfdf270fe820db75b4
|
|
| MD5 |
e25229af824017f6ecc9e2874f3cd2a2
|
|
| BLAKE2b-256 |
9378a64b6c5e4e5e9faabeb7a76a6178d01243f1a5a59bbc8d22de57d391af40
|