Python reimplementation of PAML's selection-analysis workflows (codeml, yn00).
Project description
selkit
Pure-Python reimplementation of PAML's selection-analysis workflows (codeml, yn00).
v1 ships codeml site models (M0, M1a, M2a, M7, M8, M8a) with auto-LRTs, per-site NEB posteriors, model-level parallelism, multi-start optimization with a convergence gate, strict input validation, and reproducible run.yaml artifacts.
Install
pip install -e ".[dev]"
Requires Python 3.11+.
Typical CLI workflow
selkit codeml site-models \
--alignment gene.fa \
--tree species.nwk \
--output results/gene1 \
--threads 4
This fits M0, M1a, M2a, M7, M8, and M8a, computes M1a-vs-M2a, M7-vs-M8, and M8a-vs-M8 LRTs, and emits per-site NEB posteriors for M2a and M8.
Outputs in results/gene1/:
results.json— canonical structured output (all fits, LRTs, BEB sites, warnings).fits.tsv,lrts.tsv,beb_M2a.tsv,beb_M8.tsv— tabular views.run.yaml— exact config; reproduce withselkit rerun results/gene1/run.yaml.
Validation
selkit validate --alignment gene.fa --tree species.nwk
Runs every pre-flight check short of model fitting (length multiples of 3, stop codons, taxon match, foreground-label consistency).
Library
from selkit import codeml_site_models
result = codeml_site_models(
alignment="gene.fa", tree="species.nwk", output_dir="out/",
models=("M0", "M1a", "M2a"),
)
print(result.fits["M2a"].lnL)
for s in result.beb["M2a"]:
if s.p_positive > 0.95:
print(f"site {s.site}: P(omega > 1) = {s.p_positive:.3f}")
Not yet in v1
- Branch models (one-ratio, two-ratios, free-ratios)
- Branch-site models (Model A, Model A null)
- yn00 pairwise dN/dS
These land in subsequent plans built on the same engine.
Design
See docs/superpowers/specs/2026-04-18-selkit-design.md.
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 selkit-0.1.0.tar.gz.
File metadata
- Download URL: selkit-0.1.0.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac0855f5fe1985d43b34956641d83788a2e8d3c7ec4f25215e0c4d77cdcb5a9c
|
|
| MD5 |
90a65efa8f1796e77e759349ec35c000
|
|
| BLAKE2b-256 |
9bdf35dd0d66b43a33bfd9eefe2a26041ae6478df45c7e1aca9ede30077e2994
|
File details
Details for the file selkit-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: selkit-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 30.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
147b1c4ccaa63d60d0fe2903e734a327adb7751e1307ae27f435041b7eeda186
|
|
| MD5 |
9dc243f9019c6eb93cbdcbd967e72bfe
|
|
| BLAKE2b-256 |
5ce3c8ed0d22793bbf9f9ed76941e19be6fa4dd6d923ec5c73aaeede977c16de
|