Jess#
- class pyjess.Jess#
A handle to run Jess over a list of templates.
Example
Create a
Jessobject from a list of templates:>>> t1 = Template.load("1.3.3.tpl") >>> t2 = Template.load("4.1.2.tpl") >>> jess = Jess([t1, t2])
Once initialized, the
Jessobject cannot be modified further. Use thequerymethod to query the templates with a molecule:>>> molecule = Molecule.load("1AMY.pdb") >>> query = jess.query(molecule, 2, 2, 2)
The returned
Queryobject is an iterator that can be advanced through aforloop, or with thenextbuilt-in function to get the first hit:>>> hit = next(query) >>> hit.rmsd 1.4386...
The hit can also be formatted in PDB format like in the original JESS code:
>>> print(hit.dumps(format="pdb"), end="") REMARK 1AMY 1.439 2om2 Det= 1.0 log(E)~ 1.11 ATOM 729 CA THR A 94 34.202 -24.426 8.851 1.00 2.00 ATOM 732 CB THR A 94 35.157 -23.467 8.101 1.00 4.66 ATOM 733 OG1 THR A 94 36.338 -23.247 8.871 1.00 9.85 ATOM 746 CD GLU A 96 41.454 -29.509 8.013 1.00 24.05 ATOM 748 OE2 GLU A 96 42.536 -29.680 7.441 1.00 34.44 ATOM 747 OE1 GLU A 96 41.212 -28.521 8.708 1.00 18.56 ATOM 437 CZ ARG A 55 44.471 -26.619 10.181 1.00 8.51 ATOM 436 NE ARG A 55 44.334 -27.346 11.290 1.00 9.05 ATOM 438 NH1 ARG A 55 43.590 -26.751 9.179 1.00 13.17 ENDMDL
Added in version 0.4.0: Equality, hashing and pickle protocol support.
- __init__(*args, **kwargs)#
- query(molecule, rmsd_threshold, distance_cutoff, max_dynamic_distance, *, max_candidates=None, ignore_chain=None, best_match=False, reorder=True)#
Scan for templates matching the given molecule.
- Parameters:
molecule (
Molecule) – The protein to match the templates to.rmsd_threshold (
float) – The RMSD threshold for reporting results.distance_cutoff (
float) – The global distance cutoff used to guide the search.max_dynamic_distance (
float) – The maximum template/query dynamic distance after adding the global distance cutoff and the individual atom distance cutoff defined for each atom of the template.max_candidates (
intorNone) – The maximum number of candidate hits to report by template. If a non-Nonevalue is given, it may speed up querying for unspecific templates, but also produce results potentially inconsistent with Jess.Whether to check or ignore the chain of the atoms to match. The different supported modes are:
None: Force the atoms in the molecule to belong to different (resp. same) chains if so is the case in the template.residues: Allow atoms to belong to different (resp. same) chains even if it is not the case in the template, but force all atoms of a residue to belong to the same chain.atoms: Allow atoms to belong to any chain, independently to the template or the residue they belong to.
best_match (
bool) – PassTrueto return only the best match to each template, based on RMSD. In case of ties, the first match is returned. Note that a match must still be passing the RMSD threshold given inrmsd_thresholdto be returned.reorder (
bool) – Whether to enable template atom reordering to accelerate matching in the scanner algorithm. PassFalseto reverse to the original, slower algorithm which matches atoms in the same order as they appear in the template, at the cost of longer run times.
- Returns:
Query– An iterator over the query hits.
Caution
Since
v0.6.0, this function uses an optimized variant of the Jess scanning algorithm which minimized the number of steps needed to generate matches, by re-ordering the order the template atoms are iterated upon. Because of this change, the query may return exactly the same matches but in an order that differs from the original Jess version. If you really need results in the original order, setreordertoFalse.Added in version 0.6.0: The
reorderargument, defaulting toTrue.Changed in version 0.7.0: Default value of
max_candidatesargument toNone.Changed in version 0.7.0:
ignore_chainnow expects string variants rather thanbool.
- class pyjess.Query#
A query over templates with a given molecule.
Jess iterates over the templates and attempt matches the query molecule, so the hits can actually be generated iteratively. This class allows accessing the hits as a Python iterator.
- __iter__()#
Implement iter(self).
- class pyjess.Hit#
A hit identified between a query molecule and a target template.
- __getstate__()#
Helper for pickle.
- __new__(**kwargs)#
- atoms(transform=True)#
Get the list of query atoms matching the template.
- dump(file, format='pdb', transform=True)#
Write the hit to a file.
- Parameters:
file (file-like object) – A file opened in text mode where the hit will be written.
format (
str) – The format in which to write the hit. Currently only supportspdb, which writes the hits in the same format as Jess.transform (
bool) – Whether or not to transform coordinates of the molecule atoms into template frame.
- Raises:
RuntimeError – When attempting to dump a
Hitwhich was obtained from aTemplatewhich has noid.
Added in version 0.7.0.
- dumps(format='pdb', transform=True)#
Write the hit to a string.
- Parameters:
- Raises:
RuntimeError – When attempting to dump a
Hitwhich was obtained from aTemplatewhich has noid.
Added in version 0.7.0.
- molecule(transform=False)#
Get the molecule matching the template.
- Parameters:
transform (
bool) – Whether or not to transform coordinates of the molecule atoms into template frame.- Returns:
Molecule– The matching molecule, optionally rotated to match the template coordinate.
Added in version 0.5.0.