Jess#

class pyjess.Jess#

A handle to run Jess over a list of templates.

Example

Create a Jess object 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 Jess object cannot be modified further. Use the query method to query the templates with a molecule:

>>> molecule = Molecule.load("1AMY.pdb")
>>> query = jess.query(molecule, 2, 2, 2)

The returned Query object is an iterator that can be advanced through a for loop, or with the next built-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)#
copy()#

Create a copy of the Jess object.

Returns:

Jess – A Jess object containing the same templates.

Added in version 0.4.0.

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 (int or None) – The maximum number of candidate hits to report by template. If a non-None value is given, it may speed up querying for unspecific templates, but also produce results potentially inconsistent with Jess.

  • ignore_chain (str or None) –

    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) – Pass True to 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 in rmsd_threshold to be returned.

  • reorder (bool) – Whether to enable template atom reordering to accelerate matching in the scanner algorithm. Pass False to 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, set reorder to False.

Added in version 0.6.0: The reorder argument, defaulting to True.

Changed in version 0.7.0: Default value of max_candidates argument to None.

Changed in version 0.7.0: ignore_chain now expects string variants rather than bool.

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.

jess#

The templates this object is currently scanning.

Type:

Jess

molecule#

The query molecule to align to the templates.

Type:

Molecule

rmsd_threshold#

The RMSD threshold for reporting results.

Type:

float

best_match#

Whether the query will return only the best match to each template.

Type:

bool

__iter__()#

Implement iter(self).

ignore_chain#

The way atom chains are considered or discarded.

Type:

str or None

max_candidates#

The maximum number of candidate hits to report by template.

Type:

int

class pyjess.Hit#

A hit identified between a query molecule and a target template.

rmsd#

The RMSD between the aligned structures.

Type:

float

template#

The template that matched the query molecule.

Type:

Template

molecule#

The query molecule.

Type:

Molecule

__getstate__()#

Helper for pickle.

__new__(**kwargs)#
atoms(transform=True)#

Get the list of query atoms matching the template.

Parameters:

transform (bool) – Whether or not to transform coordinates of hits into template frame.

Returns:

list of Atom – The list of matching atoms.

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 supports pdb, 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 Hit which was obtained from a Template which has no id.

Added in version 0.7.0.

dumps(format='pdb', transform=True)#

Write the hit to a string.

Parameters:
  • format (str) – The format in which to write the hit. Currently only supports pdb, 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 Hit which was obtained from a Template which has no id.

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.

determinant#

The determinant of the rotation matrix.

Type:

float

evalue#

The E-value estimated for the hit.

Type:

float

log_evalue#

The logarithm of the E-value estimated for the hit.

Type:

float