Skip to main content

Embedding Annotation Transfer (EAT): nearest-neighbour label transfer in protein-language-model embedding space

Project description

protlabel

Embedding Annotation Transfer (EAT) engine — nearest-neighbour label transfer in protein-language-model (pLM) embedding space, with the goPredSim reliability index.

protlabel is a small, dependency-light library (numpy only). It is ProtSpace-agnostic by design — it imports nothing from protspace — so it is independently testable and reusable from notebooks, protspace_uniprot, or any other project. The protspace transfer CLI is a thin consumer of this engine.

Install

pip install protlabel

Use

import numpy as np
from protlabel import eat, Lookup

preds = eat(
    query_emb=np.random.rand(3, 1024).astype("float32"),
    query_ids=["Q1", "Q2", "Q3"],
    ref_emb=np.random.rand(100, 1024).astype("float32"),
    ref_ids=[f"R{i}" for i in range(100)],
    ref_labels=["toxin", "enzyme"] * 50,
    k=1,
    metric="cosine",          # or "euclidean" (the goPredSim default)
)
for p in preds:
    print(p.query_id, p.label, round(p.reliability, 3))

Lookup builds and serialises a reusable reference set (.npz sidecar) so the reference matrix can be rebuilt on demand rather than shipped.

Method

Nearest-neighbour transfer in the original pLM embedding space (not a 2-D/3-D projection), with the goPredSim reliability index — see Littmann et al., Sci Rep 2021 (Eq. 5) and Heinzinger et al., NAR Genom Bioinform 2022.

Distances are computed with an exact, chunked brute-force search (numpy BLAS GEMM

  • argpartition); queries are processed in batches. No approximate-nearest-neighbour index is needed at Swiss-Prot scale.

License

GPL-3.0 — part of the ProtSpace project.

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

protlabel-4.7.1.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

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

protlabel-4.7.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file protlabel-4.7.1.tar.gz.

File metadata

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

File hashes

Hashes for protlabel-4.7.1.tar.gz
Algorithm Hash digest
SHA256 04b2e1a358e2ce81e63b4a6ca7dca5b13df7f1d7623abc40facd61bfb0570a7a
MD5 0346b651166891aaa669e947f22bd309
BLAKE2b-256 b8b6ea66114b3224d2539e2a50668a2c59baa0de7401ef8f10e325f4a192f0bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for protlabel-4.7.1.tar.gz:

Publisher: publish.yml on tsenoner/protspace

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

File details

Details for the file protlabel-4.7.1-py3-none-any.whl.

File metadata

  • Download URL: protlabel-4.7.1-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for protlabel-4.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 70bec88c07e09f1da6c1f1c200cab2278ad75ccc4ebd4fa372099c1d20510740
MD5 2c0138fbb761d50f10cff43e136762f3
BLAKE2b-256 1f2f9813f90a31047ff2dd04adc53ef0ffe6c037608a7612a883fe89d06db843

See more details on using hashes here.

Provenance

The following attestation bundles were made for protlabel-4.7.1-py3-none-any.whl:

Publisher: publish.yml on tsenoner/protspace

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