pestifer.objs.graft module

A graft refers to a set of residues that are added to the base molecule and sourced from a separate pdb. The graft’s “target” is a residue that is congruent to the “reference” residue in the graft. The graft is positioned by aligning all of its atoms using a triple on the reference and the same triplet on the target as an alignment generator. The target residue’s atoms are replaced by those in the reference and the rest of the reference is incorporated.

class pestifer.objs.graft.Graft(*args, chainID: str, target_root: ResID, source_pdbid: str, source_chainID: str, source_root: ResID, source_end: ResID | None = None, target_partners: list[ResID] = <factory>, source_partners: list[ResID] = <factory>, obj_id: int | None = 0, residues: ResidueList | None = None, source_molecule: Molecule = None, source_seg: Segment = None, donor_residues: ResidueList | None = None, index_residues: ResidueList | None = None, graft_residues: ResidueList | None = None, donor_internal_links: LinkList | None = None, donor_external_links: LinkList | None = None, index_internal_links: LinkList | None = None, segfile: str | None = None, graft_segname: str | None = None)[source]

Bases: BaseObj

A class for handling grafts.

activate(mol: Molecule)[source]

Activate the graft by linking it to a source molecule and populating its native residue object lists

Parameters:

mol (Molecule) – The source molecule from which the graft will be sourced.

assign_receiver_residues(Residues: ResidueList)[source]

Populate the list of residues from the base molecule (“receiver residues”) onto the graft.

Parameters:

Residues (ResidueList) – The list of residues from which the graft will be assigned.

chainID: str
donor_residues: ResidueList | None
graft_residues: ResidueList | None
graft_segname: str | None

Optional attributes for a Graft object.

  • source_end: Last residue of the graft, which may be the same as the first if the entire source is used.

  • target_partners: Additional residues in the target structure used for N-point alignment.

  • source_partners: Additional residues in the source structure used for N-point alignment.

  • obj_id: Unique identifier/tag for the graft; probably an integer.

These optional attributes are set by “activation” of the graft:

  • residues: List of residue objects in the graft.

  • source_molecule: Molecule object from which the graft was derived.

  • donor_residues: List of residues to be donated during the grafting process.

  • index_residues: List of residues used for indexing the graft.

  • index_internal_links: Links between consecutive source index residues, for dihedral pre-conditioning.

  • donor_internal_links: List of internal links associated with the graft.

  • donor_external_links: List of external links associated with the graft.

  • segfile: Path to the segment file for the graft.

index_residues: ResidueList | 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.

obj_id: int | None
residues: ResidueList | None
segfile: str | None
set_internal_resids(next_resid: ResID) ResID[source]

Set the internal residue IDs for the graft based on the resolved receiver residues.

Parameters:

next_resid (ResID) – The next available residue ID to be assigned to the graft residues.

Returns:

next_resid – The updated next available residue ID after setting the links.

Return type:

ResID

shortcode() str[source]

Convert the Graft instance to its shortcode string representation.

Returns:

A string representation of the Graft object in the format: target:source

Return type:

str

source_chainID: str
source_end: ResID | None
source_molecule: Molecule
source_partners: list[ResID]
source_pdbid: str
source_root: ResID

Required attributes for a Graft object. These attributes must be provided when creating a Graft object.

  • chainID: Chain ID of the target segment in the base molecule.

  • target_root: Resid of residue in the structure that is targeted for grafting.

  • source_pdbid: Basename of the source PDB file or PDB ID from which the graft is sourced.

  • source_chainID: Chain ID of the graft in the source PDB file.

  • source_root: Resid of the first residue of the graft.

source_seg: Segment
target_partners: list[ResID]
target_root: ResID
class pestifer.objs.graft.GraftList(initlist: Iterable[T] = ())[source]

Bases: BaseObjList[Graft]

A class for handling lists of grafts. This class inherits from BaseObjList and provides methods to manage a list of Graft objects. It allows for the assignment of residue objects to each graft and the removal of grafts that do not have any assigned residues. It also handles the destruction of down-links from terminal residues in the grafts.

assign_residues(Residues: ResidueList, Links: LinkList)[source]

Assign residue objects to each graft in the list. :param Residues: The list of residues from which the grafts will be assigned. :type Residues: ResidueList :param Links: The list of links that may need to be modified based on the assigned residues. :type Links: LinkList

describe()[source]

Abstract method to describe the contents of the BaseObjList. Subclasses should implement this method to provide a meaningful description.