prolint.contacts.base

Base contact storage module.

This module provides the abstract base class for contact storage strategies.

Classes

BaseContactStore

Abstract base class for contact storage strategies.

Module Contents

class prolint.contacts.base.BaseContactStore(ts, contact_frames, norm_factor: float = 1.0)[source]

Abstract base class for contact storage strategies.

Defines the interface for storing and computing metrics on contact data. Subclasses implement specific storage and aggregation strategies.

Parameters:
  • ts (Universe) – MDAnalysis Universe instance.

  • contact_frames (dict) – Nested dict mapping residue_id -> database_id -> list of frame indices.

  • norm_factor (float, default=1.0) – Normalization factor for duration calculations.

See also

ExactContacts

Concrete implementation for exact contact aggregation

norm_factor[source]
contact_frames[source]
abstractmethod run(database_resnames: str | List = None)[source]

Process contact frames into aggregated contact data.

Parameters:

database_resnames (str or list of str, optional) – Residue names to process. If None, processes all.

Raises:

NotImplementedError – Subclasses must implement this method.

compute(metric: str, target_resname=None)[source]

Compute a standard metric on contacts.

Parameters:
  • metric ({"max", "sum", "mean", "occupancy"}) – Metric to compute.

  • target_resname (str, optional) – Filter by residue name.

Returns:

Computed metric values.

Return type:

dict

Raises:

ValueError – If metric is not recognized.

abstractmethod compute_metric(metric: str, target_resname=None)[source]

Compute a specific metric. Implemented by subclasses.

Parameters:
  • metric (str) – Metric to compute.

  • target_resname (str, optional) – Filter by residue name.

Raises:

NotImplementedError – Subclasses must implement this method.

abstractmethod apply_function(func: Callable, target_resname=None)[source]

Apply a custom function to contact data.

Parameters:
  • func (callable) – Function to apply to contact durations.

  • target_resname (str, optional) – Filter by residue name.

Raises:

NotImplementedError – Subclasses must implement this method.

property contacts[source]

Processed contact data.

Returns:

Contact data organized by residue and database molecule.

Return type:

dict

Raises:

ValueError – If run() has not been called yet.