Skip to main content

TopoPPI Affinity

TopoPPI Affinity adds affinity modelling and linked interface review to TopoPPI. It extracts native interface descriptors and includes CPU models for binding affinity (pKd) and mutation effects (ΔΔG). Users can fit regression models to supplied data or load custom models, then review saved predictions alongside the corresponding residues and contacts.

Installation

Install TopoPPI Affinity from PyPI with Python 3.10.

python -m pip install topoppi-affinity

For development, install Core, the plugin and its test dependencies from the repository root.

python -m pip install -e . -e './plugins/affinity[dev]'

The optional models extra supplies neural representation dependencies. Install it when using a model that requires them. Tk is required for the optional GUI. OptCuts is required for atlas generation. Native geometry and prediction run independently of atlas generation.

Platform capability

Installation registers affinity.predict, topoppi affinity ..., and the optional GUI integration through topoppi.plugins. Model dependencies load when needed for prediction. New analyses can share a Core geometry object:

import topoppi

geometry = topoppi.compute_geometry(
    topoppi.get_interface(topoppi.load_structure("complex.pdb"), "A", "B")
)
result = topoppi.run("affinity.predict", geometry, task="absolute", output="results")

The capability reuses selected atoms and native surfaces without reopening the input. workflow.analyze and the standalone CLI also accept structure paths. Namespaced defaults use ExecutionContext.plugin_config["affinity"]; explicit arguments take precedence.

The Core GUI lists Binding affinity and Mutation effects in the shared Binding analysis navigation, alongside Hotspot ranking when that plugin is installed. The prediction panel has two scientific tasks: whole-complex pKd and mutation ΔΔG. Keep Prepared task model to use the bundled physical model. Advanced known/unseen ensembles retain their separately documented training scope; Local model file selects a compatible custom estimator.

Selecting a local model reads its target and declared scope. A later task or scope mismatch is reported before computation. Variant drafts remain available when switching tasks; absolute-affinity prediction uses the unmodified complex. Selected interface residues can be sent to the mutation editor as separate single-substitution variants or one variant containing multiple substitutions. Adding variants appends rows, retains existing edits and resolves duplicate row identifiers. An existing draft for another structure or partner grouping must be switched explicitly.

Task UI and resource setup live in topoppi_affinity.integration and topoppi_affinity.installer. The old topoppi-install-affinity command is a deprecated forwarding adapter and requires the plugin to be installed first.

Synthetic quick start

This example converts a dissociation constant to pKd and back:

from topoppi_affinity.thermodynamics import kd_to_pkd, pkd_to_kd

assert float(kd_to_pkd(1e-8)) == 8.0
assert float(pkd_to_kd(8.0)) == 1e-8

The examples/tiny_complex.pdb fixture contains independently constructed toy coordinates. Its variant CSV exercises alternative substitutions, a variant containing multiple substitutions and an absent residue. Use it to check input handling and row-error reporting.

Structure example and prediction

The installed example contains the documented PDB 1BVK structure and example variants. It illustrates the antibody–lysozyme interface. Export it with:

topoppi-affinity example --output affinity-demo

Analyze it with the bundled affinity model:

topoppi-affinity analyze --structure affinity-demo/1bvk.pdb \
  --chains-a A,B --chains-b C --task absolute \
  --output affinity-demo/results
topoppi-affinity inspect affinity-demo/results
topoppi-affinity gui affinity-demo/results

The plugin contains one default model per task, including fitted preprocessing and feature definitions. For mutation effects, use --task mutation and provide --mutations or --variants. Default prediction runs on CPU without model downloads. See models and the workflow.

Inputs and outputs

Supply PDB or mmCIF structures and complete partner chain groups. Mutation input uses variant_id,mutations CSV records or structured residue fields. Affinity targets are pKd or mutation ΔΔG in kcal/mol; positive ΔΔG means weaker binding. Temperature is in kelvin and the dissociation constant Kd is in molar units.

Saved analyses contain a JSON report, prediction tables, the native interface and any requested layout results. Prediction rows retain their identifiers, status and error messages. The report records model scope and separate prediction/layout status. Models determine their feature requirements and applicability; review their training metadata before interpreting predictions.

Run topoppi-affinity --help for CLI commands. See the workflow guide, model interfaces, evaluation primitives, feature tools and test instructions.

Contributing

Use independently constructed fixtures for unit tests, preserve target units and row identities, and add coverage for changed public behavior. Run the affinity test suite together with affected core tests. Public interfaces are listed in the API guide.

Metadata

Release files for topoppi-affinity 3.0.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 topoppi-affinity 3.0.0
File Size Uploaded Provenance Actions
topoppi_affinity-3.0.0.tar.gz 3.7 MB With provenance Details for topoppi_affinity-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for topoppi-affinity 3.0.0
File Interpreter ABI Platform Actions
topoppi_affinity-3.0.0-py3-none-any.whl Python 3 none any Details for topoppi_affinity-3.0.0-py3-none-any.whl

Total release size: 7.2 MB

Release files / topoppi_affinity-3.0.0.tar.gz

Download URL topoppi_affinity-3.0.0.tar.gz
Size 3.7 MB
Tags Source
SHA-256 checksum
How to use checksums
af638420a7028045ee923cc23af7263feddcd483a6bb55687f51819364253977
BLAKE2b-256 checksum
How to use checksums
4d47c06928f966882d5f29a4627792a5670bb0637c20f6663e9ae314651923d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / topoppi_affinity-3.0.0-py3-none-any.whl

Download URL topoppi_affinity-3.0.0-py3-none-any.whl
Size 3.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
6952a706bf274b855e8d2861a65cf5d81db865d55b80d009b9b4b558c17931a6
BLAKE2b-256 checksum
How to use checksums
0ae074a50c085260e38af0b122e6824861a16aef09468fe233d29fa6f1ab31a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for topoppi-affinity 3.0.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for topoppi_affinity-3.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 release files Full provenance

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