pestifer.molecule.transform module¶
A Transform class for handling homogeneous coordinate transformations of segments in a molecular structure. This class represents a transformation that can be applied to segments in an asymmetric unit, including rotation and translation.
- class pestifer.molecule.transform.Transform(*args, index: int, tmat: ndarray, applies_chainIDs: list[str], chainIDmap: dict[str, str] | None = None, segname_by_type_map: dict[str, str] | None = None)[source]¶
Bases:
BaseObjA class for handling transformations of segments in a molecular structure. This class represents a transformation that can be applied to segments in an asymmetric unit, including rotation and translation.
This method used the
pidibble.pdbparse.get_symm_ops()function to extract the rotation matrix and translation vector from a PDB record. It constructs a 4 x 4 transformation matrix from these components.- generate_chainIDmap(auChainIDs: list[str], daughters: dict, CM: ChainIDManager, glycan_segment_parents: dict | None = None)[source]¶
Generates a mapping of chain IDs for the transformation. This method creates a mapping of chain IDs that this transformation applies to, based on the asymmetric unit’s chain IDs and the daughters of segments. If the transformation is an identity transformation, it applies a “thru map” to the chain IDs. Otherwise, it generates a new mapping for the chain IDs.
- Parameters:
auChainIDs (list) – The list of chain IDs in the asymmetric unit.
daughters (dict) – A dictionary mapping parent segment IDs to their daughter segment IDs.
CM (ChainIDManager) – The ChainIDManager instance used to manage chain IDs.
glycan_segment_parents (dict, optional) – Maps glycan segname → parent protein chainID (e.g. ‘AG01’ → ‘A’). Used to generate structured image segnames (e.g. AG01→CG01 when A→C).
- classmethod identity()[source]¶
Creates an identity transformation. This method returns a Transform object with an identity transformation matrix and no chain ID mappings.
- is_identity()[source]¶
Checks if the transformation is an identity transformation. An identity transformation is one where the transformation matrix is an identity matrix and the translation vector is zero.
- Returns:
True if the transformation is an identity transformation, False otherwise.
- Return type:
- model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': False}¶
Configuration for
pydantic.BaseModel.
- model_post_init(context: Any, /) None¶
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- register_mapping(segtype, chainID, seglabel)[source]¶
Registers a mapping of segment type to chain ID and segment label. This method updates the segname_by_type_map attribute with the provided segment type, chain ID, and segment label.
- class pestifer.molecule.transform.TransformList(initlist: list[Transform] | PDBRecordList = [], *args, **kwargs)[source]¶
Bases:
BaseObjList[Transform]A class for handling lists of Transform objects. This class inherits from AncestorAwareObjList and provides methods to manage collections of Transform instances.