Templates

class enzymm.template.AnnotatedResidue(_atoms: Tuple[TemplateAtom, TemplateAtom, TemplateAtom], _vec: Vec3, _indices: Tuple[int, int], reference_idx: int, reference_pdb: HomologousPDB, reference_residue: ReferenceCatalyticResidue)

Child class inheriting from Residue for M-CSA annotated template residues.

reference_idx

int Residue indentifier of the reference residue.

Type:

int

reference_pdb

HomologousPDB The PDB reference of the residue.

Type:

enzymm.mcsa_info.HomologousPDB

reference_residue

ReferenceCatalyticResidue The reference residue.

Type:

enzymm.mcsa_info.ReferenceCatalyticResidue

__init__(_atoms: Tuple[TemplateAtom, TemplateAtom, TemplateAtom], _vec: Vec3, _indices: Tuple[int, int], reference_idx: int, reference_pdb: HomologousPDB, reference_residue: ReferenceCatalyticResidue) None

Initilaize a Residue instance from a triplet of TemplateAtom objects.

Parameters:

atomstuple of 3 TemplateAtom instances

Returns:

Residue

property has_ptm: bool

Wether the residue in the M-CSA reference PDB structure was post-translationally modified

property is_metal_ligand: bool

Wether the residue in the M-CSA reference PDB structure was metal coordinating

property is_mutated: bool

Wether the residue in the M-CSA reference PDB structure was mutated

property roles: List[str]

list of str of EMO (Enyzme Mechanism Ontology) terms of catalytic roles

property roles_summary: List[str]

list of str describing catalytic roles

class enzymm.template.AnnotatedTemplate(*, residues: Sequence[AnnotatedResidue], pdb_id: str, mcsa_id: int, number_of_mutated_residues: int, number_of_metal_ligands: Tuple[int, int], number_of_ptm_residues: Tuple[int, int], number_of_side_chain_residues: Tuple[int, int], total_reference_residues: int, assembly: int, id: str | None = None, template_id_string: str | None = None, cluster: Cluster | None = None, uniprot_id: str | None = None, organism: str | None = None, organism_id: str | None = None, resolution: float | None = None, experimental_method: str | None = None, enzyme_discription: str | None = None, represented_sites: int | None = None, ec: Iterable[str] = (), cath: Iterable[str] = ())

Child class inheriting from Template for M-CSA annotated catalytic site templates.

__init__(*, residues: Sequence[AnnotatedResidue], pdb_id: str, mcsa_id: int, number_of_mutated_residues: int, number_of_metal_ligands: Tuple[int, int], number_of_ptm_residues: Tuple[int, int], number_of_side_chain_residues: Tuple[int, int], total_reference_residues: int, assembly: int, id: str | None = None, template_id_string: str | None = None, cluster: Cluster | None = None, uniprot_id: str | None = None, organism: str | None = None, organism_id: str | None = None, resolution: float | None = None, experimental_method: str | None = None, enzyme_discription: str | None = None, represented_sites: int | None = None, ec: Iterable[str] = (), cath: Iterable[str] = ())

Initialize an annotated template with descriptions of catalytic activity from the M-CSA.

Keyword Arguments:
  • residuesSequence of Residue instances

  • idstr Internal Template ID string. Default None

  • pdb_idstr The PDB ID of the template

  • template_id_stringstr String in the ID line of a template

  • mcsa_idint The M-CSA entry index form which the template was generated

  • clusterCluster Instance of the template

  • uniprot_idstr UniProt Identifier of the Protein from which the template was generated

  • organismstr Organism name of the Protein from which the template was generated

  • organism_idstr Taxonomic Identifier of the Organism of the Protein from which the template was generated

  • resolutionfloat Resolution of the Protein Structure from which the template was generated

  • experimental_methodstr Experimental method by which the Protein Structure of the template was resolved

  • enzyme_descriptionstr Text Discription of the Protein from which the template was generated

  • represented_sitesint The number of Enzymes which this template is representative for

  • eclist of str of EC numbers associated with Enzymes this template represents

  • cathlist of str of CATH numbers associated with Enzymes this template represents

  • number_of_mutated_residuesint The number of side chain specific residues which have been mutated relative to the reference

  • number_of_metal_ligandstuple of (int , int) Number of metal chelating residues in the template and the reference

  • number_of_ptm_residuestuple of (int , int) Number of post translationally modified residues in the template and the reference

  • number_of_side_chain_residuestuple of (int, int) Number of side chain interacting residues in the template and the reference

  • total_reference_residuesint Total number of residues (main and side chain) in the reference structure

Note

In order for a template file to be loaded as an AnnotatedTemplate, it must have both an mcsa_id and a pdb_id. This pdb_id must be found in the PDB-homologs of the M-CSA!

Note

It is recommended to not pass an id string. If id is None, the id will be set to

> {effective_size}-Residues_{template_id_string}_Cluster_{Cluster.id}-{Cluster.member}-{Cluster.size}

This identifier string should be unique.

Returns:

AnnotatedTemplate

copy() AnnotatedTemplate

Create a copy of the template.

Returns:

A new template object with identical attributes and a copy of the TemplateAtom it contains.

Return type:

Template

classmethod load(file: TextIO | Iterator[str] | str | PathLike[str], id: str | None = None, warn: bool = False, with_annotations: bool = True) Template | AnnotatedTemplate

Overloaded load to parse a pyjess.Template and its associated info into a Template object

Parameters:
  • filefile-like object or str or path-like from which to load

  • idstr or None Internal pyjess string which will superseed the ID string parsed from the template file. Default None

  • warnbool If warnings should be printed. Default False

  • with_annotationsbool If True (default) M-CSA derived templates with a PDB-id and M-CSA id will be annotated with extra information.

Returns:

Template | AnnotatedTemplate

classmethod loads(text: str, id: str | None = None, warn: bool = False, with_annotations: bool = True) Template | AnnotatedTemplate

Load Template from str. Calls Template.load()

Parameters:
  • textstr of Template to load

  • idstr or None Internal pyjess string which will superseed the ID string parsed from the template file. Default None

  • warnbool If warnings should be printed. Default False

  • with_annotationsbool If True (default) M-CSA derived templates with a PDB-id and M-CSA id will be annotated with extra information.

Returns:

Template | AnnotatedTemplate

class enzymm.template.Cluster(id: int, member: int, size: int)

Class for storing template cluster information.

id

int Index of the template cluster

Type:

int

member

int Member index within the template cluster

Type:

int

size

int Total number of members in the template cluster

Type:

int

__init__(id: int, member: int, size: int) None
class enzymm.template.Residue(atoms: Tuple[TemplateAtom, TemplateAtom, TemplateAtom])

Class for storing template residues (defined as 3 atoms) with relevant information.

__init__(atoms: Tuple[TemplateAtom, TemplateAtom, TemplateAtom])

Initilaize a Residue instance from a triplet of TemplateAtom objects.

Parameters:

atomstuple of 3 TemplateAtom instances

Returns:

Residue

property allowed_residues: str

Get the allowed residue types as string of single letter codes.

Type:

str

property atoms: Tuple[TemplateAtom, TemplateAtom, TemplateAtom]

Get the tuple of three TemplateAtom describing the residue.

property backbone: bool

True if an atom may match a backbone atom.

True if the atom may match backbone atoms. Check if the atom has ‘ANY’ or ‘XXX’ in its residue_names attribute

Type:

bool

static calc_residue_orientation(atoms: Tuple[TemplateAtom, TemplateAtom, TemplateAtom]) Tuple[Vec3, Tuple[int, int]]

Method to calculate the residue orientation depending on the residue type.

Parameters:

atomstuple of 3 TemplateAtom

Note

For symmetric atom triplets, the angle is calculated from the central atom to the midpoint between the two identical atom types. For non-symetric atom triplets, the angle is calculated between two atoms following the axis of polarization.

Returns:

of Residue.orientation_vector and Residue.orientation_vector_indices

Return type:

tuple

property chain_id: str

Get the pdb chain_id from the first atom.

Type:

str

property name: str

Get the amino-acid type as three letter code from the first atom.

Type:

str

property number: int

Get the pdb residue number from the first atom.

Type:

int

property orientation_vector: Vec3

Calculate the residue orientation vector according to the residue type.

Type:

Vec3

property orientation_vector_indices: Tuple[int, int]

Return the indices of the atoms between which the orientation vector was calculated according to the residue type.

Type:

tuple of (int, int)

property specific: bool

Atoms with a match_mode greater 100 are unspecific. <100 is specific.

Type:

bool

class enzymm.template.Template(*, residues: Sequence[Residue], pdb_id: str | None = None, mcsa_id: int | None = None, id: str | None = None, template_id_string: str | None = None, cluster: Cluster | None = None, uniprot_id: str | None = None, organism: str | None = None, organism_id: str | None = None, resolution: float | None = None, experimental_method: str | None = None, enzyme_discription: str | None = None, represented_sites: int | None = None, ec: Iterable[str] = (), cath: Iterable[str] = ())

Class for storing templates and associated information.

Inherits and extends from Template

__init__(*, residues: Sequence[Residue], pdb_id: str | None = None, mcsa_id: int | None = None, id: str | None = None, template_id_string: str | None = None, cluster: Cluster | None = None, uniprot_id: str | None = None, organism: str | None = None, organism_id: str | None = None, resolution: float | None = None, experimental_method: str | None = None, enzyme_discription: str | None = None, represented_sites: int | None = None, ec: Iterable[str] = (), cath: Iterable[str] = ())

Initialize a template.

Keyword Arguments:
  • residuessequence of Residue instances

  • idstr Internal Template ID string. Default None

  • pdb_idstr The PDB ID of the template

  • template_id_stringstr String in the ID line of a template

  • mcsa_idint The M-CSA entry index form which the template was generated

  • clusterCluster Instance of the template

  • uniprot_idstr UniProt Identifier of the Protein from which the template was generated

  • organismstr Organism name of the Protein from which the template was generated

  • organism_idstr Taxonomic Identifier of the Organism of the Protein from which the template was generated

  • resolutionfloat Resolution of the Protein Structure from which the template was generated

  • experimental_methodstr Experimental method by which the Protein Structure of the template was resolved

  • enzyme_descriptionstr Text Discription of the Protein from which the template was generated

  • represented_sitesint The number of Enzymes which this template is representative for

  • eclist of str of EC numbers associated with Enzymes this template represents

  • cathlist of str of CATH numbers associated with Enzymes this template represents

Note

It is recommended not to pass an id string. If id is None, the id string will be set to:

> {Template.dimension}-residues_{Template.template_id_string}_Cluster_{Cluster.id}-{Cluster.member}-{Cluster.size}

This identifier string should be unique.

Note

residues can be constructed from a list of TemplateAtoms via the staticmethod Residue.construct_residues_from_atoms(atoms=atoms)

Note

Iterating over Template gives TemplateAtom. If you want to get Residue, iterate over Template.residues

Returns:

Template

copy() Template

Create a copy of the template.

Returns:

A new template object with identical attributes and a copy of the TemplateAtom it contains.

Return type:

Template

dump(file: TextIO)

Dump Template to file-like object.

Parameters:

filefile-like object to write to

dumps() str

Dump Template to a str. Calls Template.dump()

property effective_size: int

The number of unique residues in the template, excluding backbone residues and unspecific residues.

Type:

int

classmethod load(file: TextIO | Iterator[str] | str | PathLike[str], id: str | None = None, warn: bool = False) Template

Overloaded load to parse a pyjess.Template and its associated info into an Template object

Parameters:
  • filefile-like object or str or path-like from which to load

  • idstr or None Internal pyjess string which will superseed the ID string parsed from the template file. Default None

  • warnbool If warnings should be printed. Default False

Returns:

Template

classmethod loads(text: str, id: str | None = None, warn: bool = False) Template

Load Template from str. Calls Template.load()

Parameters:
  • textstr of Template to load

  • idstr or None Internal pyjess string which will superseed the ID string parsed from the template file. Default None

  • warnbool If warnings should be printed. Default False

Returns:

Template

property multimeric: bool

True if the template contains residues from multiple protein chains.

Type:

bool

property relative_order: List[int]

Relative order of residues in the template sorted by the pdb residue number.

Note

This only works for non-multimeric templates. In this case returns ‘[0]’.

Type:

list of int

class enzymm.template.Vec3(x: float, y: float, z: float)

Class for storing 3D vectors in XYZ.

x

float X-Coordinate value

Type:

float

y

float Y-Coordinate value

Type:

float

z

float Z-Coordinate value

Type:

float

__add__(other: int | float | Vec3) Vec3

Overloads the + operator to add either an int, float or other Vec3 to a Vec3.

Parameters:

otherint | float | Vec3 argument to add

Returns:

Vec3

__init__(x: float, y: float, z: float) None
__matmul__(other: Vec3) float

Overloads the @ operator to perform dot product between two Vec3 vectors.

Parameters:

otherVec3 instance

Returns:

Vec3

__sub__(other: int | float | Vec3) Vec3

Overloads the - operator to subtract either an int, float or other Vec3 from a Vec3.

Parameters:

otherint | float | Vec3 argument to subtract

Returns:

Vec3

__truediv__(other: int | float | Vec3) Vec3

Overloads the / operator to divide a Vec3 object by either an int, float or other Vec3.

Parameters:

otherint | float | Vec3 argument to divide by

Returns:

Vec3

angle_to(other: Vec3) float

Returns the angle in radians between two Vec3 vectors.

Parameters:

otherVec3 to which to calculate the angle

Returns:

angle in radians

Return type:

float

classmethod from_xyz(item: Any) Vec3

Create a Vec3 instance from an object with x,y,z attributes.

Parameters:

any (item) – Any object with x, y, z attributes

Returns:

Vec3 instance

property norm: float

The vector norm (root of sum of squares)

Type:

float

normalize() Vec3

Vec3: The vector devided by its norm

enzymm.template.load_templates(template_dir: Path | None = None, warn: bool = False, verbose: bool = False, with_annotations: bool = True) Iterator[Template | AnnotatedTemplate]

Load templates from a given directory, recursively.

Parameters:
  • template_dirPath | None Directory which to search recursively for files with the ‘.pdb’ extension. By default, set to None, it will load templates included in this library.

  • warnbool If warnings about annoation issues in templates should be printed. Default False

  • verbosebool If loading should be verbose. Default False

  • with_annotationsbool If True (default) M-CSA derived templates with a PDB-id and M-CSA id will be annotated with extra information.

Yields:

Template | AnnotatedTemplate