pestifer.molecule.segment module¶
Defines the Segment class for generating and managing segments declared for psfgen
- class pestifer.molecule.segment.Segment(*args, segtype: str, segname: str, chainID: str, residues: ResidueList = <factory>, subsegments: StateIntervalList, parent_chain: str, specs: dict, mutations: MutationList | None = None, deletions: DeletionList | None = None, grafts: GraftList | None = None, patches: PatchList | None = None, attachments: List | None = None, psfgen_segname: str | None = None, objmanager: ObjManager = <factory>, parent_molecule: Molecule = None)[source]¶
Bases:
BaseObjThis class represents a segment defined by a list of residue indices and provides methods to check if a bond intersects the segment. It also provides methods to yield treadmilled versions of the segment and to check for equality with another segment.
A segment represents a set of residues in which there are not repeated resids.
- cleave(clv: CleavageSite, daughter_chainID)[source]¶
Cleave the segment at a specified cut location, creating a daughter segment.
- Parameters:
clv (Cleavage) – The cut location specifying where to cleave the segment.
daughter_chainID (str) – The chain ID to assign to the daughter segment.
- deletions: DeletionList | None¶
- 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.
- mutations: MutationList | None¶
- objmanager: ObjManager¶
- residues: ResidueList¶
- set_parent_molecule(parent_molecule)[source]¶
Set the parent molecule for this segment.
- Parameters:
parent_molecule (object) – The parent molecule to which this segment belongs.
- subsegments: StateIntervalList¶
- class pestifer.molecule.segment.SegmentList(data)[source]¶
Bases:
BaseObjList[Segment]A list of segments in a molecular structure. This class represents a collection of segments and provides methods to manage and manipulate them. It inherits from AncestorAwareObjList to maintain the context of the parent molecule.
- build_from_only_pdb_data()[source]¶
Build the segment list given residues that were populated only from PDB data
- build_from_psf_and_pdb_data()[source]¶
Build the segment list using the pre-populated PSF segment list and PDB-derived residues
- chainIDmanager: ChainIDManager¶
- collect_residues()[source]¶
Collect all residues from the segments in the list.
- Returns:
A list of all residues associated with the segments.
- Return type:
- describe() str[source]¶
Abstract method to describe the contents of the BaseObjList. Subclasses should implement this method to provide a meaningful description.
- generate_from_residues(seq_spec: dict = {}, residues: ResidueList = [], chainIDmanager: ChainIDManager = None, psfcompanion: PSFSegmentList = None, links=None)[source]¶
Generate a SegmentList from a sequence specification and a list of residues extracted from a structure file.
- Parameters:
seq_spec (dict) – A dictionary containing sequence specifications.
residues (ResidueList) – A list of residues to be processed into segments.
chainIDmanager (ChainIDManager) – An object managing chain IDs to ensure uniqueness.
psfcompanion (PSFSegmentList) – A companion PSF segment list to provide additional context.
- Returns:
A new SegmentList instance containing the generated segments.
- Return type:
- get_residue_to_segname_map() dict[source]¶
Return a mapping from id(residue) → segname for all residues in all segments.
- get_segment_of_residue(residue: Residue) Segment | None[source]¶
Get the segment that contains a specified residue.
- inherit_objs(objmanager: ObjManager)[source]¶
Inherit objects from the object manager for each segment in the list. This method updates the object manager for each segment with inherited objects such as mutations, grafts, and patches.
- Parameters:
objmanager (ObjectManager) – The object manager from which to inherit objects.
- prune_topology(mutations: MutationList, links: LinkList, ssbonds: SSBondList)[source]¶
Prunes links, ssbonds, and even whole segments based on mutations
- psfcompanion: PSFSegmentList¶
- remove(item)[source]¶
Remove a segment from the list and update associated attributes.
- Parameters:
item (Segment) – The segment to remove from the list.
- residues: ResidueList¶