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 ispolyform-lattice(the plain namepolyformwas already taken by an unrelated project). So youpip install polyform-latticebutimport 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 AccessionandPTMscolumns; protein lengths are resolved from anIsoform Sequencecolumn or an optional--fasta. PTM strings use theRESID:<code>@<position>form,|-separated. - Topology mode expects the multi-tissue top-down atlas spreadsheet
(
--sheet, defaultAll_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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13d53b93b545533a1f030d4caf5ed5b10019e9f7014844d74583a3fea385addf
|
|
| MD5 |
9c3c332e3eba5e8a29b2b7f37c9eb2c6
|
|
| BLAKE2b-256 |
b32e74020b4d47397a839779187da03416a16a4c5a90cc47c6aec0d469345e9b
|
Provenance
The following attestation bundles were made for polyform_lattice-0.1.2.tar.gz:
Publisher:
publish.yml on JamesCobley/PolyForm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polyform_lattice-0.1.2.tar.gz -
Subject digest:
13d53b93b545533a1f030d4caf5ed5b10019e9f7014844d74583a3fea385addf - Sigstore transparency entry: 2169559244
- Sigstore integration time:
-
Permalink:
JamesCobley/PolyForm@f4bc5ef938f000b38f8445e2f6779070017db17d -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/JamesCobley
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f4bc5ef938f000b38f8445e2f6779070017db17d -
Trigger Event:
push
-
Statement type:
File details
Details for the file polyform_lattice-0.1.2-py3-none-any.whl.
File metadata
- Download URL: polyform_lattice-0.1.2-py3-none-any.whl
- Upload date:
- Size: 36.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f3c82e3de7d7b475167d1a2c36224cb4d66a63c31bed06a2644c647bd7f3b51
|
|
| MD5 |
fe2838cf5ffbeef6e8ced4c21466659f
|
|
| BLAKE2b-256 |
759b5fb50dfe39429294f38aa1114aaec8550239d920a57c16d90b1e2d0ab0d1
|
Provenance
The following attestation bundles were made for polyform_lattice-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on JamesCobley/PolyForm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polyform_lattice-0.1.2-py3-none-any.whl -
Subject digest:
2f3c82e3de7d7b475167d1a2c36224cb4d66a63c31bed06a2644c647bd7f3b51 - Sigstore transparency entry: 2169559349
- Sigstore integration time:
-
Permalink:
JamesCobley/PolyForm@f4bc5ef938f000b38f8445e2f6779070017db17d -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/JamesCobley
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f4bc5ef938f000b38f8445e2f6779070017db17d -
Trigger Event:
push
-
Statement type: