equilibrator-cache 0.7.0b2__tar.gz → 0.7.1__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.
- {equilibrator_cache-0.7.0b2/src/equilibrator_cache.egg-info → equilibrator_cache-0.7.1}/PKG-INFO +6 -11
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/pyproject.toml +10 -21
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/api.py +0 -1
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/compatibility.py +3 -7
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/compound_cache.py +20 -17
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/exceptions.py +0 -1
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/models/compound.py +4 -6
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/models/compound_identifier.py +0 -1
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/models/compound_microspecies.py +0 -1
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/models/magnesium_dissociation_constant.py +0 -1
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/models/mixins.py +0 -1
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/models/registry.py +0 -1
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/reaction.py +10 -14
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/zenodo.py +1 -3
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1/src/equilibrator_cache.egg-info}/PKG-INFO +6 -11
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache.egg-info/requires.txt +5 -10
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/LICENSE +0 -0
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/MANIFEST.in +0 -0
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/README.md +0 -0
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/setup.cfg +0 -0
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/__init__.py +0 -0
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/models/__init__.py +0 -0
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/thermodynamic_constants.py +0 -0
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache.egg-info/SOURCES.txt +0 -0
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache.egg-info/dependency_links.txt +0 -0
- {equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache.egg-info/top_level.txt +0 -0
{equilibrator_cache-0.7.0b2/src/equilibrator_cache.egg-info → equilibrator_cache-0.7.1}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: equilibrator-cache
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Summary: Cache application for compounds, reactions, and enzymes
|
|
5
5
|
Author: Elad Noor, Moritz E. Beber
|
|
6
6
|
License-Expression: MIT
|
|
@@ -22,14 +22,12 @@ Requires-Python: >=3.11
|
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
24
|
Requires-Dist: numpy>=2.0
|
|
25
|
-
Requires-Dist: scipy>=1.
|
|
26
|
-
Requires-Dist: pandas>=2.
|
|
27
|
-
Requires-Dist: pyarrow>=23.0
|
|
25
|
+
Requires-Dist: scipy>=1.13
|
|
26
|
+
Requires-Dist: pandas>=2.0
|
|
28
27
|
Requires-Dist: sqlalchemy~=2.0
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist: pint~=0.24
|
|
28
|
+
Requires-Dist: rapidfuzz>=3.9
|
|
29
|
+
Requires-Dist: pint[uncertainties]~=0.24
|
|
31
30
|
Requires-Dist: tqdm~=4.0
|
|
32
|
-
Requires-Dist: appdirs~=1.4
|
|
33
31
|
Requires-Dist: pooch~=1.8
|
|
34
32
|
Provides-Extra: test
|
|
35
33
|
Requires-Dist: pytest; extra == "test"
|
|
@@ -38,10 +36,7 @@ Requires-Dist: pytest-raises; extra == "test"
|
|
|
38
36
|
Requires-Dist: pytest-mock; extra == "test"
|
|
39
37
|
Requires-Dist: hypothesis; extra == "test"
|
|
40
38
|
Provides-Extra: development
|
|
41
|
-
Requires-Dist:
|
|
42
|
-
Requires-Dist: isort; extra == "development"
|
|
43
|
-
Requires-Dist: flake8; extra == "development"
|
|
44
|
-
Requires-Dist: safety; extra == "development"
|
|
39
|
+
Requires-Dist: pip-audit; extra == "development"
|
|
45
40
|
Requires-Dist: tox; extra == "development"
|
|
46
41
|
Requires-Dist: twine; extra == "development"
|
|
47
42
|
Provides-Extra: deployment
|
|
@@ -28,14 +28,12 @@ dynamic = ["version"]
|
|
|
28
28
|
requires-python = ">=3.11"
|
|
29
29
|
dependencies = [
|
|
30
30
|
"numpy >=2.0",
|
|
31
|
-
"scipy >=1.
|
|
32
|
-
"pandas >=2.
|
|
33
|
-
"pyarrow >=23.0",
|
|
31
|
+
"scipy >=1.13",
|
|
32
|
+
"pandas >=2.0", # cobra 0.31.1 requires pandas<3.0,>=1.0 so we have to keep it loose enough
|
|
34
33
|
"sqlalchemy ~=2.0",
|
|
35
|
-
"
|
|
36
|
-
"pint ~=0.24",
|
|
34
|
+
"rapidfuzz >=3.9",
|
|
35
|
+
"pint[uncertainties] ~=0.24",
|
|
37
36
|
"tqdm ~=4.0",
|
|
38
|
-
"appdirs ~=1.4",
|
|
39
37
|
"pooch ~=1.8",
|
|
40
38
|
]
|
|
41
39
|
|
|
@@ -48,10 +46,7 @@ test = [
|
|
|
48
46
|
"hypothesis"
|
|
49
47
|
]
|
|
50
48
|
development = [
|
|
51
|
-
"
|
|
52
|
-
"isort",
|
|
53
|
-
"flake8",
|
|
54
|
-
"safety",
|
|
49
|
+
"pip-audit",
|
|
55
50
|
"tox",
|
|
56
51
|
"twine"
|
|
57
52
|
]
|
|
@@ -76,19 +71,13 @@ universal = true
|
|
|
76
71
|
[tool.setuptools-git-versioning]
|
|
77
72
|
enabled = true
|
|
78
73
|
|
|
79
|
-
[tool.isort]
|
|
80
|
-
profile = "black"
|
|
81
|
-
|
|
82
|
-
[tool.black]
|
|
83
|
-
target-version = ["py314"]
|
|
84
|
-
exclude = '''
|
|
85
|
-
(
|
|
86
|
-
__init__.py
|
|
87
|
-
)
|
|
88
|
-
'''
|
|
89
|
-
|
|
90
74
|
[tool.ruff]
|
|
91
75
|
target-version = "py314"
|
|
92
76
|
|
|
93
77
|
[tool.ruff.lint]
|
|
94
78
|
ignore = ["F401"]
|
|
79
|
+
|
|
80
|
+
[tool.ruff.lint.per-file-ignores]
|
|
81
|
+
"__init__.py" = ["E402"]
|
|
82
|
+
"**/compatibility.py" = ["F821"]
|
|
83
|
+
"**/models/compound.py" = ["F821"]
|
{equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/compatibility.py
RENAMED
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
25
|
# THE SOFTWARE.
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
import logging
|
|
29
28
|
import sys
|
|
30
29
|
from typing import Dict, List, Tuple
|
|
@@ -82,8 +81,7 @@ def map_metabolites_to_compounds(
|
|
|
82
81
|
inchi_key_namespace: str,
|
|
83
82
|
inchi_namespace: str,
|
|
84
83
|
) -> Dict[str, Compound]:
|
|
85
|
-
"""
|
|
86
|
-
Map COBRA metabolites to compounds from the cache.
|
|
84
|
+
"""Map COBRA metabolites to compounds from the cache.
|
|
87
85
|
|
|
88
86
|
Parameters
|
|
89
87
|
----------
|
|
@@ -101,9 +99,7 @@ def map_metabolites_to_compounds(
|
|
|
101
99
|
-------
|
|
102
100
|
dict
|
|
103
101
|
A map from COBRA metabolite identifiers to compounds in the cache.
|
|
104
|
-
|
|
105
102
|
"""
|
|
106
|
-
|
|
107
103
|
mapping = {}
|
|
108
104
|
for ns, pairs in tqdm(
|
|
109
105
|
grouping.items(), total=len(grouping), desc="Searching Namespace"
|
|
@@ -112,7 +108,7 @@ def map_metabolites_to_compounds(
|
|
|
112
108
|
# Create a reverse map from relevant compound identifiers in the
|
|
113
109
|
# current namespace to the compound instances.
|
|
114
110
|
tqdm.write(
|
|
115
|
-
f"Querying cache for {len(identifiers)} compounds in
|
|
111
|
+
f"Querying cache for {len(identifiers)} compounds in '{ns}' namespace.",
|
|
116
112
|
file=sys.stderr,
|
|
117
113
|
)
|
|
118
114
|
if ns == inchi_key_namespace:
|
|
@@ -193,7 +189,7 @@ def map_cobra_metabolites(
|
|
|
193
189
|
num_missing = len(metabolites) - sum(len(g) for g in grouping.values())
|
|
194
190
|
percent = num_missing / len(metabolites) * 100.0
|
|
195
191
|
logger.info(
|
|
196
|
-
"%d/%d (%.2f%%) metabolites had no annotations within relevant
|
|
192
|
+
"%d/%d (%.2f%%) metabolites had no annotations within relevant namespaces.",
|
|
197
193
|
num_missing,
|
|
198
194
|
len(metabolites),
|
|
199
195
|
percent,
|
{equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/compound_cache.py
RENAMED
|
@@ -25,14 +25,13 @@
|
|
|
25
25
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
26
|
# THE SOFTWARE.
|
|
27
27
|
|
|
28
|
-
|
|
29
28
|
import logging
|
|
30
|
-
from functools import partial
|
|
31
29
|
from typing import Iterable, List, Optional, Set, Tuple
|
|
32
30
|
|
|
33
31
|
import pandas as pd
|
|
34
32
|
import sqlalchemy
|
|
35
|
-
from
|
|
33
|
+
from rapidfuzz import fuzz
|
|
34
|
+
from rapidfuzz import process as fuzz_process
|
|
36
35
|
from sqlalchemy import exists
|
|
37
36
|
from sqlalchemy.orm import joinedload, sessionmaker
|
|
38
37
|
from sqlalchemy.orm.session import make_transient
|
|
@@ -81,6 +80,7 @@ class CompoundCache:
|
|
|
81
80
|
query.statement, query.session.bind, index_col="compound_id"
|
|
82
81
|
)
|
|
83
82
|
self._synonyms["accession"] = self._synonyms["accession"].str.lower()
|
|
83
|
+
self._synonyms["length"] = self._synonyms["accession"].str.len()
|
|
84
84
|
|
|
85
85
|
def close(self):
|
|
86
86
|
"""Close the database connection."""
|
|
@@ -94,34 +94,29 @@ class CompoundCache:
|
|
|
94
94
|
@property
|
|
95
95
|
def proton(self) -> Compound:
|
|
96
96
|
"""Return the H+ compound object."""
|
|
97
|
-
|
|
98
97
|
if self._protons is None:
|
|
99
98
|
self._protons = self.search_compound_by_inchi_key(PROTON_INCHI_KEY)
|
|
100
99
|
return self._protons[0]
|
|
101
100
|
|
|
102
101
|
def is_proton(self, cpd: Compound) -> bool:
|
|
103
102
|
"""Return True if this compound is H+."""
|
|
104
|
-
|
|
105
103
|
self.proton # this is used to initialize the _proton member
|
|
106
104
|
return cpd in self._protons
|
|
107
105
|
|
|
108
106
|
@property
|
|
109
107
|
def water(self) -> Compound:
|
|
110
108
|
"""Return the H2O compound object."""
|
|
111
|
-
|
|
112
109
|
if self._waters is None:
|
|
113
110
|
self._waters = self.search_compound_by_inchi_key(WATER_INCHI_KEY)
|
|
114
111
|
return self._waters[0]
|
|
115
112
|
|
|
116
113
|
def is_water(self, cpd: Compound) -> bool:
|
|
117
114
|
"""Return True if this compound is H2O."""
|
|
118
|
-
|
|
119
115
|
self.water # this is used to initialize the _water member
|
|
120
116
|
return cpd in self._waters
|
|
121
117
|
|
|
122
118
|
def all_compound_accessions(self, ascending: bool = True) -> List[str]:
|
|
123
119
|
"""Return a list of all compound accessions."""
|
|
124
|
-
|
|
125
120
|
return sorted(
|
|
126
121
|
(
|
|
127
122
|
row.accession
|
|
@@ -132,19 +127,16 @@ class CompoundCache:
|
|
|
132
127
|
|
|
133
128
|
def accession_exists(self, accession: str) -> bool:
|
|
134
129
|
"""Return True if this accession exists in the cache."""
|
|
135
|
-
|
|
136
130
|
return self.session.query(
|
|
137
131
|
exists().where(CompoundIdentifier.accession == accession)
|
|
138
132
|
).scalar()
|
|
139
133
|
|
|
140
134
|
def get_compound_by_internal_id(self, compound_id: int) -> Compound:
|
|
141
135
|
"""Find a compound in the cache based on the internal ID."""
|
|
142
|
-
|
|
143
136
|
return self.session.query(Compound).filter_by(id=compound_id).one_or_none()
|
|
144
137
|
|
|
145
138
|
def get_compound_by_inchi(self, inchi: str) -> Optional[Compound]:
|
|
146
139
|
"""Return a compound by exact match of the InChI."""
|
|
147
|
-
|
|
148
140
|
hits = (
|
|
149
141
|
self.session.query(Compound)
|
|
150
142
|
.filter_by(inchi=inchi)
|
|
@@ -179,7 +171,6 @@ class CompoundCache:
|
|
|
179
171
|
|
|
180
172
|
def get_compound(self, compound_id: str) -> Compound:
|
|
181
173
|
"""Find a compound object based on the compound ID."""
|
|
182
|
-
|
|
183
174
|
try:
|
|
184
175
|
namespace, accession = compound_id.split(":", 1)
|
|
185
176
|
except ValueError:
|
|
@@ -196,7 +187,6 @@ class CompoundCache:
|
|
|
196
187
|
|
|
197
188
|
def get_compound_from_registry(self, namespace: str, accession: str) -> Compound:
|
|
198
189
|
"""Find a compound object by its accession (and namespace)."""
|
|
199
|
-
|
|
200
190
|
if (namespace, accession) in self.compound_dict:
|
|
201
191
|
logging.debug(f"Cache hit for {accession} in {namespace} in RAM")
|
|
202
192
|
return self.compound_dict[(namespace, accession)]
|
|
@@ -241,7 +231,6 @@ class CompoundCache:
|
|
|
241
231
|
indexes are atomic elements.
|
|
242
232
|
|
|
243
233
|
"""
|
|
244
|
-
|
|
245
234
|
atom_bags = {compound: compound.atom_bag or {} for compound in compounds}
|
|
246
235
|
|
|
247
236
|
# create the elemental matrix, where each row is a compound and each
|
|
@@ -289,9 +278,24 @@ class CompoundCache:
|
|
|
289
278
|
A list of pairs of compounds and their scores from the
|
|
290
279
|
specified search result page.
|
|
291
280
|
"""
|
|
292
|
-
|
|
281
|
+
query_lower = query.lower()
|
|
282
|
+
query_len = len(query_lower)
|
|
283
|
+
# Pre-filter by length: ratio > 0.5 is impossible when the length ratio
|
|
284
|
+
# exceeds 3 (because max_ratio = 2*min_len/(min_len+max_len) <= 0.5).
|
|
285
|
+
length_mask = self._synonyms["length"].between(
|
|
286
|
+
max(1, -(-query_len // 3)), # ceil(query_len / 3)
|
|
287
|
+
query_len * 3,
|
|
288
|
+
)
|
|
289
|
+
candidates = self._synonyms[length_mask]
|
|
293
290
|
logger.debug("Scoring all synonyms with the query.")
|
|
294
|
-
scores
|
|
291
|
+
# Use rapidfuzz batch scorer with early-termination cutoff (scores in 0-100).
|
|
292
|
+
raw_scores = fuzz_process.cdist(
|
|
293
|
+
[query_lower],
|
|
294
|
+
candidates["accession"].tolist(),
|
|
295
|
+
scorer=fuzz.ratio,
|
|
296
|
+
score_cutoff=50,
|
|
297
|
+
)[0]
|
|
298
|
+
scores = pd.Series(raw_scores / 100.0, index=candidates.index)
|
|
295
299
|
# Only consider the highest score for each compound.
|
|
296
300
|
result = scores.groupby(scores.index, sort=False).max()
|
|
297
301
|
# Filter out low scores and sort in descending order.
|
|
@@ -334,7 +338,6 @@ class CompoundCache:
|
|
|
334
338
|
-------
|
|
335
339
|
List[Compound]
|
|
336
340
|
The list of retrieved compounds.
|
|
337
|
-
|
|
338
341
|
"""
|
|
339
342
|
query = (
|
|
340
343
|
self.session.query(Compound)
|
{equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/models/compound.py
RENAMED
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
25
|
# THE SOFTWARE.
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
import re
|
|
29
28
|
from functools import reduce
|
|
30
29
|
from typing import Iterable, List, Optional, Union
|
|
@@ -167,8 +166,10 @@ class Compound(TimeStampMixin, Base):
|
|
|
167
166
|
ionic_strength_M = ionic_strength.m_as("M")
|
|
168
167
|
T_in_K = temperature.m_as("K")
|
|
169
168
|
return map(
|
|
170
|
-
lambda ms:
|
|
171
|
-
|
|
169
|
+
lambda ms: (
|
|
170
|
+
-ms.transform(
|
|
171
|
+
pH=pH, pMg=pMg, ionic_strength_M=ionic_strength_M, T_in_K=T_in_K
|
|
172
|
+
)
|
|
172
173
|
),
|
|
173
174
|
self.microspecies,
|
|
174
175
|
)
|
|
@@ -202,7 +203,6 @@ class Compound(TimeStampMixin, Base):
|
|
|
202
203
|
The transformed relative :math:`\Delta G` of this compound.
|
|
203
204
|
|
|
204
205
|
"""
|
|
205
|
-
|
|
206
206
|
# Since the ddg_over_rt values of different microspecies can span
|
|
207
207
|
# a large range, summing their exponents directly will cause floating
|
|
208
208
|
# point overflow issue. Therefore, we use logaddexp instead.
|
|
@@ -252,7 +252,6 @@ class Compound(TimeStampMixin, Base):
|
|
|
252
252
|
The derivative of :math:`\Delta G_f` with respect to pH.
|
|
253
253
|
|
|
254
254
|
"""
|
|
255
|
-
|
|
256
255
|
# The Legendre transform term is:
|
|
257
256
|
# T = -ln( sum[ exp(-g_i) ] ) = -lse[-g_i]
|
|
258
257
|
# where we use lse[] as a shorthand for log-sum-exp,
|
|
@@ -323,7 +322,6 @@ class Compound(TimeStampMixin, Base):
|
|
|
323
322
|
The derivative of :math:`\Delta G_f` with respect to pH.
|
|
324
323
|
|
|
325
324
|
"""
|
|
326
|
-
|
|
327
325
|
# See the derivation in sensitivity_to_p_h(). So we can similary
|
|
328
326
|
# say that:
|
|
329
327
|
# dT/dI = exp( lse[ -g_i + ln(dg_i/dI) ] - lse[ -g_i ] )
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
25
|
# THE SOFTWARE.
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
import logging
|
|
29
28
|
import re
|
|
30
29
|
import sys
|
|
@@ -161,7 +160,6 @@ class Reaction:
|
|
|
161
160
|
The reverse reaction.
|
|
162
161
|
|
|
163
162
|
"""
|
|
164
|
-
|
|
165
163
|
sparse = dict((k, -v) for (k, v) in self.sparse.items())
|
|
166
164
|
return Reaction(sparse, self.arrow, self.rid)
|
|
167
165
|
|
|
@@ -264,8 +262,7 @@ class Reaction:
|
|
|
264
262
|
|
|
265
263
|
if len(tokens) < 2:
|
|
266
264
|
raise ParseException(
|
|
267
|
-
f"Reaction does not contain an allowed arrow sign ({arrow}):
|
|
268
|
-
f" {formula}"
|
|
265
|
+
f"Reaction does not contain an allowed arrow sign ({arrow}): {formula}"
|
|
269
266
|
)
|
|
270
267
|
|
|
271
268
|
left = tokens[0].strip()
|
|
@@ -338,7 +335,7 @@ class Reaction:
|
|
|
338
335
|
|
|
339
336
|
def _get_reaction_atom_bag(
|
|
340
337
|
self, minimal_stoichiometry: Optional[float] = None
|
|
341
|
-
) -> Dict[str, int]:
|
|
338
|
+
) -> Dict[str, int] | None:
|
|
342
339
|
"""Use for checking if all elements are conserved.
|
|
343
340
|
|
|
344
341
|
Parameters
|
|
@@ -365,7 +362,7 @@ class Reaction:
|
|
|
365
362
|
+ "compounds have unspecific formulas: "
|
|
366
363
|
+ "%s" % str(self)
|
|
367
364
|
)
|
|
368
|
-
warnings.warn(warning_str)
|
|
365
|
+
warnings.warn(warning_str, stacklevel=2)
|
|
369
366
|
return None
|
|
370
367
|
|
|
371
368
|
stoichiometry = np.array(list(element_df.columns.map(self.get_coeff)))
|
|
@@ -478,7 +475,6 @@ class Reaction:
|
|
|
478
475
|
count : float
|
|
479
476
|
the number of atoms of this type in `compound`
|
|
480
477
|
"""
|
|
481
|
-
|
|
482
478
|
if _compound.atom_bag is None:
|
|
483
479
|
raise Exception(
|
|
484
480
|
f"Cannot balance using this compound, it has no "
|
|
@@ -603,7 +599,8 @@ class Reaction:
|
|
|
603
599
|
)
|
|
604
600
|
except MissingDissociationConstantsException as e:
|
|
605
601
|
warnings.warn(
|
|
606
|
-
f"Cannot calculate Legendre transform for {compound}: " + str(e)
|
|
602
|
+
f"Cannot calculate Legendre transform for {compound}: " + str(e),
|
|
603
|
+
stacklevel=2,
|
|
607
604
|
)
|
|
608
605
|
return ddg
|
|
609
606
|
|
|
@@ -649,7 +646,8 @@ class Reaction:
|
|
|
649
646
|
)
|
|
650
647
|
except MissingDissociationConstantsException as e:
|
|
651
648
|
warnings.warn(
|
|
652
|
-
f"Cannot calculate Legendre transform for {compound}: " + str(e)
|
|
649
|
+
f"Cannot calculate Legendre transform for {compound}: " + str(e),
|
|
650
|
+
stacklevel=2,
|
|
653
651
|
)
|
|
654
652
|
return sensitivity
|
|
655
653
|
|
|
@@ -695,7 +693,8 @@ class Reaction:
|
|
|
695
693
|
)
|
|
696
694
|
except MissingDissociationConstantsException as e:
|
|
697
695
|
warnings.warn(
|
|
698
|
-
f"Cannot calculate Legendre transform for {compound}: " + str(e)
|
|
696
|
+
f"Cannot calculate Legendre transform for {compound}: " + str(e),
|
|
697
|
+
stacklevel=2,
|
|
699
698
|
)
|
|
700
699
|
return sensitivity
|
|
701
700
|
|
|
@@ -711,7 +710,6 @@ class Reaction:
|
|
|
711
710
|
float
|
|
712
711
|
The sum of all coefficients.
|
|
713
712
|
"""
|
|
714
|
-
|
|
715
713
|
return sum(c for _, c in self.items(protons=False, water=False))
|
|
716
714
|
|
|
717
715
|
def _sum_absolute_coefficients(self) -> float:
|
|
@@ -725,7 +723,6 @@ class Reaction:
|
|
|
725
723
|
The sum of coefficients in absolute value.
|
|
726
724
|
|
|
727
725
|
"""
|
|
728
|
-
|
|
729
726
|
return sum(abs(c) for _, c in self.items(protons=False, water=False))
|
|
730
727
|
|
|
731
728
|
def check_half_reaction_balancing(self) -> Union[int, None]:
|
|
@@ -739,7 +736,6 @@ class Reaction:
|
|
|
739
736
|
The number of electrons that are 'missing' in the
|
|
740
737
|
half-reaction or None if the reaction is not atomwise-balanced.
|
|
741
738
|
"""
|
|
742
|
-
|
|
743
739
|
atom_bag = self._get_reaction_atom_bag()
|
|
744
740
|
if atom_bag is None:
|
|
745
741
|
return None
|
|
@@ -788,7 +784,7 @@ class Reaction:
|
|
|
788
784
|
# filter out compounds with zero coefficients
|
|
789
785
|
sorted_cpd_coeff_list = list(filter(lambda x: x[1] != 0, sorted_cpd_coeff_list))
|
|
790
786
|
if len(sorted_cpd_coeff_list) == 0:
|
|
791
|
-
warnings.warn("All stoichiometric coefficients are 0")
|
|
787
|
+
warnings.warn("All stoichiometric coefficients are 0", stacklevel=2)
|
|
792
788
|
return tuple()
|
|
793
789
|
norm_factor = 1.0 / sorted_cpd_coeff_list[0][1]
|
|
794
790
|
r_list = [(cpd.id, norm_factor * coeff) for cpd, coeff in sorted_cpd_coeff_list]
|
|
@@ -26,12 +26,10 @@
|
|
|
26
26
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
27
27
|
# THE SOFTWARE.
|
|
28
28
|
|
|
29
|
-
|
|
30
29
|
import logging
|
|
31
30
|
import pathlib
|
|
32
31
|
from typing import NamedTuple
|
|
33
32
|
|
|
34
|
-
import appdirs
|
|
35
33
|
import pooch
|
|
36
34
|
|
|
37
35
|
logger = logging.getLogger(__name__)
|
|
@@ -82,7 +80,7 @@ def get_cached_filepath(settings: ZenodoSettings) -> pathlib.Path:
|
|
|
82
80
|
The path to the locally cached file.
|
|
83
81
|
|
|
84
82
|
"""
|
|
85
|
-
cache_directory =
|
|
83
|
+
cache_directory = pooch.os_cache("equilibrator")
|
|
86
84
|
cache_directory.mkdir(parents=True, exist_ok=True)
|
|
87
85
|
|
|
88
86
|
cache_fname = pooch.retrieve(
|
{equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1/src/equilibrator_cache.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: equilibrator-cache
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Summary: Cache application for compounds, reactions, and enzymes
|
|
5
5
|
Author: Elad Noor, Moritz E. Beber
|
|
6
6
|
License-Expression: MIT
|
|
@@ -22,14 +22,12 @@ Requires-Python: >=3.11
|
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
24
|
Requires-Dist: numpy>=2.0
|
|
25
|
-
Requires-Dist: scipy>=1.
|
|
26
|
-
Requires-Dist: pandas>=2.
|
|
27
|
-
Requires-Dist: pyarrow>=23.0
|
|
25
|
+
Requires-Dist: scipy>=1.13
|
|
26
|
+
Requires-Dist: pandas>=2.0
|
|
28
27
|
Requires-Dist: sqlalchemy~=2.0
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist: pint~=0.24
|
|
28
|
+
Requires-Dist: rapidfuzz>=3.9
|
|
29
|
+
Requires-Dist: pint[uncertainties]~=0.24
|
|
31
30
|
Requires-Dist: tqdm~=4.0
|
|
32
|
-
Requires-Dist: appdirs~=1.4
|
|
33
31
|
Requires-Dist: pooch~=1.8
|
|
34
32
|
Provides-Extra: test
|
|
35
33
|
Requires-Dist: pytest; extra == "test"
|
|
@@ -38,10 +36,7 @@ Requires-Dist: pytest-raises; extra == "test"
|
|
|
38
36
|
Requires-Dist: pytest-mock; extra == "test"
|
|
39
37
|
Requires-Dist: hypothesis; extra == "test"
|
|
40
38
|
Provides-Extra: development
|
|
41
|
-
Requires-Dist:
|
|
42
|
-
Requires-Dist: isort; extra == "development"
|
|
43
|
-
Requires-Dist: flake8; extra == "development"
|
|
44
|
-
Requires-Dist: safety; extra == "development"
|
|
39
|
+
Requires-Dist: pip-audit; extra == "development"
|
|
45
40
|
Requires-Dist: tox; extra == "development"
|
|
46
41
|
Requires-Dist: twine; extra == "development"
|
|
47
42
|
Provides-Extra: deployment
|
{equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache.egg-info/requires.txt
RENAMED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
numpy>=2.0
|
|
2
|
-
scipy>=1.
|
|
3
|
-
pandas>=2.
|
|
4
|
-
pyarrow>=23.0
|
|
2
|
+
scipy>=1.13
|
|
3
|
+
pandas>=2.0
|
|
5
4
|
sqlalchemy~=2.0
|
|
6
|
-
|
|
7
|
-
pint~=0.24
|
|
5
|
+
rapidfuzz>=3.9
|
|
6
|
+
pint[uncertainties]~=0.24
|
|
8
7
|
tqdm~=4.0
|
|
9
|
-
appdirs~=1.4
|
|
10
8
|
pooch~=1.8
|
|
11
9
|
|
|
12
10
|
[deployment]
|
|
@@ -16,10 +14,7 @@ openbabel
|
|
|
16
14
|
python-dateutil
|
|
17
15
|
|
|
18
16
|
[development]
|
|
19
|
-
|
|
20
|
-
isort
|
|
21
|
-
flake8
|
|
22
|
-
safety
|
|
17
|
+
pip-audit
|
|
23
18
|
tox
|
|
24
19
|
twine
|
|
25
20
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache/models/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{equilibrator_cache-0.7.0b2 → equilibrator_cache-0.7.1}/src/equilibrator_cache.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|