Skip to main content

Structured analysis of proteoform distributions on finite, bounded, k-graded modal lattices.

Project description

PolyForm

PolyForm is a Python package for structured analysis of proteoform distributions. It maps measured proteoform catalogues onto finite, bounded, k-graded modal lattices and computes structure-derived metrics including state identity, occupancy, grade spread, support topology, native clustering, principal occupied components, and statistical surprise.

Install

pip install polyform-lattice

The import name is polyform; the PyPI distribution name is polyform-lattice (the plain name polyform was already taken by an unrelated project). So you pip install polyform-lattice but import polyform.

From source (for development):

git clone https://github.com/JamesCobley/PolyForm.git
cd PolyForm
pip install -e .

Usage

Python API

Each analysis is a single call that returns a dict of pandas DataFrames and, by default, writes CSVs and figures to an output directory.

import polyform

# Global support-mode structural metrics on the choice-free modal lattice
support = polyform.run_support_mode(csv="proteoforms.csv", outdir="out_support")
support["global"]           # one-row global summary
support["protein_metrics"]  # protein-level structural metrics
support["grade"]            # protein-by-grade metrics

# Demonstration occupancy metrics on real observed supports
weight = polyform.run_weight_mode(csv="proteoforms.csv", outdir="out_weight")
weight["selected"]          # proteins selected for demonstration
weight["metrics"]           # occupancy-dependent metrics

# Tissue-resolved Hamming-1 support topology on a top-down atlas
topology = polyform.run_topology(xlsx="atlas.xlsx", outdir="out_topology")
topology["tissue_summary"]
topology["components"]

Set make_figures=False to skip figure rendering (faster; CSVs still written).

Command line

polyform support   --csv proteoforms.csv --outdir out_support
polyform weight    --csv proteoforms.csv --outdir out_weight
polyform topology  --xlsx atlas.xlsx     --outdir out_topology

polyform support --help      # per-command options
polyform --version

Core primitives

The lattice/topology/information primitives are importable directly:

from polyform.core import (
    parse_ptms, read_fasta, log10_comb, hamming_distance_state,
    connected_components_for_states, shannon_entropy, normalized_entropy,
)

Inputs

  • Support / weight modes expect a proteoform catalogue CSV with at least Entry Accession and PTMs columns; protein lengths are resolved from an Isoform Sequence column or an optional --fasta. PTM strings use the RESID:<code>@<position> form, |-separated.
  • Topology mode expects the multi-tissue top-down atlas spreadsheet (--sheet, default All_Tissues).

Outputs

Each mode writes a set of .csv tables plus publication .png/.pdf figures into its --outdir. See each function's docstring for the exact file list.

Reproducibility

The original manuscript analysis scripts are preserved unchanged under manuscript/ as the provenance record. The packaged run_* functions wrap those exact computational bodies (only parameterising configuration and routing outputs) and were validated to reproduce the manuscript reference outputs.

Releasing (maintainers)

Releases publish to PyPI via Trusted Publishing (OIDC — no API tokens). One-time setup: on PyPI, add a trusted publisher for the project pointing at this repo's publish.yml workflow and a pypi environment.

To cut a release:

# bump version in pyproject.toml and src/polyform/__init__.py, update CHANGELOG.md
git commit -am "Release v0.1.0"
git tag v0.1.0
git push origin main --tags

Pushing the tag triggers .github/workflows/publish.yml, which builds the sdist + wheel, runs twine check, and publishes to PyPI.

License

MIT © 2026 James N. Cobley

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

polyform_lattice-0.1.2.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

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

polyform_lattice-0.1.2-py3-none-any.whl (36.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: polyform_lattice-0.1.2.tar.gz
  • Upload date:
  • Size: 31.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for polyform_lattice-0.1.2.tar.gz
Algorithm Hash digest
SHA256 13d53b93b545533a1f030d4caf5ed5b10019e9f7014844d74583a3fea385addf
MD5 9c3c332e3eba5e8a29b2b7f37c9eb2c6
BLAKE2b-256 b32e74020b4d47397a839779187da03416a16a4c5a90cc47c6aec0d469345e9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyform_lattice-0.1.2.tar.gz:

Publisher: publish.yml on JamesCobley/PolyForm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for polyform_lattice-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2f3c82e3de7d7b475167d1a2c36224cb4d66a63c31bed06a2644c647bd7f3b51
MD5 fe2838cf5ffbeef6e8ced4c21466659f
BLAKE2b-256 759b5fb50dfe39429294f38aa1114aaec8550239d920a57c16d90b1e2d0ab0d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyform_lattice-0.1.2-py3-none-any.whl:

Publisher: publish.yml on JamesCobley/PolyForm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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