pyjess 0.1.0__tar.gz
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-0.1.0/CHANGELOG.md +15 -0
- pyjess-0.1.0/CONTRIBUTING.md +44 -0
- pyjess-0.1.0/COPYING +21 -0
- pyjess-0.1.0/MANIFEST.in +17 -0
- pyjess-0.1.0/PKG-INFO +189 -0
- pyjess-0.1.0/README.md +151 -0
- pyjess-0.1.0/include/jess/__init__.pxd +0 -0
- pyjess-0.1.0/include/jess/annulus.pxd +6 -0
- pyjess-0.1.0/include/jess/atom.pxd +21 -0
- pyjess-0.1.0/include/jess/jess.pxd +30 -0
- pyjess-0.1.0/include/jess/join.pxd +12 -0
- pyjess-0.1.0/include/jess/kdtree.pxd +19 -0
- pyjess-0.1.0/include/jess/molecule.pxd +19 -0
- pyjess-0.1.0/include/jess/region.pxd +9 -0
- pyjess-0.1.0/include/jess/scanner.pxd +15 -0
- pyjess-0.1.0/include/jess/super.pxd +14 -0
- pyjess-0.1.0/include/jess/template.pxd +17 -0
- pyjess-0.1.0/include/jess/tess_atom.pxd +29 -0
- pyjess-0.1.0/include/jess/tess_template.pxd +31 -0
- pyjess-0.1.0/patches/Atom.h.patch +28 -0
- pyjess-0.1.0/patches/Jess.c.patch +47 -0
- pyjess-0.1.0/patches/Molecule.c.patch +18 -0
- pyjess-0.1.0/patches/Molecule.h.patch +17 -0
- pyjess-0.1.0/patches/Super.c.patch +90 -0
- pyjess-0.1.0/patches/Template.h.patch +12 -0
- pyjess-0.1.0/patches/TessAtom.c.patch +121 -0
- pyjess-0.1.0/patches/TessAtom.h.patch +34 -0
- pyjess-0.1.0/patches/TessTemplate.c.patch +203 -0
- pyjess-0.1.0/patches/TessTemplate.h.patch +52 -0
- pyjess-0.1.0/pyjess/__init__.py +23 -0
- pyjess-0.1.0/pyjess/_jess.pyi +171 -0
- pyjess-0.1.0/pyjess/_jess.pyx +1040 -0
- pyjess-0.1.0/pyjess/py.typed +0 -0
- pyjess-0.1.0/pyjess/tests/__init__.py +16 -0
- pyjess-0.1.0/pyjess/tests/data/1.3.3.tpl +23 -0
- pyjess-0.1.0/pyjess/tests/data/1AMY+1.3.3.txt +1872 -0
- pyjess-0.1.0/pyjess/tests/data/1AMY.pdb +3941 -0
- pyjess-0.1.0/pyjess/tests/data/__init__.py +0 -0
- pyjess-0.1.0/pyjess/tests/data/pdb1lnb.pdb +3334 -0
- pyjess-0.1.0/pyjess/tests/data/template_01.qry +11 -0
- pyjess-0.1.0/pyjess/tests/data/template_02.qry +11 -0
- pyjess-0.1.0/pyjess/tests/test_atom.py +54 -0
- pyjess-0.1.0/pyjess/tests/test_jess.py +90 -0
- pyjess-0.1.0/pyjess/tests/test_molecule.py +47 -0
- pyjess-0.1.0/pyjess/tests/test_template.py +39 -0
- pyjess-0.1.0/pyjess/tests/test_template_atom.py +44 -0
- pyjess-0.1.0/pyjess/tests/utils.py +7 -0
- pyjess-0.1.0/pyjess.egg-info/PKG-INFO +189 -0
- pyjess-0.1.0/pyjess.egg-info/SOURCES.txt +79 -0
- pyjess-0.1.0/pyjess.egg-info/dependency_links.txt +1 -0
- pyjess-0.1.0/pyjess.egg-info/not-zip-safe +1 -0
- pyjess-0.1.0/pyjess.egg-info/top_level.txt +1 -0
- pyjess-0.1.0/pyproject.toml +4 -0
- pyjess-0.1.0/setup.cfg +105 -0
- pyjess-0.1.0/setup.py +522 -0
- pyjess-0.1.0/vendor/jess/README.md +85 -0
- pyjess-0.1.0/vendor/jess/src/Annulus.c +136 -0
- pyjess-0.1.0/vendor/jess/src/Annulus.h +26 -0
- pyjess-0.1.0/vendor/jess/src/Atom.c +75 -0
- pyjess-0.1.0/vendor/jess/src/Atom.h +61 -0
- pyjess-0.1.0/vendor/jess/src/Jess.c +226 -0
- pyjess-0.1.0/vendor/jess/src/Jess.h +61 -0
- pyjess-0.1.0/vendor/jess/src/Join.c +147 -0
- pyjess-0.1.0/vendor/jess/src/Join.h +37 -0
- pyjess-0.1.0/vendor/jess/src/KdTree.c +346 -0
- pyjess-0.1.0/vendor/jess/src/KdTree.h +48 -0
- pyjess-0.1.0/vendor/jess/src/Main.c +401 -0
- pyjess-0.1.0/vendor/jess/src/Molecule.c +167 -0
- pyjess-0.1.0/vendor/jess/src/Molecule.h +42 -0
- pyjess-0.1.0/vendor/jess/src/Region.c +134 -0
- pyjess-0.1.0/vendor/jess/src/Region.h +45 -0
- pyjess-0.1.0/vendor/jess/src/Scanner.c +307 -0
- pyjess-0.1.0/vendor/jess/src/Scanner.h +38 -0
- pyjess-0.1.0/vendor/jess/src/Super.c +561 -0
- pyjess-0.1.0/vendor/jess/src/Super.h +44 -0
- pyjess-0.1.0/vendor/jess/src/Template.h +51 -0
- pyjess-0.1.0/vendor/jess/src/TessAtom.c +511 -0
- pyjess-0.1.0/vendor/jess/src/TessAtom.h +46 -0
- pyjess-0.1.0/vendor/jess/src/TessTemplate.c +336 -0
- pyjess-0.1.0/vendor/jess/src/TessTemplate.h +25 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
[Unreleased]: https://github.com/althonos/pyjess/compare/v0.1.0...HEAD
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## [v0.1.0] - 2024-04-18
|
|
13
|
+
[v0.1.0]: https://github.com/althonos/pyjess/compare/3f2a7e9...v0.1.0
|
|
14
|
+
|
|
15
|
+
Initial release.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Contributing to PyJess
|
|
2
|
+
|
|
3
|
+
For bug fixes or new features, please file an issue before submitting a
|
|
4
|
+
pull request. If the change isn't trivial, it may be best to wait for
|
|
5
|
+
feedback.
|
|
6
|
+
|
|
7
|
+
## Coding guidelines
|
|
8
|
+
|
|
9
|
+
### Versions
|
|
10
|
+
|
|
11
|
+
This project targets Python 3.5 or later.
|
|
12
|
+
|
|
13
|
+
Python objects should be typed; since it is not supported by Cython,
|
|
14
|
+
you must manually declare types in type stubs (`.pyi` files). In Python
|
|
15
|
+
files, you can add type annotations to function signatures (supported in
|
|
16
|
+
Python 3.5) but not in variable assignments (supported only from Python
|
|
17
|
+
3.6 onward). However, Cython allows you to use [f-strings](https://www.python.org/dev/peps/pep-0498/)
|
|
18
|
+
even when compiling the code for Python 3.5.
|
|
19
|
+
|
|
20
|
+
### Interfacing with C
|
|
21
|
+
|
|
22
|
+
When interfacing with C, and in particular with pointers, use assertions
|
|
23
|
+
everywhere you assume the pointer to be non-NULL. Also consider using
|
|
24
|
+
assertions when accessing raw C arrays, if applicable.
|
|
25
|
+
|
|
26
|
+
## Setting up a local repository
|
|
27
|
+
|
|
28
|
+
Make sure you clone the repository in recursive mode, so you also get the
|
|
29
|
+
wrapped code of Jess which is exposed as a ``git`` submodule:
|
|
30
|
+
|
|
31
|
+
```console
|
|
32
|
+
$ git clone --recursive https://github.com/althonos/pyjess
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Running tests
|
|
36
|
+
|
|
37
|
+
Tests are written as usual Python unit tests with the `unittest` module of
|
|
38
|
+
the standard library. Running them requires the extension to be built
|
|
39
|
+
locally:
|
|
40
|
+
|
|
41
|
+
```console
|
|
42
|
+
$ python setup.py build_ext --debug --inplace
|
|
43
|
+
$ python -m unittest discover -vv
|
|
44
|
+
```
|
pyjess-0.1.0/COPYING
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Martin Larralde <martin.larralde@embl.de>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pyjess-0.1.0/MANIFEST.in
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
include COPYING
|
|
2
|
+
include CHANGELOG.md
|
|
3
|
+
include CONTRIBUTING.md
|
|
4
|
+
include README.md
|
|
5
|
+
|
|
6
|
+
recursive-include include *.pxd
|
|
7
|
+
recursive-include patches *.patch
|
|
8
|
+
recursive-include pyjess *.py *.pyi *.pxi *.pyx *.pxd *.h py.typed
|
|
9
|
+
recursive-include pyjess/tests/data *
|
|
10
|
+
|
|
11
|
+
recursive-include vendor/jess README.md LICENSE AUTHORS CHANGELOG
|
|
12
|
+
recursive-include vendor/jess *.c *.h
|
|
13
|
+
prune vendor/sword/vendor
|
|
14
|
+
|
|
15
|
+
recursive-include pyjess *.py *.pyi *.pxi *.pyx *.pxd *.h py.typed
|
|
16
|
+
recursive-exclude pyjess *.cpp *.html
|
|
17
|
+
|
pyjess-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pyjess
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Cython bindings and Python interface to JESS, a 3D template matching software.
|
|
5
|
+
Home-page: https://github.com/althonos/pyjess
|
|
6
|
+
Author: Martin Larralde
|
|
7
|
+
Author-email: martin.larralde@embl.de
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/althonos/pyjess/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/althonos/pyjess/blob/main/CHANGELOG.md
|
|
11
|
+
Project-URL: Coverage, https://codecov.io/gh/althonos/pyjess/
|
|
12
|
+
Project-URL: Builds, https://github.com/althonos/pyjess/actions
|
|
13
|
+
Project-URL: PyPI, https://pypi.org/project/pyjess
|
|
14
|
+
Keywords: bioinformatics,structure,template,matching
|
|
15
|
+
Platform: any
|
|
16
|
+
Classifier: Development Status :: 3 - Alpha
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Intended Audience :: Science/Research
|
|
19
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: Programming Language :: C++
|
|
22
|
+
Classifier: Programming Language :: Cython
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
29
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
30
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
31
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
32
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
33
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
34
|
+
Classifier: Typing :: Typed
|
|
35
|
+
Requires-Python: >=3.5
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
License-File: COPYING
|
|
38
|
+
|
|
39
|
+
# 🔍🐍 PyJess [](https://github.com/althonos/pyjess/stargazers)
|
|
40
|
+
|
|
41
|
+
*[Cython](https://cython.org/) bindings and Python interface to [Jess](https://github.com/iriziotis/jess), a 3D template matching software.*
|
|
42
|
+
|
|
43
|
+
[](https://github.com/althonos/pyjess/actions)
|
|
44
|
+
[](https://codecov.io/gh/althonos/pyjess/)
|
|
45
|
+
[](https://choosealicense.com/licenses/mit/)
|
|
46
|
+
<!-- [](https://pypi.org/project/pyjess) -->
|
|
47
|
+
<!-- [](https://anaconda.org/bioconda/pyjess) -->
|
|
48
|
+
<!-- [](https://aur.archlinux.org/packages/python-pyjess) -->
|
|
49
|
+
<!-- [](https://pypi.org/project/pyjess/#files) -->
|
|
50
|
+
<!-- [](https://pypi.org/project/pyjess/#files) -->
|
|
51
|
+
<!-- [](https://pypi.org/project/pyjess/#files) -->
|
|
52
|
+
[](https://github.com/althonos/pyjess/)
|
|
53
|
+
<!-- [](https://git.embl.de/larralde/pyjess/) -->
|
|
54
|
+
<!-- [](https://github.com/althonos/pyjess/issues) -->
|
|
55
|
+
<!-- [](https://pyjess.readthedocs.io) -->
|
|
56
|
+
<!-- [](https://github.com/althonos/pyjess/blob/main/CHANGELOG.md) -->
|
|
57
|
+
<!-- [](https://pepy.tech/project/pyjess) -->
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## 🗺️ Overview
|
|
61
|
+
|
|
62
|
+
Jess is an algorithm for constraint-based structural template matching
|
|
63
|
+
proposed by Jonathan Barker *et al.*[\[1\]](#ref1). It can be used to identify
|
|
64
|
+
catalytic residues from a known template inside a protein structure. Jess
|
|
65
|
+
is an evolution of TESS, a geometric hashing algorithm developed by
|
|
66
|
+
Andrew Wallace *et al.*[\[2\]](#ref2), removing some pre-computation and
|
|
67
|
+
structural requirements from the original algorithm. Jess was further
|
|
68
|
+
updated and maintained by [Ioannis Riziotis](https://github.com/iriziotis)
|
|
69
|
+
during his PhD in the [Thornton group](https://www.ebi.ac.uk/research/thornton/).
|
|
70
|
+
|
|
71
|
+
PyJess is a Python module that provides bindings to Jess using
|
|
72
|
+
[Cython](https://cython.org/). It allows creating templates, querying them
|
|
73
|
+
with protein structures, and retrieving the hits using a Python API without
|
|
74
|
+
performing any external I/O.
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## 🔧 Installing
|
|
78
|
+
|
|
79
|
+
PyJess is available for all modern Python versions (3.6+).
|
|
80
|
+
|
|
81
|
+
<!-- It can be installed directly from [PyPI](https://pypi.org/project/pyjess/),
|
|
82
|
+
which hosts some pre-built x86-64 wheels for Linux, MacOS, and Windows,
|
|
83
|
+
as well as the code required to compile from source with Cython:
|
|
84
|
+
```console
|
|
85
|
+
$ pip install pyjess
|
|
86
|
+
``` -->
|
|
87
|
+
|
|
88
|
+
<!-- Otherwise, PyJess is also available as a [Bioconda](https://bioconda.github.io/)
|
|
89
|
+
package:
|
|
90
|
+
```console
|
|
91
|
+
$ conda install -c bioconda pyjess
|
|
92
|
+
``` -->
|
|
93
|
+
|
|
94
|
+
<!-- Check the [*install* page](https://pyjess.readthedocs.io/en/stable/install.html)
|
|
95
|
+
of the documentation for other ways to install PyJess on your machine. -->
|
|
96
|
+
|
|
97
|
+
## 💡 Example
|
|
98
|
+
|
|
99
|
+
Load templates to be used as references from different template files:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import glob
|
|
103
|
+
import pyjess
|
|
104
|
+
|
|
105
|
+
templates = []
|
|
106
|
+
for path in sorted(glob.iglob("vendor/jess/examples/template_*.qry")):
|
|
107
|
+
with open(path) as f:
|
|
108
|
+
templates.append(Template.load(f, id=os.path.basename(path)))
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Create a `Jess` instance and use it to query a molecule (a PDB structure)
|
|
112
|
+
against the stored templates:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
jess = Jess(templates)
|
|
116
|
+
with open("vendor/jess/examples/test_pdbs/pdb1a0p.ent") as f:
|
|
117
|
+
mol = Molecule(f)
|
|
118
|
+
query = jess.query(mol, rmsd_threshold=2.0, distance_cutoff=3.0, max_dynamic_distance=3.0)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The hits are computed iteratively, and the different output statistics are
|
|
122
|
+
computed on-the-fly when requested:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
for hit in query:
|
|
126
|
+
print(hit.molecule.id, hit.template.id, hit.rmsd, hit.log_evalue)
|
|
127
|
+
for atom in hit.atoms():
|
|
128
|
+
print(atom.name, atom.x, atom.y, atom.z)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
## 🧶 Thread-safety
|
|
133
|
+
|
|
134
|
+
Once a `Jess` instance has been created, the templates cannot be edited anymore,
|
|
135
|
+
making the `Jess.query` method re-entrant. This allows querying several
|
|
136
|
+
molecules against the same templates in parallel using a thread pool:
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
molecules = []
|
|
140
|
+
for path in glob.glob("vendor/jess/examples/test_pdbs/*.ent"):
|
|
141
|
+
with open(path) as f:
|
|
142
|
+
molecules.append(Molecule.load(f))
|
|
143
|
+
|
|
144
|
+
with multiprocessing.ThreadPool() as pool:
|
|
145
|
+
hits = pool.map(jess.query, molecules)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
<!-- ## ⏱️ Benchmarks -->
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
## 💭 Feedback
|
|
152
|
+
|
|
153
|
+
### ⚠️ Issue Tracker
|
|
154
|
+
|
|
155
|
+
Found a bug ? Have an enhancement request ? Head over to the [GitHub issue tracker](https://github.com/althonos/[pyjess]/issues)
|
|
156
|
+
if you need to report or ask something. If you are filing in on a bug,
|
|
157
|
+
please include as much information as you can about the issue, and try to
|
|
158
|
+
recreate the same bug in a simple, easily reproducible situation.
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
### 🏗️ Contributing
|
|
162
|
+
|
|
163
|
+
Contributions are more than welcome! See
|
|
164
|
+
[`CONTRIBUTING.md`](https://github.com/althonos/pyjess/blob/main/CONTRIBUTING.md)
|
|
165
|
+
for more details.
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
## 📋 Changelog
|
|
169
|
+
|
|
170
|
+
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
|
|
171
|
+
and provides a [changelog](https://github.com/althonos/pyjess/blob/main/CHANGELOG.md)
|
|
172
|
+
in the [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) format.
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
## ⚖️ License
|
|
176
|
+
|
|
177
|
+
This library is provided under the [MIT License](https://choosealicense.com/licenses/mit/). The JESS code is distributed under the [MIT License](https://choosealicense.com/licenses/mit/) as well.
|
|
178
|
+
|
|
179
|
+
*This project is in no way not affiliated, sponsored, or otherwise endorsed
|
|
180
|
+
by the JESS authors. It was developed
|
|
181
|
+
by [Martin Larralde](https://github.com/althonos/) during his PhD project
|
|
182
|
+
at the [European Molecular Biology Laboratory](https://www.embl.de/) in
|
|
183
|
+
the [Zeller team](https://github.com/zellerlab).*
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
## 📚 References
|
|
187
|
+
|
|
188
|
+
- <a id="ref1">\[1\]</a> Barker, J. A., & Thornton, J. M. (2003). An algorithm for constraint-based structural template matching: application to 3D templates with statistical analysis. Bioinformatics (Oxford, England), 19(13), 1644–1649. [doi:10.1093/bioinformatics/btg226](https://doi.org/10.1093/bioinformatics/btg226).
|
|
189
|
+
- <a id="ref2">\[2\]</a> Wallace, A. C., Borkakoti, N., & Thornton, J. M. (1997). TESS: a geometric hashing algorithm for deriving 3D coordinate templates for searching structural databases. Application to enzyme active sites. Protein science : a publication of the Protein Society, 6(11), 2308–2323. [doi:10.1002/pro.5560061104](https://doi.org/10.1002/pro.5560061104).
|
pyjess-0.1.0/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# 🔍🐍 PyJess [](https://github.com/althonos/pyjess/stargazers)
|
|
2
|
+
|
|
3
|
+
*[Cython](https://cython.org/) bindings and Python interface to [Jess](https://github.com/iriziotis/jess), a 3D template matching software.*
|
|
4
|
+
|
|
5
|
+
[](https://github.com/althonos/pyjess/actions)
|
|
6
|
+
[](https://codecov.io/gh/althonos/pyjess/)
|
|
7
|
+
[](https://choosealicense.com/licenses/mit/)
|
|
8
|
+
<!-- [](https://pypi.org/project/pyjess) -->
|
|
9
|
+
<!-- [](https://anaconda.org/bioconda/pyjess) -->
|
|
10
|
+
<!-- [](https://aur.archlinux.org/packages/python-pyjess) -->
|
|
11
|
+
<!-- [](https://pypi.org/project/pyjess/#files) -->
|
|
12
|
+
<!-- [](https://pypi.org/project/pyjess/#files) -->
|
|
13
|
+
<!-- [](https://pypi.org/project/pyjess/#files) -->
|
|
14
|
+
[](https://github.com/althonos/pyjess/)
|
|
15
|
+
<!-- [](https://git.embl.de/larralde/pyjess/) -->
|
|
16
|
+
<!-- [](https://github.com/althonos/pyjess/issues) -->
|
|
17
|
+
<!-- [](https://pyjess.readthedocs.io) -->
|
|
18
|
+
<!-- [](https://github.com/althonos/pyjess/blob/main/CHANGELOG.md) -->
|
|
19
|
+
<!-- [](https://pepy.tech/project/pyjess) -->
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 🗺️ Overview
|
|
23
|
+
|
|
24
|
+
Jess is an algorithm for constraint-based structural template matching
|
|
25
|
+
proposed by Jonathan Barker *et al.*[\[1\]](#ref1). It can be used to identify
|
|
26
|
+
catalytic residues from a known template inside a protein structure. Jess
|
|
27
|
+
is an evolution of TESS, a geometric hashing algorithm developed by
|
|
28
|
+
Andrew Wallace *et al.*[\[2\]](#ref2), removing some pre-computation and
|
|
29
|
+
structural requirements from the original algorithm. Jess was further
|
|
30
|
+
updated and maintained by [Ioannis Riziotis](https://github.com/iriziotis)
|
|
31
|
+
during his PhD in the [Thornton group](https://www.ebi.ac.uk/research/thornton/).
|
|
32
|
+
|
|
33
|
+
PyJess is a Python module that provides bindings to Jess using
|
|
34
|
+
[Cython](https://cython.org/). It allows creating templates, querying them
|
|
35
|
+
with protein structures, and retrieving the hits using a Python API without
|
|
36
|
+
performing any external I/O.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## 🔧 Installing
|
|
40
|
+
|
|
41
|
+
PyJess is available for all modern Python versions (3.6+).
|
|
42
|
+
|
|
43
|
+
<!-- It can be installed directly from [PyPI](https://pypi.org/project/pyjess/),
|
|
44
|
+
which hosts some pre-built x86-64 wheels for Linux, MacOS, and Windows,
|
|
45
|
+
as well as the code required to compile from source with Cython:
|
|
46
|
+
```console
|
|
47
|
+
$ pip install pyjess
|
|
48
|
+
``` -->
|
|
49
|
+
|
|
50
|
+
<!-- Otherwise, PyJess is also available as a [Bioconda](https://bioconda.github.io/)
|
|
51
|
+
package:
|
|
52
|
+
```console
|
|
53
|
+
$ conda install -c bioconda pyjess
|
|
54
|
+
``` -->
|
|
55
|
+
|
|
56
|
+
<!-- Check the [*install* page](https://pyjess.readthedocs.io/en/stable/install.html)
|
|
57
|
+
of the documentation for other ways to install PyJess on your machine. -->
|
|
58
|
+
|
|
59
|
+
## 💡 Example
|
|
60
|
+
|
|
61
|
+
Load templates to be used as references from different template files:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import glob
|
|
65
|
+
import pyjess
|
|
66
|
+
|
|
67
|
+
templates = []
|
|
68
|
+
for path in sorted(glob.iglob("vendor/jess/examples/template_*.qry")):
|
|
69
|
+
with open(path) as f:
|
|
70
|
+
templates.append(Template.load(f, id=os.path.basename(path)))
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Create a `Jess` instance and use it to query a molecule (a PDB structure)
|
|
74
|
+
against the stored templates:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
jess = Jess(templates)
|
|
78
|
+
with open("vendor/jess/examples/test_pdbs/pdb1a0p.ent") as f:
|
|
79
|
+
mol = Molecule(f)
|
|
80
|
+
query = jess.query(mol, rmsd_threshold=2.0, distance_cutoff=3.0, max_dynamic_distance=3.0)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The hits are computed iteratively, and the different output statistics are
|
|
84
|
+
computed on-the-fly when requested:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
for hit in query:
|
|
88
|
+
print(hit.molecule.id, hit.template.id, hit.rmsd, hit.log_evalue)
|
|
89
|
+
for atom in hit.atoms():
|
|
90
|
+
print(atom.name, atom.x, atom.y, atom.z)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## 🧶 Thread-safety
|
|
95
|
+
|
|
96
|
+
Once a `Jess` instance has been created, the templates cannot be edited anymore,
|
|
97
|
+
making the `Jess.query` method re-entrant. This allows querying several
|
|
98
|
+
molecules against the same templates in parallel using a thread pool:
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
molecules = []
|
|
102
|
+
for path in glob.glob("vendor/jess/examples/test_pdbs/*.ent"):
|
|
103
|
+
with open(path) as f:
|
|
104
|
+
molecules.append(Molecule.load(f))
|
|
105
|
+
|
|
106
|
+
with multiprocessing.ThreadPool() as pool:
|
|
107
|
+
hits = pool.map(jess.query, molecules)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
<!-- ## ⏱️ Benchmarks -->
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
## 💭 Feedback
|
|
114
|
+
|
|
115
|
+
### ⚠️ Issue Tracker
|
|
116
|
+
|
|
117
|
+
Found a bug ? Have an enhancement request ? Head over to the [GitHub issue tracker](https://github.com/althonos/[pyjess]/issues)
|
|
118
|
+
if you need to report or ask something. If you are filing in on a bug,
|
|
119
|
+
please include as much information as you can about the issue, and try to
|
|
120
|
+
recreate the same bug in a simple, easily reproducible situation.
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### 🏗️ Contributing
|
|
124
|
+
|
|
125
|
+
Contributions are more than welcome! See
|
|
126
|
+
[`CONTRIBUTING.md`](https://github.com/althonos/pyjess/blob/main/CONTRIBUTING.md)
|
|
127
|
+
for more details.
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## 📋 Changelog
|
|
131
|
+
|
|
132
|
+
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
|
|
133
|
+
and provides a [changelog](https://github.com/althonos/pyjess/blob/main/CHANGELOG.md)
|
|
134
|
+
in the [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) format.
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
## ⚖️ License
|
|
138
|
+
|
|
139
|
+
This library is provided under the [MIT License](https://choosealicense.com/licenses/mit/). The JESS code is distributed under the [MIT License](https://choosealicense.com/licenses/mit/) as well.
|
|
140
|
+
|
|
141
|
+
*This project is in no way not affiliated, sponsored, or otherwise endorsed
|
|
142
|
+
by the JESS authors. It was developed
|
|
143
|
+
by [Martin Larralde](https://github.com/althonos/) during his PhD project
|
|
144
|
+
at the [European Molecular Biology Laboratory](https://www.embl.de/) in
|
|
145
|
+
the [Zeller team](https://github.com/zellerlab).*
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
## 📚 References
|
|
149
|
+
|
|
150
|
+
- <a id="ref1">\[1\]</a> Barker, J. A., & Thornton, J. M. (2003). An algorithm for constraint-based structural template matching: application to 3D templates with statistical analysis. Bioinformatics (Oxford, England), 19(13), 1644–1649. [doi:10.1093/bioinformatics/btg226](https://doi.org/10.1093/bioinformatics/btg226).
|
|
151
|
+
- <a id="ref2">\[2\]</a> Wallace, A. C., Borkakoti, N., & Thornton, J. M. (1997). TESS: a geometric hashing algorithm for deriving 3D coordinate templates for searching structural databases. Application to enzyme active sites. Protein science : a publication of the Protein Society, 6(11), 2308–2323. [doi:10.1002/pro.5560061104](https://doi.org/10.1002/pro.5560061104).
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
cdef extern from "Atom.h" nogil:
|
|
2
|
+
|
|
3
|
+
struct _Atom:
|
|
4
|
+
int serial
|
|
5
|
+
char[5] name
|
|
6
|
+
char altLoc
|
|
7
|
+
char[4] resName
|
|
8
|
+
char chainID1
|
|
9
|
+
char chainID2
|
|
10
|
+
int resSeq
|
|
11
|
+
char iCode
|
|
12
|
+
double[3] x
|
|
13
|
+
double occupancy
|
|
14
|
+
double tempFactor
|
|
15
|
+
char[4] segID
|
|
16
|
+
char[3] element
|
|
17
|
+
int charge
|
|
18
|
+
|
|
19
|
+
ctypedef _Atom Atom
|
|
20
|
+
|
|
21
|
+
int Atom_parse(Atom*, const char*)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from .atom cimport Atom
|
|
2
|
+
from .molecule cimport Molecule
|
|
3
|
+
from .super cimport Superposition
|
|
4
|
+
from .template cimport Template
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
cdef extern from "Jess.h" nogil:
|
|
8
|
+
|
|
9
|
+
ctypedef struct _Jess:
|
|
10
|
+
pass
|
|
11
|
+
|
|
12
|
+
ctypedef struct _JessQuery:
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
ctypedef _Jess Jess
|
|
16
|
+
ctypedef _JessQuery JessQuery
|
|
17
|
+
|
|
18
|
+
Jess* Jess_create()
|
|
19
|
+
void Jess_free(Jess*)
|
|
20
|
+
void Jess_addTemplate(Jess*, Template*)
|
|
21
|
+
JessQuery* Jess_query(Jess*, Molecule*, double, double)
|
|
22
|
+
|
|
23
|
+
void JessQuery_free(JessQuery*)
|
|
24
|
+
int JessQuery_next(JessQuery*, int)
|
|
25
|
+
Template* JessQuery_template(JessQuery*)
|
|
26
|
+
const Molecule* JessQuery_molecule(JessQuery*)
|
|
27
|
+
Atom** JessQuery_atoms(JessQuery*)
|
|
28
|
+
Superposition* JessQuery_superposition(JessQuery*)
|
|
29
|
+
|
|
30
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from .region cimport Region
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
cdef extern from "KdTree.h" nogil:
|
|
5
|
+
|
|
6
|
+
cdef struct _KdTree:
|
|
7
|
+
pass
|
|
8
|
+
cdef struct _KdTreeQuery:
|
|
9
|
+
pass
|
|
10
|
+
|
|
11
|
+
ctypedef _KdTree KdTree
|
|
12
|
+
ctypedef _KdTreeQuery KdTreeQuery
|
|
13
|
+
|
|
14
|
+
KdTree* KdTree_create(double**, int, int)
|
|
15
|
+
void KdTree_free(KdTree**)
|
|
16
|
+
KdTreeQuery* KdTree_query(KdTree*, Region*)
|
|
17
|
+
|
|
18
|
+
void KdTreeQuery_free(KdTreeQuery*)
|
|
19
|
+
int KdTreeQuery_next(KdTreeQuery*)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from libc.stdio cimport FILE
|
|
2
|
+
|
|
3
|
+
from .atom cimport Atom
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
cdef extern from "Molecule.h" nogil:
|
|
7
|
+
|
|
8
|
+
cdef struct _Molecule:
|
|
9
|
+
int count
|
|
10
|
+
char[5] id
|
|
11
|
+
Atom** atom
|
|
12
|
+
|
|
13
|
+
ctypedef _Molecule Molecule
|
|
14
|
+
|
|
15
|
+
Molecule* Molecule_create(FILE*, int, double)
|
|
16
|
+
void Molecule_free(Molecule*)
|
|
17
|
+
int Molecule_count(const Molecule*)
|
|
18
|
+
Atom* Molecule_atom(const Molecule*, int)
|
|
19
|
+
const char* Molecule_id(const Molecule*)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
cdef extern from "Region.h" nogil:
|
|
2
|
+
|
|
3
|
+
struct _Region:
|
|
4
|
+
int (*intersectionQ)(Region*, double*, double*, int)
|
|
5
|
+
int (*inclusionQ)(Region*, double*, int)
|
|
6
|
+
void (*free)(Region*)
|
|
7
|
+
ctypedef _Region Region
|
|
8
|
+
|
|
9
|
+
double Region_volume(Region*, double, double*, double*, int)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from .molecule import Molecule
|
|
2
|
+
from .template import Template
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
cdef extern from "Scanner.h" nogil:
|
|
6
|
+
|
|
7
|
+
cdef struct _Scanner:
|
|
8
|
+
pass
|
|
9
|
+
ctypedef _Scanner Scanner
|
|
10
|
+
|
|
11
|
+
Scanner* Scanner_create(Molecule*, Template*, double, double)
|
|
12
|
+
void Scanner_free(Scanner*)
|
|
13
|
+
Atom** Scanner_next(Scanner*, int)
|
|
14
|
+
double Scanner_rmsd(Scanner*)
|
|
15
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
cdef extern from "Super.h" nogil:
|
|
2
|
+
|
|
3
|
+
cdef struct _Superposition:
|
|
4
|
+
pass
|
|
5
|
+
ctypedef _Superposition Superposition
|
|
6
|
+
|
|
7
|
+
Superposition* Superposition_create()
|
|
8
|
+
void Superposition_free(Superposition*)
|
|
9
|
+
void Superposition_align(Superposition*, const double*, const double*)
|
|
10
|
+
int Superposition_count(const Superposition*)
|
|
11
|
+
double Superposition_rmsd(Superposition*)
|
|
12
|
+
double Superposition_rmsd100(Superposition*)
|
|
13
|
+
const double* Superposition_centroid(Superposition*, int)
|
|
14
|
+
const double* Superposition_rotation(Superposition*)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from .atom cimport Atom
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
cdef extern from "Template.h" nogil:
|
|
5
|
+
|
|
6
|
+
ctypedef _Template Template
|
|
7
|
+
cdef struct _Template:
|
|
8
|
+
void (*free)(Template*) nogil
|
|
9
|
+
int (*count)(const Template*) nogil
|
|
10
|
+
int (*match)(const Template*, int, const Atom*) nogil
|
|
11
|
+
int (*range)(const Template*, int, int, double*, double*) nogil
|
|
12
|
+
int (*check)(const Template*, Atom**, int, int) nogil
|
|
13
|
+
const double* (*position)(const Template*, int) nogil
|
|
14
|
+
const char* (*name)(const Template*) nogil
|
|
15
|
+
double (*logE)(const Template*, double, int) nogil
|
|
16
|
+
double (*distWeight)(const Template*, int) nogil
|
|
17
|
+
Template* (*copy)(const Template*) nogil
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from .atom cimport Atom
|
|
2
|
+
|
|
3
|
+
cdef extern from "TessAtom.h" nogil:
|
|
4
|
+
|
|
5
|
+
struct _TessAtom:
|
|
6
|
+
int code
|
|
7
|
+
int resSeq
|
|
8
|
+
int nameCount
|
|
9
|
+
int resNameCount
|
|
10
|
+
char chainID1
|
|
11
|
+
char chainID2
|
|
12
|
+
char **name
|
|
13
|
+
char **resName
|
|
14
|
+
double pos[3]
|
|
15
|
+
double distWeight
|
|
16
|
+
|
|
17
|
+
ctypedef _TessAtom TessAtom
|
|
18
|
+
|
|
19
|
+
TessAtom* TessAtom_create(const char*)
|
|
20
|
+
void TessAtom_free(TessAtom*)
|
|
21
|
+
const double* TessAtom_position(const TessAtom*)
|
|
22
|
+
int TessAtom_match(const TessAtom*, const Atom*)
|
|
23
|
+
int TessAtom_resSeq(const TessAtom*)
|
|
24
|
+
char TessAtom_chainID1(const TessAtom*)
|
|
25
|
+
char TessAtom_chainID2(const TessAtom*)
|
|
26
|
+
double TessAtom_distWeight(const TessAtom*)
|
|
27
|
+
|
|
28
|
+
TessAtom* TessAtom_copy(const TessAtom*)
|
|
29
|
+
double TessAtom_distance(const TessAtom*, const TessAtom*)
|