Template#
- class pyjess.TemplateAtom#
A single template atom.
Added in version 0.4.0: Equality, hashing and pickle protocol support.
- classmethod load(file)#
Load a template atom from the given file.
- Parameters:
file (str, os.PathLike or file-like object) – A file-like object opened in text or binary mode to read the template atom from.
- classmethod loads(text)#
Load a template atom from the given string.
- __init__(*, chain_id, residue_number, x, y, z, residue_names, atom_names, distance_weight=0.0, match_mode=0)#
Create a new template atom.
- Raises:
MemoryError – When the system allocator fails to allocate enough memory for the template atom storage.
- copy()#
Create a copy of this template atom.
- Returns:
TemplateAtom– A new template atom object with identical attributes.
Added in version 0.4.0.
- dump(file)#
Write the template atom to a file.
- Parameters:
file (file-like object) – A file opened in text mode where the template atom will be written.
Added in version 0.8.0.
- dumps()#
Write the template atom to a string.
- Returns:
str– The serialized template atom.
Added in version 0.8.0.
- transform(matrix)#
Apply an arbitrary transformation to the atom coordinates.
- Parameters:
matrix (
Mat4) – A 4x4 matrix in homogeneous coordinates describing the transformation to apply.
Added in version 0.10.0.
- class pyjess.Template#
A template, as a sequence of
TemplateAtomobjects.Added in version 0.4.0: Equality, hashing and pickle protocol support.
- classmethod load(file, id=None)#
Load a template from the given file.
- Parameters:
file (
str,os.PathLikeor file-like object) – Either the path to a file, or a file-like object opened in text mode to read the template from.id (
str, optional) – The identifier of the template. By default, the parser will take the one from thePDB_IDremark if found in the header.
- Returns:
Template– The template parsed from the given file.
- classmethod loads(text, id=None)#
Load a template from a string.
- Parameters:
file (
str,os.PathLike, or file-like object) – Either the path to a file, or a file-like object opened in text mode containing the template.id (
str, optional) – The identifier of the template. By default, the parser will take the one from thePDB_IDremark if found in the header.
- Returns:
Template– The template parsed from the given string.
See also
Template.loadto load a template from a file-like object or from a path.
- __getitem__(key, /)#
Return self[key].
- __init__(atoms=(), id=None)#
Create a new template.
- Parameters:
atoms (sequence of
TemplateAtom) – The atoms of the templates.id (
str, optional) – The identifier of the template.
- Raises:
MemoryError – When the system allocator fails to allocate enough memory for the template storage.
- __len__()#
Return len(self).
- copy()#
Create a copy of the template.
- Returns:
Template– A new template object with identical attributes and a copy of theTemplateAtomit contains.
- dump(file, write_id=True)#
Write the template to a file.
- Parameters:
file (file-like object) – A file opened in text mode where the template will be written.
write_id (
bool) – Whether to write the identifier of the template as aREMARKline.
Added in version 0.8.0.
- dumps()#
Write the template to a string.
- Returns:
str– The serialized template atom.
Added in version 0.8.0.
- transform(matrix)#
Apply a geometric transformation to all atoms of the template.
- Parameters:
matrix (
Mat4) – A 4x4 matrix in homogeneous coordinates describing the transformation to apply.
Added in version 0.10.0.