pyjess 0.4.1__cp38-cp38-win_amd64.whl → 0.5.0__cp38-cp38-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pyjess might be problematic. Click here for more details.
- pyjess/_jess.cp38-win_amd64.pyd +0 -0
- pyjess/_jess.pyi +3 -4
- pyjess/_jess.pyx +88 -12
- {pyjess-0.4.1.dist-info → pyjess-0.5.0.dist-info}/METADATA +46 -34
- {pyjess-0.4.1.dist-info → pyjess-0.5.0.dist-info}/RECORD +7 -7
- {pyjess-0.4.1.dist-info → pyjess-0.5.0.dist-info}/WHEEL +1 -1
- {pyjess-0.4.1.dist-info → pyjess-0.5.0.dist-info}/licenses/COPYING +1 -1
pyjess/_jess.cp38-win_amd64.pyd
CHANGED
|
Binary file
|
pyjess/_jess.pyi
CHANGED
|
@@ -39,7 +39,7 @@ class Molecule(Sequence[Atom]):
|
|
|
39
39
|
|
|
40
40
|
class Atom:
|
|
41
41
|
@classmethod
|
|
42
|
-
def load(cls, file: Union[
|
|
42
|
+
def load(cls, file: Union[TextIO, str, os.PathLike[str]]) -> Atom: ...
|
|
43
43
|
@classmethod
|
|
44
44
|
def loads(cls, text: str) -> Atom: ...
|
|
45
45
|
def __init__(
|
|
@@ -100,7 +100,7 @@ class Atom:
|
|
|
100
100
|
|
|
101
101
|
class TemplateAtom:
|
|
102
102
|
@classmethod
|
|
103
|
-
def load(cls, file: Union[
|
|
103
|
+
def load(cls, file: Union[TextIO, str, os.PathLike[str]]) -> Atom: ...
|
|
104
104
|
@classmethod
|
|
105
105
|
def loads(cls, text: str) -> TemplateAtom: ...
|
|
106
106
|
def __init__(
|
|
@@ -188,14 +188,13 @@ class Hit(Generic[_T]):
|
|
|
188
188
|
@property
|
|
189
189
|
def template(self) -> _T: ...
|
|
190
190
|
@property
|
|
191
|
-
def molecule(self) -> Molecule: ...
|
|
192
|
-
@property
|
|
193
191
|
def determinant(self) -> float: ...
|
|
194
192
|
@property
|
|
195
193
|
def log_evalue(self) -> float: ...
|
|
196
194
|
@property
|
|
197
195
|
def evalue(self) -> float: ...
|
|
198
196
|
def atoms(self, transform: bool = True) -> List[Atom]: ...
|
|
197
|
+
def molecule(self, transform: bool = False) -> Molecule: ...
|
|
199
198
|
|
|
200
199
|
class Jess(Generic[_T], Sequence[_T]):
|
|
201
200
|
def __init__(self, templates: Iterable[_T] = ()): ...
|
pyjess/_jess.pyx
CHANGED
|
@@ -461,7 +461,7 @@ cdef class Atom:
|
|
|
461
461
|
return NotImplemented
|
|
462
462
|
other_ = other
|
|
463
463
|
# FIXME: it should be possible to do a memcmp here.
|
|
464
|
-
return self._state() == other_._state()
|
|
464
|
+
return self._state() == other_._state()
|
|
465
465
|
|
|
466
466
|
def __hash__(self):
|
|
467
467
|
return hash(tuple(self._state().values()))
|
|
@@ -598,11 +598,16 @@ cdef class TemplateAtom:
|
|
|
598
598
|
"""Load a template atom from the given file.
|
|
599
599
|
|
|
600
600
|
Arguments:
|
|
601
|
-
file (file-like object): A file-like object
|
|
602
|
-
text mode to read the template atom from.
|
|
601
|
+
file (str, os.PathLike or file-like object): A file-like object
|
|
602
|
+
opened in text or binary mode to read the template atom from.
|
|
603
603
|
|
|
604
604
|
"""
|
|
605
|
-
|
|
605
|
+
try:
|
|
606
|
+
handle = open(file)
|
|
607
|
+
except TypeError:
|
|
608
|
+
handle = nullcontext(file)
|
|
609
|
+
with handle as f:
|
|
610
|
+
return cls.loads(f.read())
|
|
606
611
|
|
|
607
612
|
@classmethod
|
|
608
613
|
def loads(cls, text):
|
|
@@ -849,7 +854,7 @@ cdef class TemplateAtom:
|
|
|
849
854
|
|
|
850
855
|
.. versionchanged:: 0.4.1
|
|
851
856
|
Property now returns a `tuple` rather than a `list`.
|
|
852
|
-
|
|
857
|
+
|
|
853
858
|
"""
|
|
854
859
|
assert self._atom is not NULL
|
|
855
860
|
|
|
@@ -871,11 +876,11 @@ cdef class TemplateAtom:
|
|
|
871
876
|
"""Create a copy of this template atom.
|
|
872
877
|
|
|
873
878
|
Returns:
|
|
874
|
-
`~pyjess.TemplateAtom`: A new template atom object with
|
|
879
|
+
`~pyjess.TemplateAtom`: A new template atom object with
|
|
875
880
|
identical attributes.
|
|
876
|
-
|
|
881
|
+
|
|
877
882
|
.. versionadded:: 0.4.0
|
|
878
|
-
|
|
883
|
+
|
|
879
884
|
"""
|
|
880
885
|
return type(self)(**self._state())
|
|
881
886
|
|
|
@@ -894,10 +899,42 @@ cdef class Template:
|
|
|
894
899
|
|
|
895
900
|
@classmethod
|
|
896
901
|
def loads(cls, text, str id = None):
|
|
902
|
+
"""Load a template from a string.
|
|
903
|
+
|
|
904
|
+
Arguments:
|
|
905
|
+
file (`str`, `os.PathLike`, or file-like object): Either the path
|
|
906
|
+
to a file, or a file-like object opened in **text mode**
|
|
907
|
+
containing the template.
|
|
908
|
+
id (`str`, optional): The identifier of the template. By default,
|
|
909
|
+
the parser will take the one from the ``PDB_ID`` remark if
|
|
910
|
+
found in the header.
|
|
911
|
+
|
|
912
|
+
Returns:
|
|
913
|
+
`~pyjess.Template`: The template parsed from the given string.
|
|
914
|
+
|
|
915
|
+
See Also:
|
|
916
|
+
`Template.load` to load a template from a file-like object or
|
|
917
|
+
from a path.
|
|
918
|
+
|
|
919
|
+
"""
|
|
897
920
|
return cls.load(io.StringIO(text), id=id)
|
|
898
921
|
|
|
899
922
|
@classmethod
|
|
900
923
|
def load(cls, file, str id = None):
|
|
924
|
+
"""Load a template from the given file.
|
|
925
|
+
|
|
926
|
+
Arguments:
|
|
927
|
+
file (`str`, `os.PathLike` or file-like object): Either the
|
|
928
|
+
path to a file, or a file-like object opened in **text mode**
|
|
929
|
+
to read the template from.
|
|
930
|
+
id (`str`, optional): The identifier of the template. By default,
|
|
931
|
+
the parser will take the one from the ``PDB_ID`` remark if
|
|
932
|
+
found in the header.
|
|
933
|
+
|
|
934
|
+
Returns:
|
|
935
|
+
`~pyjess.Template`: The template parsed from the given file.
|
|
936
|
+
|
|
937
|
+
"""
|
|
901
938
|
try:
|
|
902
939
|
handle = open(file)
|
|
903
940
|
except TypeError:
|
|
@@ -1181,7 +1218,7 @@ cdef class Query:
|
|
|
1181
1218
|
hit._sup = NULL
|
|
1182
1219
|
hit._atoms = NULL
|
|
1183
1220
|
hit.rmsd = INFINITY
|
|
1184
|
-
hit.
|
|
1221
|
+
hit._molecule = self.molecule
|
|
1185
1222
|
hit_tpl = NULL
|
|
1186
1223
|
|
|
1187
1224
|
# search the next hit without the GIL to allow parallel queries.
|
|
@@ -1261,7 +1298,7 @@ cdef class Hit:
|
|
|
1261
1298
|
|
|
1262
1299
|
cdef readonly double rmsd
|
|
1263
1300
|
cdef readonly Template template
|
|
1264
|
-
cdef
|
|
1301
|
+
cdef Molecule _molecule
|
|
1265
1302
|
|
|
1266
1303
|
def __dealloc__(self):
|
|
1267
1304
|
jess.super.Superposition_free(self._sup)
|
|
@@ -1292,7 +1329,7 @@ cdef class Hit:
|
|
|
1292
1329
|
cdef double e
|
|
1293
1330
|
|
|
1294
1331
|
with nogil:
|
|
1295
|
-
n = jess.molecule.Molecule_count(self.
|
|
1332
|
+
n = jess.molecule.Molecule_count(self._molecule._mol)
|
|
1296
1333
|
e = self.template._tpl.logE(self.template._tpl, self.rmsd, n)
|
|
1297
1334
|
return e
|
|
1298
1335
|
|
|
@@ -1304,7 +1341,7 @@ cdef class Hit:
|
|
|
1304
1341
|
cdef double e
|
|
1305
1342
|
|
|
1306
1343
|
with nogil:
|
|
1307
|
-
n = jess.molecule.Molecule_count(self.
|
|
1344
|
+
n = jess.molecule.Molecule_count(self._molecule._mol)
|
|
1308
1345
|
e = exp(self.template._tpl.logE(self.template._tpl, self.rmsd, n))
|
|
1309
1346
|
return e
|
|
1310
1347
|
|
|
@@ -1349,6 +1386,45 @@ cdef class Hit:
|
|
|
1349
1386
|
|
|
1350
1387
|
return atoms
|
|
1351
1388
|
|
|
1389
|
+
cpdef Molecule molecule(self, bint transform=False):
|
|
1390
|
+
"""Get the molecule matching the template.
|
|
1391
|
+
|
|
1392
|
+
Arguments:
|
|
1393
|
+
transform (`bool`): Whether or not to transform coordinates
|
|
1394
|
+
of the molecule atoms into template frame.
|
|
1395
|
+
|
|
1396
|
+
Returns:
|
|
1397
|
+
`~pyjess.Molecule`: The matching molecule, optionally
|
|
1398
|
+
rotated to match the template coordinate.
|
|
1399
|
+
|
|
1400
|
+
.. versionadded:: 0.5.0
|
|
1401
|
+
|
|
1402
|
+
"""
|
|
1403
|
+
assert self.template._tpl is not NULL
|
|
1404
|
+
assert self._sup is not NULL
|
|
1405
|
+
|
|
1406
|
+
cdef _Atom* atom
|
|
1407
|
+
cdef Molecule mol
|
|
1408
|
+
cdef size_t i
|
|
1409
|
+
cdef size_t j
|
|
1410
|
+
cdef size_t k
|
|
1411
|
+
cdef const double* M = jess.super.Superposition_rotation(self._sup)
|
|
1412
|
+
cdef const double* c = jess.super.Superposition_centroid(self._sup, 0)
|
|
1413
|
+
cdef const double* v = jess.super.Superposition_centroid(self._sup, 1)
|
|
1414
|
+
|
|
1415
|
+
if not transform:
|
|
1416
|
+
return self._molecule
|
|
1417
|
+
|
|
1418
|
+
mol = self._molecule.copy()
|
|
1419
|
+
for k in range(mol._mol.count):
|
|
1420
|
+
atom = mol._mol.atom[i]
|
|
1421
|
+
for i in range(3):
|
|
1422
|
+
atom.x[i] = v[i]
|
|
1423
|
+
for j in range(3):
|
|
1424
|
+
atom.x[i] += M[3*i + j] * (self._molecule._mol.atom[k].x[j] - c[j])
|
|
1425
|
+
|
|
1426
|
+
return mol
|
|
1427
|
+
|
|
1352
1428
|
|
|
1353
1429
|
cdef class Jess:
|
|
1354
1430
|
"""A handle to run Jess over a list of templates.
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: pyjess
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Cython bindings and Python interface to JESS, a 3D template matching software.
|
|
5
5
|
Keywords: bioinformatics,structure,template,matching
|
|
6
6
|
Author-Email: Martin Larralde <martin.larralde@embl.de>
|
|
7
7
|
License: MIT License
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2024-2025 Martin Larralde <martin.larralde@embl.de>
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
28
29
|
Classifier: Development Status :: 4 - Beta
|
|
29
30
|
Classifier: Intended Audience :: Developers
|
|
30
31
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -46,11 +47,12 @@ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
|
46
47
|
Classifier: Typing :: Typed
|
|
47
48
|
Project-URL: Homepage, https://github.com/althonos/pyjess/
|
|
48
49
|
Project-URL: Documentation, https://pyjess.readthedocs.io/en/stable/
|
|
49
|
-
Project-URL: Bug
|
|
50
|
+
Project-URL: Bug Tracker, https://github.com/althonos/pyjess/issues
|
|
50
51
|
Project-URL: Changelog, https://github.com/althonos/pyjess/blob/master/CHANGELOG.md
|
|
51
52
|
Project-URL: Coverage, https://codecov.io/gh/althonos/pyjess/
|
|
52
53
|
Project-URL: Builds, https://github.com/althonos/pyjess/actions
|
|
53
|
-
Project-URL:
|
|
54
|
+
Project-URL: PyPI, https://pypi.org/project/pyjess
|
|
55
|
+
Project-URL: PiWheels, https://piwheels.org/project/pyjess/
|
|
54
56
|
Requires-Python: >=3.7
|
|
55
57
|
Provides-Extra: test
|
|
56
58
|
Requires-Dist: importlib-resources; python_version < "3.9" and extra == "test"
|
|
@@ -83,8 +85,8 @@ Jess is an algorithm for constraint-based structural template matching
|
|
|
83
85
|
proposed by Jonathan Barker *et al.*[\[1\]](#ref1). It can be used to identify
|
|
84
86
|
catalytic residues from a known template inside a protein structure. Jess
|
|
85
87
|
is an evolution of TESS, a geometric hashing algorithm developed by
|
|
86
|
-
Andrew Wallace *et al.*[\[2\]](#ref2), removing some pre-computation and
|
|
87
|
-
structural requirements from the original algorithm. Jess was further
|
|
88
|
+
Andrew Wallace *et al.*[\[2\]](#ref2), removing some pre-computation and
|
|
89
|
+
structural requirements from the original algorithm. Jess was further
|
|
88
90
|
updated and maintained by [Ioannis Riziotis](https://github.com/iriziotis)
|
|
89
91
|
during his PhD in the [Thornton group](https://www.ebi.ac.uk/research/thornton/).
|
|
90
92
|
|
|
@@ -105,34 +107,44 @@ as well as the code required to compile from source with Cython:
|
|
|
105
107
|
$ pip install pyjess
|
|
106
108
|
```
|
|
107
109
|
|
|
108
|
-
|
|
110
|
+
Otherwise, PyJess is also available as a [Bioconda](https://bioconda.github.io/)
|
|
109
111
|
package:
|
|
110
112
|
```console
|
|
111
113
|
$ conda install -c bioconda pyjess
|
|
112
|
-
```
|
|
114
|
+
```
|
|
113
115
|
|
|
114
116
|
Check the [*install* page](https://pyjess.readthedocs.io/en/stable/install.html)
|
|
115
117
|
of the documentation for other ways to install PyJess on your machine.
|
|
116
118
|
|
|
119
|
+
|
|
120
|
+
## 🔖 Citation
|
|
121
|
+
|
|
122
|
+
PyJess is scientific software, and builds on top of Jess. Please cite
|
|
123
|
+
Jess if you are using it in an academic work, for instance as:
|
|
124
|
+
|
|
125
|
+
> PyJess, a Python library binding to Jess (Barker *et al.*, 2003).
|
|
126
|
+
|
|
127
|
+
|
|
117
128
|
## 💡 Example
|
|
118
129
|
|
|
119
130
|
Load templates to be used as references from different template files:
|
|
120
131
|
|
|
121
132
|
```python
|
|
122
|
-
import
|
|
133
|
+
import pathlib
|
|
123
134
|
import pyjess
|
|
124
135
|
|
|
125
136
|
templates = []
|
|
126
|
-
for path in sorted(
|
|
127
|
-
|
|
137
|
+
for path in sorted(pathlib.Path("vendor/jess/examples").glob("template_*.qry")):
|
|
138
|
+
with path.open() as file:
|
|
139
|
+
templates.append(pyjess.Template.load(file, id=path.stem))
|
|
128
140
|
```
|
|
129
141
|
|
|
130
142
|
Create a `Jess` instance and use it to query a molecule (a PDB structure)
|
|
131
143
|
against the stored templates:
|
|
132
144
|
|
|
133
145
|
```python
|
|
134
|
-
jess = Jess(templates)
|
|
135
|
-
mol = Molecule("vendor/jess/examples/test_pdbs/pdb1a0p.ent")
|
|
146
|
+
jess = pyjess.Jess(templates)
|
|
147
|
+
mol = pyjess.Molecule.load("vendor/jess/examples/test_pdbs/pdb1a0p.ent")
|
|
136
148
|
query = jess.query(mol, rmsd_threshold=2.0, distance_cutoff=3.0, max_dynamic_distance=3.0)
|
|
137
149
|
```
|
|
138
150
|
|
|
@@ -162,7 +174,7 @@ with multiprocessing.ThreadPool() as pool:
|
|
|
162
174
|
hits = pool.map(jess.query, molecules)
|
|
163
175
|
```
|
|
164
176
|
|
|
165
|
-
*⚠️ Prior to PyJess `v0.2.1`, the Jess code was running some thread-unsafe operations which have now been patched.
|
|
177
|
+
*⚠️ Prior to PyJess `v0.2.1`, the Jess code was running some thread-unsafe operations which have now been patched.
|
|
166
178
|
If running Jess in parallel, make sure to use `v0.2.1` or later to use the code patched with re-entrant functions*.
|
|
167
179
|
|
|
168
180
|
<!-- ## ⏱️ Benchmarks -->
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
pyjess/.gitignore,sha256=u14v4OOy8U50Kp9SUKU8DupCG-mQIuel47gdbNDmAwg,21
|
|
2
2
|
pyjess/__init__.py,sha256=Xe9GBQUBm9ik-ty5tcE3UQ9Ip1p-C_IGvTPuGULolng,766
|
|
3
|
-
pyjess/_jess.cp38-win_amd64.pyd,sha256=
|
|
4
|
-
pyjess/_jess.pyi,sha256=
|
|
5
|
-
pyjess/_jess.pyx,sha256=
|
|
3
|
+
pyjess/_jess.cp38-win_amd64.pyd,sha256=LbHdaI91W8YFJMlvKt-QbQDm5dZd63hgW-LZRI2fEVs,292352
|
|
4
|
+
pyjess/_jess.pyi,sha256=oWlqpqnhOKFcq2UCpGJrUJaZZF1ZlLodKxINwoR3vrw,7118
|
|
5
|
+
pyjess/_jess.pyx,sha256=rC2Dd_mNy4OhlN7QtQv0IZE7Q82TlXKkpq82v-gCiZY,51537
|
|
6
6
|
pyjess/CMakeLists.txt,sha256=H9eXbrFcGF2OLP8muQctb4cOb27Qp2uZj5KRjoDAROg,36
|
|
7
7
|
pyjess/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
pyjess/tests/__init__.py,sha256=h83kBzYKH_i1InkM8mOA23zE3PBaB9lrNDCuhC8LOl4,544
|
|
@@ -19,7 +19,7 @@ pyjess/tests/test_molecule.py,sha256=9k6uiTeOWc5NiO7epyxY9lm_GgksPb7-o-ZcNFNxutw
|
|
|
19
19
|
pyjess/tests/test_template.py,sha256=AIN-ba5-YTnGdT9SGPU4q45AZ03QnPE769WyItSpoPs,4657
|
|
20
20
|
pyjess/tests/test_template_atom.py,sha256=oK8cfKe4_k3Pm1PqoTTxTzAoeUVLiCFsg6QmiTQ-RCQ,3496
|
|
21
21
|
pyjess/tests/utils.py,sha256=Z7rUPC-D8dZlRfHAnLaXHUg6M10D3zFvNiwDvvHA3xc,202
|
|
22
|
-
pyjess-0.
|
|
23
|
-
pyjess-0.
|
|
24
|
-
pyjess-0.
|
|
25
|
-
pyjess-0.
|
|
22
|
+
pyjess-0.5.0.dist-info/METADATA,sha256=sz5NWDSx0uyq_myc5StGdXX-lD3tNYVXz1K4efR5wZg,11151
|
|
23
|
+
pyjess-0.5.0.dist-info/WHEEL,sha256=9H8MzBlYLrtPAqiRjqg810R3jn3-7qlAOGj95CJw-NI,104
|
|
24
|
+
pyjess-0.5.0.dist-info/licenses/COPYING,sha256=Iyx2bRDPnLgoEzW2KVanb61cjhW8lnhJNU-mjS-KhIY,1124
|
|
25
|
+
pyjess-0.5.0.dist-info/RECORD,,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2024 Martin Larralde <martin.larralde@embl.de>
|
|
3
|
+
Copyright (c) 2024-2025 Martin Larralde <martin.larralde@embl.de>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|