pyjess 0.4.0__cp39-cp39-macosx_11_0_arm64.whl → 0.4.1__cp39-cp39-macosx_11_0_arm64.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.

Binary file
pyjess/_jess.pyi CHANGED
@@ -134,9 +134,9 @@ class TemplateAtom:
134
134
  @property
135
135
  def z(self) -> float: ...
136
136
  @property
137
- def atom_names(self) -> List[str]: ...
137
+ def atom_names(self) -> Tuple[str, ...]: ...
138
138
  @property
139
- def residue_names(self) -> List[str]: ...
139
+ def residue_names(self) -> Tuple[str, ...]: ...
140
140
  @property
141
141
  def distance_weight(self) -> float: ...
142
142
  def copy(self: _SELF) -> _SELF: ...
pyjess/_jess.pyx CHANGED
@@ -828,7 +828,11 @@ cdef class TemplateAtom:
828
828
 
829
829
  @property
830
830
  def atom_names(self):
831
- """`list` of `str`: The different atom names for this atom.
831
+ """`tuple` of `str`: The different atom names for this atom.
832
+
833
+ .. versionchanged:: 0.4.1
834
+ Property now returns a `tuple` rather than a `list`.
835
+
832
836
  """
833
837
  assert self._atom is not NULL
834
838
 
@@ -837,11 +841,15 @@ cdef class TemplateAtom:
837
841
 
838
842
  for i in range(self._atom.nameCount):
839
843
  l.append(self._atom.name[i].replace(b'_', b'').decode())
840
- return l
844
+ return tuple(l)
841
845
 
842
846
  @property
843
847
  def residue_names(self):
844
- """`list` of `str`: The different residue names for this atom.
848
+ """`tuple` of `str`: The different residue names for this atom.
849
+
850
+ .. versionchanged:: 0.4.1
851
+ Property now returns a `tuple` rather than a `list`.
852
+
845
853
  """
846
854
  assert self._atom is not NULL
847
855
 
@@ -850,7 +858,7 @@ cdef class TemplateAtom:
850
858
 
851
859
  for i in range(self._atom.resNameCount):
852
860
  l.append(self._atom.resName[i].replace(b'_', b'').decode())
853
- return l
861
+ return tuple(l)
854
862
 
855
863
  @property
856
864
  def distance_weight(self):
@@ -1037,10 +1045,10 @@ cdef class Template:
1037
1045
  return all(x == y for x,y in zip(self, other_))
1038
1046
 
1039
1047
  def __hash__(self):
1040
- return hash(
1048
+ return hash((
1041
1049
  self.id,
1042
1050
  *(hash(x) for x in self)
1043
- )
1051
+ ))
1044
1052
 
1045
1053
  def __reduce__(self):
1046
1054
  return type(self), (list(self), self.id)
@@ -1351,7 +1359,7 @@ cdef class Jess:
1351
1359
  """
1352
1360
  cdef _Jess* _jess
1353
1361
  cdef dict _indices
1354
- cdef list _templates
1362
+ cdef tuple _templates
1355
1363
  cdef size_t length
1356
1364
 
1357
1365
  def __cinit__(self):
@@ -1379,10 +1387,10 @@ cdef class Jess:
1379
1387
  """
1380
1388
  cdef Template template
1381
1389
  cdef _Template* tpl
1390
+ cdef list _templates = []
1382
1391
 
1383
1392
  self._jess = jess.jess.Jess_create()
1384
1393
  self._indices = {}
1385
- self._templates = []
1386
1394
 
1387
1395
  for template in templates:
1388
1396
  # NOTE: the Jess storage owns the data, so we make a copy of the
@@ -1390,9 +1398,11 @@ cdef class Jess:
1390
1398
  tpl = template._tpl.copy(template._tpl)
1391
1399
  jess.jess.Jess_addTemplate(self._jess, tpl)
1392
1400
  self._indices[<size_t> tpl] = self.length
1393
- self._templates.append(template)
1401
+ _templates.append(template)
1394
1402
  self.length += 1
1395
1403
 
1404
+ self._templates = tuple(_templates)
1405
+
1396
1406
  def __copy__(self):
1397
1407
  return self.copy()
1398
1408
 
@@ -1407,7 +1417,7 @@ cdef class Jess:
1407
1417
  return self._templates == other_._templates
1408
1418
 
1409
1419
  def __hash__(self):
1410
- return hash(tuple(hash(t) for t in self._templates))
1420
+ return hash((Jess, self._templates))
1411
1421
 
1412
1422
  def __len__(self):
1413
1423
  return self.length
pyjess/tests/test_atom.py CHANGED
@@ -59,9 +59,18 @@ class TestAtom(unittest.TestCase):
59
59
  def test_hash(self):
60
60
  a1 = self._create_atom()
61
61
  a2 = self._create_atom()
62
- self.assertEqual(a1, a2)
63
62
  self.assertEqual(hash(a1), hash(a2))
64
63
  self.assertIsNot(a1, a2)
64
+ a3 = self._create_atom(x=1.0)
65
+ self.assertNotEqual(hash(a1), hash(a3))
66
+
67
+ def test_eq(self):
68
+ a1 = self._create_atom()
69
+ a2 = self._create_atom()
70
+ self.assertEqual(a1, a2)
71
+ self.assertIsNot(a1, a2)
72
+ a3 = self._create_atom(x=1.0)
73
+ self.assertNotEqual(a1, a3)
65
74
 
66
75
  def test_repr_roundtrip(self):
67
76
  atom = self._create_atom()
pyjess/tests/test_jess.py CHANGED
@@ -21,6 +21,13 @@ class TestJess(unittest.TestCase):
21
21
  hits = jess.query(mol, 2, 2, 4)
22
22
  self.assertRaises(StopIteration, next, hits)
23
23
 
24
+ def test_hash_empty(self):
25
+ j1 = Jess()
26
+ j2 = Jess()
27
+ self.assertEqual(j1, j2)
28
+ self.assertEqual(hash(j1), hash(j2))
29
+ self.assertIsNot(j1, j2)
30
+
24
31
  @unittest.skipUnless(files, "importlib.resources not available")
25
32
  def test_copy(self):
26
33
  with files(data).joinpath("template_01.qry").open() as f:
@@ -31,6 +38,32 @@ class TestJess(unittest.TestCase):
31
38
  copy = jess.copy()
32
39
  self.assertEqual(jess, copy)
33
40
 
41
+ @unittest.skipUnless(files, "importlib.resources not available")
42
+ def test_hash(self):
43
+ with files(data).joinpath("template_01.qry").open() as f:
44
+ template1 = Template.load(f)
45
+ with files(data).joinpath("template_02.qry").open() as f:
46
+ template2 = Template.load(f)
47
+ j1 = Jess([template1, template2])
48
+ j2 = Jess([template1, template2])
49
+ self.assertEqual(hash(j1), hash(j2))
50
+ self.assertIsNot(j1, j2)
51
+ j3 = Jess([template1])
52
+ self.assertNotEqual(hash(j1), hash(j3))
53
+
54
+ @unittest.skipUnless(files, "importlib.resources not available")
55
+ def test_eq(self):
56
+ with files(data).joinpath("template_01.qry").open() as f:
57
+ template1 = Template.load(f)
58
+ with files(data).joinpath("template_02.qry").open() as f:
59
+ template2 = Template.load(f)
60
+ j1 = Jess([template1, template2])
61
+ j2 = Jess([template1, template2])
62
+ self.assertEqual(j1, j2)
63
+ self.assertIsNot(j1, j2)
64
+ j3 = Jess([template1])
65
+ self.assertNotEqual(j1, j3)
66
+
34
67
  @unittest.skipUnless(files, "importlib.resources not available")
35
68
  def test_pickle_roundtrip(self):
36
69
  with files(data).joinpath("template_01.qry").open() as f:
@@ -96,7 +96,23 @@ class TestMolecule(unittest.TestCase):
96
96
  mol1 = Molecule(atoms)
97
97
  mol2 = Molecule(atoms)
98
98
  self.assertEqual(hash(mol1), hash(mol2))
99
+ self.assertIsNot(mol1, mol2)
100
+ mol3 = Molecule(atoms[:-1])
101
+ self.assertNotEqual(hash(mol1), hash(mol3))
102
+
103
+ def test_eq(self):
104
+ atoms = [
105
+ self._create_atom(serial=1, name='N'),
106
+ self._create_atom(serial=2, name='CA'),
107
+ self._create_atom(serial=3, name='C'),
108
+ self._create_atom(serial=4, name='O'),
109
+ ]
110
+ mol1 = Molecule(atoms)
111
+ mol2 = Molecule(atoms)
99
112
  self.assertEqual(mol1, mol2)
113
+ self.assertIsNot(mol1, mol2)
114
+ mol3 = Molecule(atoms[:-1])
115
+ self.assertNotEqual(mol1, mol3)
100
116
 
101
117
  def test_copy(self):
102
118
  atoms = [
@@ -30,9 +30,9 @@ class TestTemplate(unittest.TestCase):
30
30
  template = Template.loads(TEMPLATE)
31
31
  self.assertEqual(len(template), 11)
32
32
  self.assertEqual(template.dimension, 5)
33
- self.assertEqual(template[0].residue_names, ["LYS"])
34
- self.assertEqual(template[0].atom_names, ["NZ"])
35
- self.assertEqual(template[1].atom_names, ["CG"])
33
+ self.assertEqual(template[0].residue_names, ("LYS",))
34
+ self.assertEqual(template[0].atom_names, ("NZ",))
35
+ self.assertEqual(template[1].atom_names, ("CG",))
36
36
  self.assertEqual(template[2].residue_number, 1132)
37
37
  self.assertEqual(template[-1].residue_number, 1150)
38
38
 
@@ -42,9 +42,9 @@ class TestTemplate(unittest.TestCase):
42
42
  f.write(TEMPLATE)
43
43
  f.flush()
44
44
  template = Template.load(f.name)
45
- self.assertEqual(template[0].residue_names, ["LYS"])
46
- self.assertEqual(template[0].atom_names, ["NZ"])
47
- self.assertEqual(template[1].atom_names, ["CG"])
45
+ self.assertEqual(template[0].residue_names, ("LYS",))
46
+ self.assertEqual(template[0].atom_names, ("NZ",))
47
+ self.assertEqual(template[1].atom_names, ("CG",))
48
48
  self.assertEqual(template[2].residue_number, 1132)
49
49
  self.assertEqual(template[-1].residue_number, 1150)
50
50
 
@@ -55,9 +55,9 @@ class TestTemplate(unittest.TestCase):
55
55
  f.flush()
56
56
  f.seek(0)
57
57
  template = Template.load(f)
58
- self.assertEqual(template[0].residue_names, ["LYS"])
59
- self.assertEqual(template[0].atom_names, ["NZ"])
60
- self.assertEqual(template[1].atom_names, ["CG"])
58
+ self.assertEqual(template[0].residue_names, ("LYS",))
59
+ self.assertEqual(template[0].atom_names, ("NZ",))
60
+ self.assertEqual(template[1].atom_names, ("CG",))
61
61
  self.assertEqual(template[2].residue_number, 1132)
62
62
  self.assertEqual(template[-1].residue_number, 1150)
63
63
 
@@ -87,6 +87,23 @@ class TestTemplate(unittest.TestCase):
87
87
  tpl2 = tpl1[1:4]
88
88
  self.assertEqual(len(tpl2), 3)
89
89
 
90
+ def test_hash(self):
91
+ tpl1 = Template.loads(TEMPLATE, id="tpl1")
92
+ tpl2 = Template.loads(TEMPLATE, id="tpl1")
93
+ self.assertEqual(tpl1, tpl2)
94
+ self.assertEqual(hash(tpl1), hash(tpl2))
95
+ self.assertIsNot(tpl1, tpl2)
96
+ tpl3 = Template.loads(TEMPLATE, id="tpl3")
97
+ self.assertNotEqual(hash(tpl1), hash(tpl3))
98
+
99
+ def test_eq(self):
100
+ tpl1 = Template.loads(TEMPLATE, id="tpl1")
101
+ tpl2 = Template.loads(TEMPLATE, id="tpl1")
102
+ self.assertEqual(tpl1, tpl2)
103
+ self.assertIsNot(tpl1, tpl2)
104
+ tpl3 = Template.loads(TEMPLATE, id="tpl3")
105
+ self.assertNotEqual(tpl1, tpl3)
106
+
90
107
  def test_copy(self):
91
108
  tpl1 = Template.loads(TEMPLATE, id="tpl1")
92
109
  tpl2 = tpl1.copy()
@@ -10,8 +10,8 @@ class TestTemplateAtom(unittest.TestCase):
10
10
  def test_load(self):
11
11
  atom = TemplateAtom.loads("ATOM 1 NE ARG A1136 3.953 0.597 -1.721 K")
12
12
  self.assertEqual(atom.match_mode, 1)
13
- self.assertEqual(atom.atom_names, ["NE"])
14
- self.assertEqual(atom.residue_names, ["ARG", "LYS"])
13
+ self.assertEqual(atom.atom_names, ("NE",))
14
+ self.assertEqual(atom.residue_names, ("ARG", "LYS",))
15
15
  self.assertEqual(atom.chain_id, "A")
16
16
  self.assertEqual(atom.residue_number, 1136)
17
17
  self.assertEqual(atom.x, 3.953)
@@ -32,6 +32,22 @@ class TestTemplateAtom(unittest.TestCase):
32
32
  default.update(kwargs)
33
33
  return TemplateAtom(**default)
34
34
 
35
+ def test_hash(self):
36
+ a1 = self._create_atom()
37
+ a2 = self._create_atom()
38
+ self.assertEqual(hash(a1), hash(a2))
39
+ self.assertIsNot(a1, a2)
40
+ a3 = self._create_atom(x=1.0)
41
+ self.assertNotEqual(hash(a1), hash(a3))
42
+
43
+ def test_eq(self):
44
+ a1 = self._create_atom()
45
+ a2 = self._create_atom()
46
+ self.assertEqual(a1, a2)
47
+ self.assertIsNot(a1, a2)
48
+ a3 = self._create_atom(x=1.0)
49
+ self.assertNotEqual(a1, a3)
50
+
35
51
  @unittest.skipUnless(sys.implementation.name == "cpython", "only available on CPython")
36
52
  def test_sizeof(self):
37
53
  atom = self._create_atom()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyjess
3
- Version: 0.4.0
3
+ Version: 0.4.1
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>
@@ -1,21 +1,21 @@
1
- pyjess-0.4.0.dist-info/RECORD,,
2
- pyjess-0.4.0.dist-info/WHEEL,sha256=Qmm8uWPQTspuPJ9tUBLJdmqmcf0_LWu4zzBSlc_SSWo,112
3
- pyjess-0.4.0.dist-info/METADATA,sha256=vaDoU5JzpxXjRTl-M43Stw7evHX75QHWTexO_TF7_DE,10785
4
- pyjess-0.4.0.dist-info/licenses/COPYING,sha256=W3hXwpT6UtiSFrO8yeDddZLU5tKIAX238e0N5slPQGA,1098
5
- pyjess/_jess.pyi,sha256=MlI0vWppDF11o9iZs635jn7gUpebG9DF_KNvhZrymuI,6887
1
+ pyjess-0.4.1.dist-info/RECORD,,
2
+ pyjess-0.4.1.dist-info/WHEEL,sha256=Qmm8uWPQTspuPJ9tUBLJdmqmcf0_LWu4zzBSlc_SSWo,112
3
+ pyjess-0.4.1.dist-info/METADATA,sha256=iHTTiJz29i7uRreAEeB_ow4-DArxSGb5Nz2Y9N4RblQ,10785
4
+ pyjess-0.4.1.dist-info/licenses/COPYING,sha256=W3hXwpT6UtiSFrO8yeDddZLU5tKIAX238e0N5slPQGA,1098
5
+ pyjess/_jess.pyi,sha256=QIQSeQgNG-w0QZTuvacHjnv3IlEfV-3AOll9To3ZdM4,6899
6
6
  pyjess/CMakeLists.txt,sha256=Oa0pniEQx9jXyFCJGyrswn9ahWSSVuW1madyeP6StoI,35
7
- pyjess/_jess.cpython-39-darwin.so,sha256=OF443Eu3wnHjuxNGkqrEgw3T3CErmMvXnSssETEj7c8,315992
7
+ pyjess/_jess.cpython-39-darwin.so,sha256=0wpZ92UkgfR5qvgndf8VpBI1DlpNBoLXYocxB6vzeME,315912
8
8
  pyjess/__init__.py,sha256=h4XXLdS4FnyVa-MBs_k3eZMG1jWxeiOJnwfBaJA9gyQ,745
9
9
  pyjess/.gitignore,sha256=uQBOufp4v50qn0aZKv6zbSo00cjfB-v9KySog7rlmIU,19
10
- pyjess/_jess.pyx,sha256=JFFC_PrVMAjaoLeLsyfkC9kFKdDCCNSwt7yvgQ6mnVo,47039
10
+ pyjess/_jess.pyx,sha256=E7D4tvgjnGo9q-YdWGdO-r472NdJanUEs8hYbB6rBaM,47303
11
11
  pyjess/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  pyjess/tests/__init__.py,sha256=MdHWtr6A8S4TBWlkoj4olFK2FXAGc5uJdbWtgFrDLpk,528
13
- pyjess/tests/test_molecule.py,sha256=qltjlOKvc2mvrW1DhA20AdKpu2DCEELx-cfbNmldvdo,4754
13
+ pyjess/tests/test_molecule.py,sha256=RHBE0yL_j71nQOwXJ6t_PzkZi4BaFPY5Q0VwKWM6elk,5311
14
14
  pyjess/tests/utils.py,sha256=dsaphex7qomJCvSHWnVy79iYDPGiL59xqGAtRoVAeWc,196
15
- pyjess/tests/test_atom.py,sha256=wkl45ctTU-7kWnGCjr1hHNEQBRRynzYyNoq-zPXR2V0,4348
16
- pyjess/tests/test_jess.py,sha256=yAQEbqodzKhjzYd2nxx1_H6b4AbJjbYHHjqFnrHkSUM,8500
17
- pyjess/tests/test_template.py,sha256=kUDJ-A9eNsL8aE51Jr1HLKmvKflTUuMGT2D3vKUxp-o,3887
18
- pyjess/tests/test_template_atom.py,sha256=fO6ChincKARc86J2zpDc0xrybSb4CQnyzoo2kJCAkoU,2917
15
+ pyjess/tests/test_atom.py,sha256=omNznNbRXMDt2j1plAUlfWPGCfmtkYpj2jysEX1zQuY,4631
16
+ pyjess/tests/test_jess.py,sha256=mgHx6kDW5yzdvZiiybAVrd1J4k3Li3r-t4le6RFEE5o,9757
17
+ pyjess/tests/test_template.py,sha256=XMLELYRB4j7xavziZ-ntq15PjhNHNfJJkctUq9BkvEI,4541
18
+ pyjess/tests/test_template_atom.py,sha256=s9tJ_SAgvKeGwbVjaTWY-EtsUeQp3eu4NF5ja3oO_84,3405
19
19
  pyjess/tests/data/pdb1lnb.pdb,sha256=E9Jjy4qQ75O1UKIXcVyVJHE1XDNx1Rb7ENPVrehW6N8,270054
20
20
  pyjess/tests/data/1AMY.pdb,sha256=t2CaGLdOyPrhyeMpe1TbwZ8u7QmfxCIG1Pit8-vzvgo,319221
21
21
  pyjess/tests/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
File without changes