prolint.core.groups =================== .. py:module:: prolint.core.groups .. autoapi-nested-parse:: Atom group extensions for ProLint. This module provides extended atom group classes with additional functionality for biomolecular interaction analysis. Classes ------- .. autoapisummary:: prolint.core.groups.PLAtomGroupBase prolint.core.groups.ExtendedAtomGroup Module Contents --------------- .. py:class:: PLAtomGroupBase Bases: :py:obj:`abc.ABC` Abstract base class for ProLint atom group operations. Defines the interface for atom group manipulation methods used throughout ProLint. .. py:method:: add(resname: Optional[Union[str, list[str]]] = None, atomname: Optional[Union[str, list[str]]] = None, resnum: Optional[Union[int, list[int]]] = None, atomids: Optional[Union[int, list[int]]] = None) -> ExtendedAtomGroup :abstractmethod: Add atoms to the atom group. :param resname: Residue name(s) to add. :type resname: str or list of str, optional :param atomname: Atom name(s) to add. :type atomname: str or list of str, optional :param resnum: Residue number(s) to add. :type resnum: int or list of int, optional :param atomids: Atom ID(s) to add. :type atomids: int or list of int, optional :returns: New atom group with added atoms. :rtype: ExtendedAtomGroup .. py:method:: remove(resname: Optional[Union[str, list[str]]] = None, atomname: Optional[Union[str, list[str]]] = None, resnum: Optional[Union[int, list[int]]] = None, atomids: Optional[Union[int, list[int]]] = None) -> ExtendedAtomGroup :abstractmethod: Remove atoms from the atom group. :param resname: Residue name(s) to remove. :type resname: str or list of str, optional :param atomname: Atom name(s) to remove. :type atomname: str or list of str, optional :param resnum: Residue number(s) to remove. :type resnum: int or list of int, optional :param atomids: Atom ID(s) to remove. :type atomids: int or list of int, optional :returns: New atom group with specified atoms removed. :rtype: ExtendedAtomGroup .. py:method:: get_resnames(resids: Iterable[int], out: Union[type[list], type[dict]] = list) -> Union[list[str], Dict[int, str]] :abstractmethod: Get residue names for given residue IDs. :param resids: Residue IDs to look up. :type resids: Iterable of int :param out: Output format: ``list`` or ``dict``. :type out: type, default=list :returns: Residue names as list or as {resid: resname} mapping. :rtype: list of str or dict .. py:method:: get_resids(resname: str) -> numpy.ndarray :abstractmethod: Get residue IDs for a given residue name. :param resname: Residue name to look up. :type resname: str :returns: Array of residue IDs matching the residue name. :rtype: ndarray .. py:method:: get_all_resids(resnames: Iterable[str], out: Union[type[list], type[dict]] = list) -> Union[list[numpy.ndarray], Dict[str, numpy.ndarray]] :abstractmethod: Get residue IDs for multiple residue names. :param resnames: Residue names to look up. :type resnames: Iterable of str :param out: Output format: ``list`` or ``dict``. :type out: type, default=list :returns: Residue IDs as list of arrays or as {resname: resids} mapping. :rtype: list or dict .. py:method:: filter_resids_by_resname(resids: Iterable[int], resname: str) -> numpy.ndarray :abstractmethod: Filter residue IDs to keep only those matching a residue name. :param resids: Residue IDs to filter. :type resids: Iterable of int :param resname: Residue name to match. :type resname: str :returns: Subset of input resids that match the residue name. :rtype: ndarray .. py:property:: unique_resnames :type: numpy.ndarray :abstractmethod: Unique residue names in the atom group. :returns: Array of unique residue names. :rtype: ndarray .. py:property:: resname_counts :type: collections.Counter :abstractmethod: Count of residues for each residue name. :returns: Mapping of residue name to count. :rtype: Counter .. py:class:: ExtendedAtomGroup(*args: Any, **kwargs: Any) Bases: :py:obj:`MDAnalysis.AtomGroup`, :py:obj:`PLAtomGroupBase` Extended MDAnalysis AtomGroup with additional ProLint functionality. Provides enhanced methods for manipulating and querying atom selections, with cached properties for efficient repeated access. :param \*args: Arguments passed to MDAnalysis AtomGroup. :type \*args: tuple :param \*\*kwargs: Keyword arguments passed to MDAnalysis AtomGroup. :type \*\*kwargs: dict .. rubric:: Examples >>> from prolint import Universe >>> u = Universe("topology.gro", "trajectory.xtc") >>> u.database.unique_resnames array(['POPC', 'POPE', 'CHOL'], dtype='>> u.database.resname_counts Counter({'POPC': 128, 'POPE': 64, 'CHOL': 32}) Add atoms: >>> extended = u.database.add(resname="DPPC") Remove atoms: >>> filtered = u.database.remove(resname="CHOL") .. seealso:: :py:obj:`Universe.query` Query atom group (typically protein) :py:obj:`Universe.database` Database atom group (typically lipids) .. py:method:: add(resname: Optional[Union[str, list[str]]] = None, atomname: Optional[Union[str, list[str]]] = None, resnum: Optional[Union[int, list[int]]] = None, atomids: Optional[Union[int, list[int]]] = None) -> ExtendedAtomGroup Add atoms to the atom group. See :meth:`PLAtomGroupBase.add` for parameter documentation. .. py:method:: remove(resname: Optional[Union[str, list[str]]] = None, atomname: Optional[Union[str, list[str]]] = None, resnum: Optional[Union[int, list[int]]] = None, atomids: Optional[Union[int, list[int]]] = None) -> ExtendedAtomGroup Remove atoms from the atom group. See :meth:`PLAtomGroupBase.remove` for parameter documentation. .. py:method:: get_resnames(resids: Iterable[int], out: Union[type[list], type[dict]] = list) -> Union[list[str], Dict[int, str]] Get residue names for given residue IDs. See :meth:`PLAtomGroupBase.get_resnames` for parameter documentation. .. py:method:: get_resids(resname: str) -> numpy.ndarray Get residue IDs for a given residue name. See :meth:`PLAtomGroupBase.get_resids` for parameter documentation. .. py:method:: get_all_resids(resnames: Iterable[str], out: Union[type[list], type[dict]] = list) -> Union[list[numpy.ndarray], Dict[str, numpy.ndarray]] Get residue IDs for multiple residue names. See :meth:`PLAtomGroupBase.get_all_resids` for parameter documentation. .. py:method:: filter_resids_by_resname(resids: Iterable[int], resname: str) -> numpy.ndarray Filter residue IDs to keep only those matching a residue name. See :meth:`PLAtomGroupBase.filter_resids_by_resname` for parameter documentation. .. py:property:: unique_resnames :type: numpy.ndarray Unique residue names in the atom group. :returns: Array of unique residue names. :rtype: ndarray .. py:property:: resname_counts :type: collections.Counter Count of residues for each residue name. :returns: Mapping of residue name to count. :rtype: Counter