pyjess 0.5.0__tar.gz → 0.5.2__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.

Files changed (127) hide show
  1. {pyjess-0.5.0 → pyjess-0.5.2}/.github/workflows/package.yml +1 -1
  2. {pyjess-0.5.0 → pyjess-0.5.2}/CHANGELOG.md +22 -1
  3. {pyjess-0.5.0 → pyjess-0.5.2}/PKG-INFO +3 -3
  4. {pyjess-0.5.0 → pyjess-0.5.2}/README.md +2 -2
  5. {pyjess-0.5.0 → pyjess-0.5.2}/docs/_static/json/switcher.json +6 -1
  6. {pyjess-0.5.0 → pyjess-0.5.2}/docs/index.rst +1 -1
  7. pyjess-0.5.2/include/jess/candidate_set.pxd +15 -0
  8. {pyjess-0.5.0 → pyjess-0.5.2}/include/jess/molecule.pxd +3 -1
  9. pyjess-0.5.2/include/jess/res_index.pxd +15 -0
  10. {pyjess-0.5.0 → pyjess-0.5.2}/include/jess/template.pxd +3 -1
  11. {pyjess-0.5.0 → pyjess-0.5.2}/include/jess/tess_template.pxd +3 -0
  12. pyjess-0.5.2/patches/CMakeLists.txt.patch +35 -0
  13. pyjess-0.5.2/patches/CandidateSet.c.patch +71 -0
  14. pyjess-0.5.2/patches/CandidateSet.h.patch +51 -0
  15. {pyjess-0.5.0 → pyjess-0.5.2}/patches/Jess.c.patch +27 -5
  16. pyjess-0.5.2/patches/Molecule.c.patch +54 -0
  17. pyjess-0.5.2/patches/Molecule.h.patch +35 -0
  18. pyjess-0.5.2/patches/ResIndex.c.patch +181 -0
  19. pyjess-0.5.2/patches/ResIndex.h.patch +52 -0
  20. pyjess-0.5.2/patches/Scanner.c.patch +108 -0
  21. {pyjess-0.5.0 → pyjess-0.5.2}/patches/Super.c.patch +5 -28
  22. pyjess-0.5.2/patches/Template.h.patch +33 -0
  23. pyjess-0.5.2/patches/TessAtom.c.patch +175 -0
  24. pyjess-0.5.2/patches/TessAtom.h.patch +52 -0
  25. {pyjess-0.5.0 → pyjess-0.5.2}/patches/TessTemplate.c.patch +116 -35
  26. {pyjess-0.5.0 → pyjess-0.5.2}/patches/TessTemplate.h.patch +21 -3
  27. {pyjess-0.5.0 → pyjess-0.5.2}/pkg/aur/PKGBUILD.in +1 -1
  28. {pyjess-0.5.0 → pyjess-0.5.2}/pyproject.toml +2 -2
  29. {pyjess-0.5.0 → pyjess-0.5.2}/src/jess/CMakeLists.txt +50 -21
  30. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/_jess.pyi +2 -0
  31. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/_jess.pyx +79 -30
  32. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/tests/__init__.py +2 -0
  33. pyjess-0.5.2/src/pyjess/tests/test_hit.py +33 -0
  34. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/tests/test_jess.py +34 -0
  35. {pyjess-0.5.0 → pyjess-0.5.2}/src/scripts/apply_patch.py +7 -1
  36. pyjess-0.5.2/src/scripts/generate_patches.py +49 -0
  37. pyjess-0.5.0/patches/Molecule.c.patch +0 -18
  38. pyjess-0.5.0/patches/Molecule.h.patch +0 -17
  39. pyjess-0.5.0/patches/Template.h.patch +0 -12
  40. pyjess-0.5.0/patches/TessAtom.c.patch +0 -141
  41. pyjess-0.5.0/patches/TessAtom.h.patch +0 -34
  42. {pyjess-0.5.0 → pyjess-0.5.2}/.github/workflows/requirements.txt +0 -0
  43. {pyjess-0.5.0 → pyjess-0.5.2}/.github/workflows/test.yml +0 -0
  44. {pyjess-0.5.0 → pyjess-0.5.2}/.gitignore +0 -0
  45. {pyjess-0.5.0 → pyjess-0.5.2}/.gitmodules +0 -0
  46. {pyjess-0.5.0 → pyjess-0.5.2}/.readthedocs.yaml +0 -0
  47. {pyjess-0.5.0 → pyjess-0.5.2}/CMakeLists.txt +0 -0
  48. {pyjess-0.5.0 → pyjess-0.5.2}/CONTRIBUTING.md +0 -0
  49. {pyjess-0.5.0 → pyjess-0.5.2}/COPYING +0 -0
  50. {pyjess-0.5.0 → pyjess-0.5.2}/docs/.gitignore +0 -0
  51. {pyjess-0.5.0 → pyjess-0.5.2}/docs/Makefile +0 -0
  52. {pyjess-0.5.0 → pyjess-0.5.2}/docs/_static/css/main.css +0 -0
  53. {pyjess-0.5.0 → pyjess-0.5.2}/docs/_static/js/custom-icon.js +0 -0
  54. {pyjess-0.5.0 → pyjess-0.5.2}/docs/api/index.rst +0 -0
  55. {pyjess-0.5.0 → pyjess-0.5.2}/docs/api/jess.rst +0 -0
  56. {pyjess-0.5.0 → pyjess-0.5.2}/docs/api/molecule.rst +0 -0
  57. {pyjess-0.5.0 → pyjess-0.5.2}/docs/api/template.rst +0 -0
  58. {pyjess-0.5.0 → pyjess-0.5.2}/docs/conf.py +0 -0
  59. {pyjess-0.5.0 → pyjess-0.5.2}/docs/guide/changes.md +0 -0
  60. {pyjess-0.5.0 → pyjess-0.5.2}/docs/guide/contributing.md +0 -0
  61. {pyjess-0.5.0 → pyjess-0.5.2}/docs/guide/copyright.rst +0 -0
  62. {pyjess-0.5.0 → pyjess-0.5.2}/docs/guide/index.rst +0 -0
  63. {pyjess-0.5.0 → pyjess-0.5.2}/docs/guide/install.rst +0 -0
  64. {pyjess-0.5.0 → pyjess-0.5.2}/docs/make.bat +0 -0
  65. {pyjess-0.5.0 → pyjess-0.5.2}/docs/requirements.txt +0 -0
  66. {pyjess-0.5.0 → pyjess-0.5.2}/include/jess/__init__.pxd +0 -0
  67. {pyjess-0.5.0 → pyjess-0.5.2}/include/jess/annulus.pxd +0 -0
  68. {pyjess-0.5.0 → pyjess-0.5.2}/include/jess/atom.pxd +0 -0
  69. {pyjess-0.5.0 → pyjess-0.5.2}/include/jess/jess.pxd +0 -0
  70. {pyjess-0.5.0 → pyjess-0.5.2}/include/jess/join.pxd +0 -0
  71. {pyjess-0.5.0 → pyjess-0.5.2}/include/jess/kdtree.pxd +0 -0
  72. {pyjess-0.5.0 → pyjess-0.5.2}/include/jess/region.pxd +0 -0
  73. {pyjess-0.5.0 → pyjess-0.5.2}/include/jess/scanner.pxd +0 -0
  74. {pyjess-0.5.0 → pyjess-0.5.2}/include/jess/super.pxd +0 -0
  75. {pyjess-0.5.0 → pyjess-0.5.2}/include/jess/tess_atom.pxd +0 -0
  76. {pyjess-0.5.0 → pyjess-0.5.2}/patches/Atom.h.patch +0 -0
  77. {pyjess-0.5.0 → pyjess-0.5.2}/patches/KdTree.c.patch +0 -0
  78. {pyjess-0.5.0 → pyjess-0.5.2}/src/CMakeLists.txt +0 -0
  79. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/.gitignore +0 -0
  80. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/CMakeLists.txt +0 -0
  81. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/__init__.py +0 -0
  82. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/py.typed +0 -0
  83. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/tests/data/1.3.3.tpl +0 -0
  84. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/tests/data/1AMY+1.3.3.txt +0 -0
  85. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/tests/data/1AMY.pdb +0 -0
  86. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/tests/data/__init__.py +0 -0
  87. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/tests/data/pdb1lnb.pdb +0 -0
  88. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/tests/data/template_01.qry +0 -0
  89. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/tests/data/template_02.qry +0 -0
  90. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/tests/test_atom.py +0 -0
  91. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/tests/test_molecule.py +0 -0
  92. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/tests/test_template.py +0 -0
  93. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/tests/test_template_atom.py +0 -0
  94. {pyjess-0.5.0 → pyjess-0.5.2}/src/pyjess/tests/utils.py +0 -0
  95. {pyjess-0.5.0 → pyjess-0.5.2}/src/scripts/cmake/CythonExtension.cmake +0 -0
  96. {pyjess-0.5.0 → pyjess-0.5.2}/src/scripts/cmake/pystate_patch.h +0 -0
  97. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/.gitignore +0 -0
  98. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/README.md +0 -0
  99. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/examples/template_01.qry +0 -0
  100. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/examples/template_02.qry +0 -0
  101. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/examples/test_pdbs/pdb1lnb.ent +0 -0
  102. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/filter_output.py +0 -0
  103. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Annulus.c +0 -0
  104. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Annulus.h +0 -0
  105. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Atom.c +0 -0
  106. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Atom.h +0 -0
  107. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Jess.c +0 -0
  108. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Jess.h +0 -0
  109. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Join.c +0 -0
  110. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Join.h +0 -0
  111. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/KdTree.c +0 -0
  112. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/KdTree.h +0 -0
  113. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Main.c +0 -0
  114. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Molecule.c +0 -0
  115. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Molecule.h +0 -0
  116. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Region.c +0 -0
  117. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Region.h +0 -0
  118. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Scanner.c +0 -0
  119. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Scanner.h +0 -0
  120. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Super.c +0 -0
  121. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Super.h +0 -0
  122. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/Template.h +0 -0
  123. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/TessAtom.c +0 -0
  124. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/TessAtom.h +0 -0
  125. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/TessTemplate.c +0 -0
  126. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/TessTemplate.h +0 -0
  127. {pyjess-0.5.0 → pyjess-0.5.2}/vendor/jess/src/jess +0 -0
@@ -89,7 +89,7 @@ jobs:
89
89
 
90
90
  wheel-win32-x86_64:
91
91
  name: Build Windows wheels (x86-64)
92
- runs-on: windows-2019
92
+ runs-on: windows-latest
93
93
  steps:
94
94
  - uses: actions/checkout@v4
95
95
  with:
@@ -6,7 +6,28 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
 
8
8
  ## [Unreleased]
9
- [Unreleased]: https://github.com/althonos/pyjess/compare/v0.5.0...HEAD
9
+ [Unreleased]: https://github.com/althonos/pyjess/compare/v0.5.2...HEAD
10
+
11
+
12
+ ## [v0.5.2] - 2025-08-26
13
+ [v0.5.2]: https://github.com/althonos/pyjess/compare/v0.5.1...v0.5.2
14
+
15
+ ### Added
16
+ - `pickle` protocol support to `Hit` objects.
17
+
18
+ ### Fixed
19
+ - Improve performance of residue index using binary search on name queries.
20
+ - Avoid copying atoms in `Hit.atoms` if no transformation is required.
21
+
22
+
23
+ ## [v0.5.1] - 2025-08-20
24
+ [v0.5.1]: https://github.com/althonos/pyjess/compare/v0.5.0...v0.5.1
25
+
26
+ ### Fixed
27
+ - Typo in `Hit.molecule` returning incorrect coordinates when transformation is required.
28
+
29
+ ### Changed
30
+ - Implement an index to quickly access atoms by residue names in a `Molecule`, and accelerate initial candidate set creation for compatible match modes.
10
31
 
11
32
 
12
33
  ## [v0.5.0] - 2025-04-09
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pyjess
3
- Version: 0.5.0
3
+ Version: 0.5.2
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>
@@ -76,7 +76,7 @@ Description-Content-Type: text/markdown
76
76
  [![Issues](https://img.shields.io/github/issues/althonos/pyjess.svg?style=flat-square&maxAge=600)](https://github.com/althonos/pyjess/issues)
77
77
  [![Docs](https://img.shields.io/readthedocs/pyjess/latest?style=flat-square&maxAge=600)](https://pyjess.readthedocs.io)
78
78
  [![Changelog](https://img.shields.io/badge/keep%20a-changelog-8A0707.svg?maxAge=2678400&style=flat-square)](https://github.com/althonos/pyjess/blob/main/CHANGELOG.md)
79
- [![Downloads](https://img.shields.io/pypi/dm/pyjess?style=flat-square&color=303f9f&maxAge=86400&label=downloads)](https://pepy.tech/project/pyjess)
79
+ [![Downloads](https://img.shields.io/badge/dynamic/regex?url=https%3A%2F%2Fpepy.tech%2Fprojects%2Fpyjess&search=%5B0-9%5D%2B.%5B0-9%5D%2B(k%7CM)&style=flat-square&label=downloads&color=303f9f&cacheSeconds=86400)](https://pepy.tech/project/pyjess)
80
80
 
81
81
 
82
82
  ## 🗺️ Overview
@@ -184,7 +184,7 @@ If running Jess in parallel, make sure to use `v0.2.1` or later to use the code
184
184
 
185
185
  ### ⚠️ Issue Tracker
186
186
 
187
- Found a bug ? Have an enhancement request ? Head over to the [GitHub issue tracker](https://github.com/althonos/[pyjess]/issues)
187
+ Found a bug ? Have an enhancement request ? Head over to the [GitHub issue tracker](https://github.com/althonos/pyjess/issues)
188
188
  if you need to report or ask something. If you are filing in on a bug,
189
189
  please include as much information as you can about the issue, and try to
190
190
  recreate the same bug in a simple, easily reproducible situation.
@@ -16,7 +16,7 @@
16
16
  [![Issues](https://img.shields.io/github/issues/althonos/pyjess.svg?style=flat-square&maxAge=600)](https://github.com/althonos/pyjess/issues)
17
17
  [![Docs](https://img.shields.io/readthedocs/pyjess/latest?style=flat-square&maxAge=600)](https://pyjess.readthedocs.io)
18
18
  [![Changelog](https://img.shields.io/badge/keep%20a-changelog-8A0707.svg?maxAge=2678400&style=flat-square)](https://github.com/althonos/pyjess/blob/main/CHANGELOG.md)
19
- [![Downloads](https://img.shields.io/pypi/dm/pyjess?style=flat-square&color=303f9f&maxAge=86400&label=downloads)](https://pepy.tech/project/pyjess)
19
+ [![Downloads](https://img.shields.io/badge/dynamic/regex?url=https%3A%2F%2Fpepy.tech%2Fprojects%2Fpyjess&search=%5B0-9%5D%2B.%5B0-9%5D%2B(k%7CM)&style=flat-square&label=downloads&color=303f9f&cacheSeconds=86400)](https://pepy.tech/project/pyjess)
20
20
 
21
21
 
22
22
  ## 🗺️ Overview
@@ -124,7 +124,7 @@ If running Jess in parallel, make sure to use `v0.2.1` or later to use the code
124
124
 
125
125
  ### ⚠️ Issue Tracker
126
126
 
127
- Found a bug ? Have an enhancement request ? Head over to the [GitHub issue tracker](https://github.com/althonos/[pyjess]/issues)
127
+ Found a bug ? Have an enhancement request ? Head over to the [GitHub issue tracker](https://github.com/althonos/pyjess/issues)
128
128
  if you need to report or ask something. If you are filing in on a bug,
129
129
  please include as much information as you can about the issue, and try to
130
130
  recreate the same bug in a simple, easily reproducible situation.
@@ -1,6 +1,11 @@
1
1
  [
2
2
  {
3
- "name": "v0.4 (latest)",
3
+ "name": "v0.5 (latest)",
4
+ "version": "0.5.2",
5
+ "url": "https://pyjess.readthedocs.io/en/v0.5.2/"
6
+ },
7
+ {
8
+ "name": "v0.4",
4
9
  "version": "0.4.1",
5
10
  "url": "https://pyjess.readthedocs.io/en/v0.4.1/"
6
11
  },
@@ -65,7 +65,7 @@ PyJess |Stars|
65
65
  :target: https://github.com/althonos/pyjess/blob/main/CHANGELOG.md
66
66
  :class: dark-light
67
67
 
68
- .. |Downloads| image:: https://img.shields.io/pypi/dm/pyjess?style=flat-square&color=303f9f&maxAge=3600&label=downloads
68
+ .. |Downloads| image:: https://img.shields.io/badge/dynamic/regex?url=https%3A%2F%2Fpepy.tech%2Fprojects%2Fpyjess&search=%5B0-9%5D%2B.%5B0-9%5D%2B(k%7CM)&style=flat-square&label=downloads&color=303f9f&cacheSeconds=86400
69
69
  :target: https://pepy.tech/project/pyjess
70
70
  :class: dark-light
71
71
 
@@ -0,0 +1,15 @@
1
+ from .atom cimport Atom
2
+ from .molecule cimport Molecule
3
+
4
+
5
+ cdef extern from "CandidateSet.h" nogil:
6
+
7
+ struct _CandidateSet:
8
+ int count
9
+ Atom **atom
10
+ double **coord
11
+
12
+ ctypedef _CandidateSet CandidateSet
13
+
14
+ CandidateSet *CandidateSet_create(const Molecule *M)
15
+ void CandidateSet_free(CandidateSet*)
@@ -1,6 +1,7 @@
1
1
  from libc.stdio cimport FILE
2
2
 
3
3
  from .atom cimport Atom
4
+ from .res_index cimport ResIndex
4
5
 
5
6
 
6
7
  cdef extern from "Molecule.h" nogil:
@@ -8,6 +9,7 @@ cdef extern from "Molecule.h" nogil:
8
9
  cdef struct _Molecule:
9
10
  int count
10
11
  char[5] id
12
+ ResIndex* index
11
13
  Atom** atom
12
14
 
13
15
  ctypedef _Molecule Molecule
@@ -15,5 +17,5 @@ cdef extern from "Molecule.h" nogil:
15
17
  Molecule* Molecule_create(FILE*, int, double)
16
18
  void Molecule_free(Molecule*)
17
19
  int Molecule_count(const Molecule*)
18
- Atom* Molecule_atom(const Molecule*, int)
20
+ const Atom* Molecule_atom(const Molecule*, int)
19
21
  const char* Molecule_id(const Molecule*)
@@ -0,0 +1,15 @@
1
+ from .atom cimport Atom
2
+
3
+
4
+ cdef extern from "ResIndex.h" nogil:
5
+
6
+ struct _ResIndex:
7
+ int count
8
+ Atom **atom
9
+ double **coord
10
+
11
+ ctypedef _ResIndex ResIndex
12
+
13
+ extern ResIndex* ResIndex_create(Atom**, int)
14
+ extern Atom** ResIndex_get(ResIndex*, const char[4])
15
+ extern void ResIndex_free(ResIndex*)
@@ -1,5 +1,6 @@
1
1
  from .atom cimport Atom
2
-
2
+ from .molecule cimport Molecule
3
+ from .candidate_set cimport CandidateSet
3
4
 
4
5
  cdef extern from "Template.h" nogil:
5
6
 
@@ -10,6 +11,7 @@ cdef extern from "Template.h" nogil:
10
11
  int (*match)(const Template*, int, const Atom*) nogil
11
12
  int (*range)(const Template*, int, int, double*, double*) nogil
12
13
  int (*check)(const Template*, Atom**, int, int) nogil
14
+ CandidateSet* (*candidates)(const Template*, const Molecule*, int);
13
15
  const double* (*position)(const Template*, int) nogil
14
16
  const char* (*name)(const Template*) nogil
15
17
  double (*logE)(const Template*, double, int) nogil
@@ -3,6 +3,8 @@ from libc.stdio cimport FILE
3
3
  from .atom cimport Atom
4
4
  from .tess_atom cimport TessAtom
5
5
  from .template cimport Template
6
+ from .molecule cimport Molecule
7
+ from .candidate_set cimport CandidateSet
6
8
 
7
9
 
8
10
  cdef extern from "TessTemplate.h" nogil:
@@ -22,6 +24,7 @@ cdef extern from "TessTemplate.h" nogil:
22
24
  const double *TessTemplate_position(const Template *T, int k)
23
25
  double TessTemplate_distWeight(const Template *T, int k)
24
26
  int TessTemplate_check(const Template *T, Atom **A, int k, int ignore_chain)
27
+ CandidateSet* TessTemplate_candidates(const Template *T, const Molecule *M, int k)
25
28
  const char *TessTemplate_name(const Template *T)
26
29
  double TessTemplate_logE(const Template *T,double rmsd, int n)
27
30
  void TessTemplate_free(Template *T)
@@ -0,0 +1,35 @@
1
+ diff --git a/CMakeLists.txt b/CMakeLists.txt
2
+ new file mode 100644
3
+ index 0000000..b34b6e7
4
+ --- /dev/null
5
+ +++ b/CMakeLists.txt
6
+ @@ -0,0 +1,29 @@
7
+ +cmake_minimum_required(VERSION 3.10)
8
+ +project(Jess)
9
+ +
10
+ +include(CheckSymbolExists)
11
+ +check_symbol_exists(alloca "alloca.h" HAVE_ALLOCA)
12
+ +
13
+ +add_library(jess)
14
+ +target_sources(jess PRIVATE
15
+ + src/Annulus.c
16
+ + src/Join.c
17
+ + src/Molecule.c
18
+ + src/Super.c
19
+ + src/Atom.c
20
+ + src/KdTree.c
21
+ + src/Region.c
22
+ + src/TessAtom.c
23
+ + src/Jess.c
24
+ + src/Scanner.c
25
+ + src/TessTemplate.c
26
+ + src/CandidateSet.c
27
+ + src/ResIndex.c)
28
+ +if(HAVE_ALLOCA)
29
+ + target_compile_definitions(jess PUBLIC -DHAVE_ALLOCA)
30
+ +endif()
31
+ +
32
+ +add_executable(jess_bin)
33
+ +target_sources(jess_bin PRIVATE src/Main.c)
34
+ +target_link_libraries(jess_bin jess m)
35
+ +set_property(TARGET jess_bin PROPERTY OUTPUT_NAME jess)
@@ -0,0 +1,71 @@
1
+ diff --git a/src/CandidateSet.c b/src/CandidateSet.c
2
+ new file mode 100644
3
+ index 0000000..a67e878
4
+ --- /dev/null
5
+ +++ b/src/CandidateSet.c
6
+ @@ -0,0 +1,65 @@
7
+ +// ==================================================================
8
+ +// CandidateSet.h
9
+ +// Copyright (c) Jonathan Barker, 2002
10
+ +// Copyright (c) Martin Larralde, 2025
11
+ +// ==================================================================
12
+ +// Implementation of type CandidateSet.
13
+ +// ==================================================================
14
+ +
15
+ +#include <stdlib.h>
16
+ +
17
+ +#include "CandidateSet.h"
18
+ +#include "Atom.h"
19
+ +#include "Molecule.h"
20
+ +#include "Template.h"
21
+ +
22
+ +// ==================================================================
23
+ +// Methods of local type CandidateSet
24
+ +// ==================================================================
25
+ +
26
+ +CandidateSet *CandidateSet_create(const Molecule *M)
27
+ +{
28
+ + CandidateSet *S;
29
+ + Atom *A;
30
+ + int n = Molecule_count(M);
31
+ + int m;
32
+ +
33
+ + S = (CandidateSet*)calloc(1,sizeof(CandidateSet));
34
+ + if(!S) return NULL;
35
+ +
36
+ + S->atom=(Atom**)calloc(n,sizeof(Atom*));
37
+ + S->coord = NULL;
38
+ + S->count = 0;
39
+ +
40
+ + return S;
41
+ +}
42
+ +
43
+ +void CandidateSet_addAtom(CandidateSet *S, Atom *A)
44
+ +{
45
+ + S->atom[S->count]=A;
46
+ + S->count++;
47
+ +}
48
+ +
49
+ +void CandidateSet_recordCoordinates(CandidateSet *S)
50
+ +{
51
+ + int m;
52
+ +
53
+ + S->atom=(Atom**)realloc(S->atom,sizeof(Atom*)*S->count);
54
+ + S->coord=(double**)calloc(S->count,sizeof(double*));
55
+ +
56
+ + for(m=0; m<S->count; m++)
57
+ + S->coord[m]=S->atom[m]->x;
58
+ +}
59
+ +
60
+ +
61
+ +void CandidateSet_free(CandidateSet *S)
62
+ +{
63
+ + if(S)
64
+ + {
65
+ + if(S->atom) free(S->atom);
66
+ + if(S->coord) free(S->coord);
67
+ + free(S);
68
+ + }
69
+ +}
70
+ +
71
+ +// ==================================================================
@@ -0,0 +1,51 @@
1
+ diff --git a/src/CandidateSet.h b/src/CandidateSet.h
2
+ new file mode 100644
3
+ index 0000000..9b12e6e
4
+ --- /dev/null
5
+ +++ b/src/CandidateSet.h
6
+ @@ -0,0 +1,44 @@
7
+ +// ==================================================================
8
+ +// CandidateSet.h
9
+ +// Copyright (c) Jonathan Barker, 2002
10
+ +// Copyright (c) Martin Larralde, 2025
11
+ +// ==================================================================
12
+ +// Declaration of type CandidateSet.
13
+ +// ==================================================================
14
+ +
15
+ +#ifndef CANDIDATESET_H
16
+ +#define CANDIDATESET_H
17
+ +
18
+ +#include "Atom.h"
19
+ +#include "Molecule.h"
20
+ +
21
+ +// ==================================================================
22
+ +// Local type CandidateSet
23
+ +// ==================================================================
24
+ +// count Number of atoms in the set
25
+ +// atom[k] Points to ATOM record for kth candidate
26
+ +// coord[k] Points to coordinates for kth candidate
27
+ +// ==================================================================
28
+ +
29
+ +struct _CandidateSet
30
+ +{
31
+ + int count;
32
+ + Atom **atom;
33
+ + double **coord;
34
+ +};
35
+ +
36
+ +typedef struct _CandidateSet CandidateSet;
37
+ +
38
+ +// ==================================================================
39
+ +// Declaration of methods of local type CandidateSet
40
+ +// ==================================================================
41
+ +// create(M,T,k) Create from molecule M, atom k of T
42
+ +// free(S) Free candidate set
43
+ +// ==================================================================
44
+ +
45
+ +CandidateSet *CandidateSet_create(const Molecule*);
46
+ +void CandidateSet_addAtom(CandidateSet*, Atom*);
47
+ +void CandidateSet_recordCoordinates(CandidateSet*);
48
+ +void CandidateSet_free(CandidateSet*);
49
+ +
50
+ +#endif
51
+
@@ -1,8 +1,30 @@
1
1
  diff --git a/src/Jess.c b/src/Jess.c
2
- index e81bda0..6d44558 100644
2
+ index e81bda0..c4e581b 100644
3
3
  --- a/src/Jess.c
4
4
  +++ b/src/Jess.c
5
- @@ -91,8 +91,10 @@ void Jess_free(Jess *J)
5
+ @@ -4,15 +4,17 @@
6
+ // Implementation of types Jess and JessQuery.
7
+ // ==================================================================
8
+
9
+ +#include <stdio.h>
10
+ +#include <stdlib.h>
11
+ +#include <math.h>
12
+ +#include <string.h>
13
+ +
14
+ #include "Jess.h"
15
+ #include "Molecule.h"
16
+ #include "Scanner.h"
17
+ #include "TessTemplate.h"
18
+ #include "Super.h"
19
+ -#include <stdio.h>
20
+ -#include <stdlib.h>
21
+ -#include <math.h>
22
+ -#include <string.h>
23
+ +
24
+
25
+ // ==================================================================
26
+ // Forward declarations of local types
27
+ @@ -91,8 +93,10 @@ void Jess_free(Jess *J)
6
28
  n=J->head->next;
7
29
  T=J->head->template;
8
30
  if(T) T->free(T);
@@ -13,13 +35,13 @@ index e81bda0..6d44558 100644
13
35
  }
14
36
  }
15
37
 
16
- @@ -157,26 +159,26 @@ Superposition *JessQuery_superposition(JessQuery *Q)
38
+ @@ -156,27 +160,25 @@ Superposition *JessQuery_superposition(JessQuery *Q)
39
+ int count;
17
40
  Template *T;
18
41
  Atom **A;
19
-
42
+ -
20
43
  - if(Q->super) return Q->super;
21
44
  + Superposition* super;
22
- + // if(Q->super) return Q->super;
23
45
 
24
46
  A = Q->atoms;
25
47
  T = Q->node->template;
@@ -0,0 +1,54 @@
1
+ diff --git a/src/Molecule.c b/src/Molecule.c
2
+ index d6c327e..7a293ff 100644
3
+ --- a/src/Molecule.c
4
+ +++ b/src/Molecule.c
5
+ @@ -25,21 +25,6 @@ struct _Node
6
+ Atom *atom;
7
+ };
8
+
9
+ -// ==================================================================
10
+ -// type Molecule
11
+ -// ==================================================================
12
+ -// count Number of atoms in the molecule
13
+ -// id The molecule PDB code (if found)
14
+ -// atom[k] Pointer to kth atom in the molecule
15
+ -// ==================================================================
16
+ -
17
+ -struct _Molecule
18
+ -{
19
+ - int count;
20
+ - char id[5];
21
+ - Atom *atom[0];
22
+ -};
23
+ -
24
+ // ==================================================================
25
+ // Methods of type Molecule;
26
+ // ==================================================================
27
+ @@ -113,6 +98,7 @@ Molecule *Molecule_create(FILE *file, int ignore_endmdl, float conservation_cuto
28
+ // Create the molecule...
29
+
30
+ M = (Molecule*)calloc(1,sizeof(Molecule)+count*sizeof(Atom*));
31
+ + M->index = NULL;
32
+ M->count=count;
33
+ strcpy(M->id,pdb);
34
+
35
+ @@ -127,6 +113,10 @@ Molecule *Molecule_create(FILE *file, int ignore_endmdl, float conservation_cuto
36
+ head=N;
37
+ }
38
+
39
+ + // Create an index to access atoms by residue name
40
+ +
41
+ + M->index = ResIndex_create(M->atom, M->count);
42
+ +
43
+ // Check memory leaks??
44
+
45
+ return M;
46
+ @@ -138,6 +128,8 @@ void Molecule_free(Molecule *M)
47
+
48
+ if(M)
49
+ {
50
+ + if(M->index) ResIndex_free(M->index);
51
+ +
52
+ for(k=0; k<M->count; k++)
53
+ {
54
+ if(M->atom[k]) free(M->atom[k]);
@@ -0,0 +1,35 @@
1
+ diff --git a/src/Molecule.h b/src/Molecule.h
2
+ index d838488..c44bf6f 100644
3
+ --- a/src/Molecule.h
4
+ +++ b/src/Molecule.h
5
+ @@ -8,15 +8,27 @@
6
+ #ifndef MOLECULE_H
7
+ #define MOLECULE_H
8
+
9
+ -#include "Atom.h"
10
+ #include <stdio.h>
11
+
12
+ +#include "Atom.h"
13
+ +#include "ResIndex.h"
14
+ +
15
+ // ==================================================================
16
+ -// Forward declarations
17
+ +// type Molecule
18
+ // ==================================================================
19
+ -// Molecule A complete molecule
20
+ +// count Number of atoms in the molecule
21
+ +// id The molecule PDB code (if found)
22
+ +// atom[k] Pointer to kth atom in the molecule
23
+ // ==================================================================
24
+
25
+ +struct _Molecule
26
+ +{
27
+ + int count;
28
+ + char id[5];
29
+ + ResIndex *index;
30
+ + Atom *atom[0];
31
+ +};
32
+ +
33
+ typedef struct _Molecule Molecule;
34
+
35
+ // ==================================================================
@@ -0,0 +1,181 @@
1
+ diff --git a/src/ResIndex.c b/src/ResIndex.c
2
+ new file mode 100644
3
+ index 0000000..e88790e
4
+ --- /dev/null
5
+ +++ b/src/ResIndex.c
6
+ @@ -0,0 +1,175 @@
7
+ +// ==================================================================
8
+ +// HashMap.h
9
+ +// Copyright (c) Martin Larralde, 2025
10
+ +// ==================================================================
11
+ +// Implementation of type ResIndex.
12
+ +// ==================================================================
13
+ +
14
+ +#include <assert.h>
15
+ +#include <stddef.h>
16
+ +#include <stdlib.h>
17
+ +#include <string.h>
18
+ +#include <stdio.h>
19
+ +
20
+ +#include "Atom.h"
21
+ +#include "ResIndex.h"
22
+ +
23
+ +#ifdef _MSC_VER
24
+ +#define strncasecmp _strnicmp
25
+ +#define strcasecmp _stricmp
26
+ +#endif
27
+ +
28
+ +static int ResNames_compare(const void *pa, const void *pb)
29
+ +{
30
+ + const Atom *a = **((const Atom***)pa);
31
+ + const Atom *b = **((const Atom***)pb);
32
+ + int result = strncasecmp(&a->resName[0], &b->resName[0], 4);
33
+ + if (result != 0)
34
+ + return result;
35
+ + return a->serial - b->serial;
36
+ +}
37
+ +
38
+ +extern ResIndex* ResIndex_create(Atom** atoms, int n)
39
+ +{
40
+ + int i;
41
+ + int j;
42
+ + int k;
43
+ + int numRes;
44
+ + Atom*** tmp;
45
+ + ResIndex* I;
46
+ +
47
+ + // Allocate struct
48
+ +
49
+ + I = calloc(1, sizeof(ResIndex));
50
+ + if(!I) {
51
+ + return NULL;
52
+ + }
53
+ +
54
+ + // Initialize fields
55
+ + I->n = 0;
56
+ + I->names = NULL;
57
+ + I->offset = NULL;
58
+ + I->atoms = NULL;
59
+ +
60
+ + // Handle empty case
61
+ + if(n==0) {
62
+ + I->offset = calloc(2, sizeof(size_t));
63
+ + I->atoms = (Atom**) calloc(1, sizeof(Atom*));
64
+ + I->offset[0] = I->offset[1] = 0;
65
+ + I->atoms[0] = NULL;
66
+ + return I;
67
+ + }
68
+ +
69
+ + // Allocate auxilliary data to sort names
70
+ +
71
+ + tmp = (Atom***) calloc(n, sizeof(Atom**));
72
+ + if(!tmp) {
73
+ + ResIndex_free(I);
74
+ + return NULL;
75
+ + }
76
+ +
77
+ + // Sort residue names found in molecule
78
+ +
79
+ + for (i = 0; i < n; i++) tmp[i] = (Atom**) &atoms[i];
80
+ + qsort(tmp,n, sizeof(Atom**),ResNames_compare);
81
+ +
82
+ + // Count number of distinct residue names in molecule
83
+ +
84
+ + numRes = 1;
85
+ + for (i = 1; i < n; i++)
86
+ + numRes += (strncasecmp((*tmp[i-1])->resName, (*tmp[i])->resName, 4) != 0);
87
+ +
88
+ + // Allocate data for residues
89
+ +
90
+ + I->names = (char*) calloc(numRes, 4*sizeof(char));
91
+ + I->offset = (size_t*) calloc(numRes+1, sizeof(size_t));
92
+ + I->atoms = (Atom**) calloc(n + numRes, sizeof(Atom*));
93
+ + if ((I->names == NULL) || (I->atoms == NULL) || (I->offset == NULL)) {
94
+ + free(tmp);
95
+ + ResIndex_free(I);
96
+ + return NULL;
97
+ + }
98
+ +
99
+ + // Record data in index
100
+ +
101
+ + memcpy(&I->names[0], (*tmp[0])->resName, 4*sizeof(char));
102
+ + I->n = numRes;
103
+ + I->offset[0] = 0;
104
+ + I->atoms[0] = *tmp[0];
105
+ +
106
+ + char* names = &I->names[4];
107
+ + size_t* offset = &I->offset[1];
108
+ +
109
+ + for (i = 1, j = 4, k = 1; i < n; i++) {
110
+ +
111
+ + if (strncasecmp((*tmp[i-1])->resName, (*tmp[i])->resName, 4) != 0) {
112
+ + memcpy(names, (*tmp[i])->resName, 4*sizeof(char));
113
+ + names += 4;
114
+ +
115
+ + I->atoms[k] = NULL;
116
+ + k += 1;
117
+ +
118
+ + (*offset) = k;
119
+ + offset++;
120
+ + }
121
+ +
122
+ + I->atoms[k] = *tmp[i];
123
+ + k += 1;
124
+ + }
125
+ +
126
+ + (*offset) = k;
127
+ +
128
+ + free(tmp);
129
+ +
130
+ + return I;
131
+ +}
132
+ +
133
+ +extern int ResIndex_find(ResIndex* I, const char resName[4]) {
134
+ + //NB: As the names have been sorted with `qsort`, we can use a binary search
135
+ +
136
+ + int cmp;
137
+ + size_t mid;
138
+ + size_t start = 0;
139
+ + size_t end = I->n;
140
+ + size_t n = 0;
141
+ +
142
+ + while (start < end) {
143
+ + mid = (start + end) / 2;
144
+ + cmp = strncasecmp(&I->names[4*mid], resName, 4);
145
+ + if(cmp < 0) {
146
+ + start = (mid == start) ? mid + 1 : mid;
147
+ + } else if (cmp > 0) {
148
+ + end = (mid == end) ? mid - 1 : mid;
149
+ + } else {
150
+ + return mid;
151
+ + }
152
+ +
153
+ + n++;
154
+ + assert(n < I->n);
155
+ + }
156
+ +
157
+ + return -1;
158
+ +}
159
+ +
160
+ +extern Atom** ResIndex_get(ResIndex* I, const char resName[4])
161
+ +{
162
+ + int i = ResIndex_find(I, resName);
163
+ + return ResIndex_values(I, i);
164
+ +}
165
+ +
166
+ +extern Atom** ResIndex_values(ResIndex* I, int i)
167
+ +{
168
+ + if(i > I->n)
169
+ + return &I->atoms[I->offset[1] - 1];
170
+ + return &I->atoms[I->offset[i]];
171
+ +}
172
+ +
173
+ +extern void ResIndex_free(ResIndex* I)
174
+ +{
175
+ + if(I) {
176
+ + if (I->names) free(I->names);
177
+ + if (I->atoms) free(I->atoms);
178
+ + if (I->offset) free(I->offset);
179
+ + free(I);
180
+ + }
181
+ +}