Skip to main content

pmotools

A collection of tools to interact with the portable microhaplotype object (PMO) file format.

Documentation on the format and pmotools-python, including detailed tutorials can be found here.

The manual for pmotools-python can be found here.

Installation

Requires Python 3.11+.

pip install pmotools

This installs the pmotools-python command-line tool and the pmotools Python library.

Usage

pmotools-python can be used from the command line or imported as a Python library.

Command line

After installation, the pmotools-python command is available:

pmotools-python --help
pmotools-python validate_pmo --help

Examples:

pmotools-python validate_pmo --pmo my_data.pmo.json
pmotools-python combine_pmos --pmo_files run1.pmo.json run2.pmo.json --output combined.pmo.json

Commands are grouped by task:

Group Purpose
convertors_to_json Convert tables and metadata into PMO inputs
extractors_from_pmo Subset PMOs by metadata, samples, targets, or read counts
pmo_to_table Export PMO contents to spreadsheets or other formats
extract_basic_info_from_pmo Inspect metadata and counts
working_with_multiple_pmos Combine PMOs
validation Validate PMO files against the JSON schema

See the command-line manual for full documentation of each command.

Python library

Import pmotools in your own code to read, validate, write, and build PMO files:

from pmotools.pmo_engine.pmo_reader import PMOReader
from pmotools.pmo_engine.pmo_checker import PMOChecker

pmo = PMOReader.read_in_pmo("example.pmo.json")

checker = PMOChecker()
checker.validate_pmo_json(pmo)

Core modules:

  • pmotools.pmo_engine — read, write, validate, and export PMOs
  • pmotools.pmo_builder — build PMOs from tables and metadata
  • pmotools.scripts — the same logic used by the CLI

See the API reference for module-level documentation.

Auto completion

To enable bash tab completion for pmotools-python, append the script from etc/bash_completion to your ~/.bash_completion, or generate it with:

pmotools-python --bash-completion >> ~/.bash_completion
source ~/.bash_completion

Developer Setup

To contribute to pmotools, follow these steps:

  1. Clone the repository and switch to the develop branch:
git clone git@github.com:your-org/pmotools.git
cd pmotools
git checkout develop
  1. Create your feature branch:
git checkout -b feature/my-feature
  1. Install and set up UV. This creates .venv/ and installs everything from pyproject.toml:
pip install -U uv
uv sync --dev
  1. Install pre-commit hooks (for formatting & linting):
uv run pre-commit install
  1. Run pre-commit manually on all files (first time):
uv run pre-commit run --all-files
  1. Develop your code. Pre-commit will automatically run on staged files before each commit, checking:
  • Formatting (Ruff)
  • Linting (Ruff)
  • Trailing whitespace, YAML syntax, large files
  1. Run tests:
uv run pytest
  1. Commit and push your changes:
git add .
git commit -m "Your message"
git push origin feature/my-feature

Documentation updating

Documentation for pmotools is automatically generated from docstring under man/. This is automatically built and deployed through GitHub actions on merging to main.

You should check documentation before deployment. To update the documentation locally make sure you have pmotools-python installed.

Next, from your development environment, install sphinx and its dependencies using the following command:

pip install -r man/requirements.txt

Build the documentation using the following commands

cd man
make update_autodocs
make html

You can open the html to review changes.

Releasing pmotools-python

To release pmotools-python you need to update version in pyproject.toml, adhering to semantic versioning conventions.

Note: It is not always the case, but sometimes a release of pmotools-python will coincide with a new schema version. See the section below for notes on updating the schema version.

Once you have merged these updates into the main branch, create a new release with notes. GitHub actions will automatically deploy to PyPi.

Updating the schema version

You can release pmotools-python without updating the schema version. However, for the schema to be updated and become the default within pmotools-python, you must update the schema and then do a release of pmotools-python by following the instructions above.

Update __schema_version__ in src/pmotools/__init__.py to the new version of the schema. Do not include the v here (e.g. 1.0.0 not v1.0.0).

Metadata

Release files for pmotools 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pmotools 1.2.0
File Size Uploaded Provenance Actions
pmotools-1.2.0.tar.gz 108.6 kB Without provenance Details for pmotools-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pmotools 1.2.0
File Interpreter ABI Platform Actions
pmotools-1.2.0-py3-none-any.whl Python 3 none any Details for pmotools-1.2.0-py3-none-any.whl

Total release size: 238.5 kB

Release files / pmotools-1.2.0.tar.gz

Download URL pmotools-1.2.0.tar.gz
Size 108.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ed91ce0550df680cd3797fdaa679ff02cf63f2bc7c7752aec008db965d0fe78f
BLAKE2b-256 checksum
How to use checksums
a78636b9a7645975341a476d46c5ac00e53a726c3b83182299123f974f1f98f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pmotools-1.2.0-py3-none-any.whl

Download URL pmotools-1.2.0-py3-none-any.whl
Size 129.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c3b03f4f3271442f55fbdce59c6e674a643e566cf277f61c79698f8d2e8d649
BLAKE2b-256 checksum
How to use checksums
677e52003fb9d2f3a0bb706dbdb1d38cff30ab2a5559d9e04baf58b34d317c69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pmotools 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page