prolint.contacts.base ===================== .. py:module:: prolint.contacts.base .. autoapi-nested-parse:: Base contact storage module. This module provides the abstract base class for contact storage strategies. Classes ------- .. autoapisummary:: prolint.contacts.base.BaseContactStore Module Contents --------------- .. py:class:: BaseContactStore(ts, contact_frames, norm_factor: float = 1.0) 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. :param ts: MDAnalysis Universe instance. :type ts: Universe :param contact_frames: Nested dict mapping residue_id -> database_id -> list of frame indices. :type contact_frames: dict :param norm_factor: Normalization factor for duration calculations. :type norm_factor: float, default=1.0 .. seealso:: :py:obj:`ExactContacts` Concrete implementation for exact contact aggregation .. py:attribute:: norm_factor .. py:attribute:: contact_frames .. py:method:: run(database_resnames: Union[str, List] = None) :abstractmethod: Process contact frames into aggregated contact data. :param database_resnames: Residue names to process. If None, processes all. :type database_resnames: str or list of str, optional :raises NotImplementedError: Subclasses must implement this method. .. py:method:: compute(metric: str, target_resname=None) Compute a standard metric on contacts. :param metric: Metric to compute. :type metric: {"max", "sum", "mean", "occupancy"} :param target_resname: Filter by residue name. :type target_resname: str, optional :returns: Computed metric values. :rtype: dict :raises ValueError: If metric is not recognized. .. py:method:: compute_metric(metric: str, target_resname=None) :abstractmethod: Compute a specific metric. Implemented by subclasses. :param metric: Metric to compute. :type metric: str :param target_resname: Filter by residue name. :type target_resname: str, optional :raises NotImplementedError: Subclasses must implement this method. .. py:method:: apply_function(func: Callable, target_resname=None) :abstractmethod: Apply a custom function to contact data. :param func: Function to apply to contact durations. :type func: callable :param target_resname: Filter by residue name. :type target_resname: str, optional :raises NotImplementedError: Subclasses must implement this method. .. py:property:: contacts Processed contact data. :returns: Contact data organized by residue and database molecule. :rtype: dict :raises ValueError: If run() has not been called yet.