plinder.core.scores.entries#

Lightweight entry/system/chain views loaded from the index parquet.

Consumed by similarity scoring.

class plinder.core.scores.entries.ChainView(asym_id: 'str', auth_id: 'str', length: 'int', entity_id: 'str' = '', chain_type: 'str' = 'polypeptide(L)', holo: 'bool' = True, uniprot_ids: 'tuple[str, ...]' = ())[source]#

Bases: object

asym_id: str#
auth_id: str#
length: int#
entity_id: str = ''#
chain_type: str = 'polypeptide(L)'#
holo: bool = True#
uniprot_ids: tuple[str, ...] = ()#
property is_polypeptide: bool#
property receptor_type: str#

Receptor polymer category derived from the CIF chain type.

class plinder.core.scores.entries.LigandView(id: str, pdb_id: str, system_id: str, instance_chain: str, asym_id: str, is_proper: bool, protein_chains_asym_id: list[str], num_pocket_residues: int, num_interactions: int, num_unique_interactions: int, is_shape_comparable: bool | None = None, pocket_residue_number_to_index: dict[str, dict[int, int]] = <factory>, interactions_counter: dict[str, dict[int, ~collections.Counter[str]]] = <factory>)[source]#

Bases: object

Ligand-level annotations needed by pairwise similarity scoring.

id: str#
pdb_id: str#
system_id: str#
instance_chain: str#
asym_id: str#
is_proper: bool#
protein_chains_asym_id: list[str]#
num_pocket_residues: int#
num_interactions: int#
num_unique_interactions: int#
is_shape_comparable: bool | None = None#
pocket_residue_number_to_index: dict[str, dict[int, int]]#
interactions_counter: dict[str, dict[int, Counter[str]]]#
class plinder.core.scores.entries.SystemView(id: 'str', pdb_id: 'str', system_type: 'str', protein_chains_asym_id: 'list[str]', proper_num_pocket_residues: 'int', proper_num_interactions: 'int', proper_num_unique_interactions: 'int', receptor_type: 'str' = 'protein', pocket_residue_number_to_index: 'dict[str, dict[int, int]]'=<factory>, interactions_counter: 'dict[str, dict[int, Counter[str]]]'=<factory>, ligands: 'dict[str, LigandView]'=<factory>)[source]#

Bases: object

id: str#
pdb_id: str#
system_type: str#
protein_chains_asym_id: list[str]#
proper_num_pocket_residues: int#
proper_num_interactions: int#
proper_num_unique_interactions: int#
receptor_type: str = 'protein'#
pocket_residue_number_to_index: dict[str, dict[int, int]]#
interactions_counter: dict[str, dict[int, Counter[str]]]#
ligands: dict[str, LigandView]#
property pocket_residue_index_to_number: dict[str, dict[int, int]]#
class plinder.core.scores.entries.InterfaceView(id: str, pdb_id: str, biounit_id: str, chain_1: str, chain_2: str, chain_1_residue_number_to_index: dict[int, int], chain_2_residue_number_to_index: dict[int, int], num_contact_residue_pairs: int)[source]#

Bases: object

One unordered protein-chain interface in a biological assembly.

id: str#
pdb_id: str#
biounit_id: str#
chain_1: str#
chain_2: str#
chain_1_residue_number_to_index: dict[int, int]#
chain_2_residue_number_to_index: dict[int, int]#
num_contact_residue_pairs: int#
property chains: tuple[str, str]#
property residue_number_to_index: dict[str, dict[int, int]]#
class plinder.core.scores.entries.EntryView(pdb_id: 'str', chains: 'dict[str, ChainView]', systems: 'dict[str, SystemView]', author_to_asym: 'dict[str, str]', interfaces: 'dict[str, InterfaceView]'=<factory>)[source]#

Bases: object

pdb_id: str#
chains: dict[str, ChainView]#
systems: dict[str, SystemView]#
author_to_asym: dict[str, str]#
interfaces: dict[str, InterfaceView]#
property pocket_index_to_number_per_chain: dict[str, dict[int, int]]#

Union of pocket (residue_index → residue_number) maps across every system / instance that touches each chain. Used by Scorer’s map_row to translate foldseek’s 0-based residue indices into PDB residue numbers so downstream scoring is source-agnostic.

property selected_index_to_number_per_chain: dict[str, dict[int, int]]#

Union of ligand-pocket and protein-interface residue mappings.

Compact mapped alignments retain only these selected query positions. This union supports exact ligand pocket and interface reconstruction from one release artifact without storing full residue alignments.

chains_for_alignment(chain_type: str, aln_type: str) → list[str]#
plinder.core.scores.entries.entry_views_from_df(df: DataFrame, *, entry_chains: DataFrame | None = None, interface_annotations: DataFrame | None = None) → dict[str, EntryView][source]#

Build EntryView objects from any DataFrame shaped like the published annotation parquet — i.e. one row per (entry, system, ligand) triple. interface_annotations supplies the parallel one-row-per-protein-interface table and permits interface-only entries. Pass the one-row-per-chain table to retain receptor types and apo/predicted alignment metadata. Without it, only protein-only holo chains present on system rows can be reconstructed. Annotation-only mixed or nucleic-acid receptors cannot be reconstructed because the system-level receptor type cannot be assigned to individual chains unambiguously.

Source-agnostic: works equally on the published parquet read via load_entry_views(), a locally-built parquet, or a freshly constructed DataFrame from in-memory Entry objects (pd.concat([e.to_df() for e in entries.values()])).

plinder.core.scores.entries.load_entry_views(*, pdb_ids: Iterable[str], data_dir: Path | None = None, include_interfaces: bool = True) → dict[str, EntryView][source]#

Load annotation and chain rows for the requested entries.

data_dir selects a local ingest/release root. If omitted, the ligand, interface, and chain tables are resolved from the configured PLINDER release cache. Production callers should use this loader so all rows come from the same release. Direct/custom DataFrames can use entry_views_from_df() instead.

plinder.core.scores.entries.load_alignment_entry_views(*, lookup_path: Path, pdb_ids: Iterable[str]) → dict[str, EntryView][source]#

Load compact chain and selected-residue maps for alignment mapping.