File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,6 +73,11 @@ def __init__(
7373 >>> doc = pe.read_enzymeml("path/to/enzmldoc.json")
7474 >>> tl = tls.ThinLayerPysces(doc)
7575 """
76+
77+ # Currently, the ThinLayerPysces only supports the reaction model
78+ # TODO: Add support for Rate Rules
79+ self ._check_compliance (enzmldoc )
80+
7681 super ().__init__ (
7782 enzmldoc = enzmldoc ,
7883 measurement_ids = measurement_ids ,
@@ -89,6 +94,25 @@ def __init__(
8994 # Convert model to PSC
9095 self ._get_pysces_model (model_dir )
9196
97+ def _check_compliance (self , enzmldoc : v2 .EnzymeMLDocument ):
98+ """
99+ Check if the EnzymeML document is compliant with the PySCeS model.
100+ """
101+ has_kinetic_laws = any (m .kinetic_law is not None for m in enzmldoc .reactions )
102+
103+ has_odes = any (
104+ m .equation_type == v2 .EquationType .ODE for m in enzmldoc .equations
105+ )
106+
107+ if not has_kinetic_laws :
108+ raise ValueError ("EnzymeML document must contain kinetic laws" )
109+
110+ if has_odes :
111+ raise ValueError (
112+ "The PySCeS thinlayer only supports Kinetic Laws, not ODEs" ,
113+ "Support for ODEs will be added in the future." ,
114+ )
115+
92116 def integrate (
93117 self ,
94118 model : v2 .EnzymeMLDocument ,
Original file line number Diff line number Diff line change 11import tempfile
2+
3+ import pytest
24import pyenzyme as pe
35from pyenzyme .thinlayers import ThinLayerPysces
46from pyenzyme .versions import v2
@@ -60,6 +62,13 @@ def test_plot(self):
6062 assert fig is not None , "Figure is not created"
6163 assert axs is not None , "Axes are not created"
6264
65+ def test_compliance (self ):
66+ doc = pe .read_enzymeml ("tests/fixtures/modeling/enzmldoc.json" )
67+
68+ with pytest .raises (ValueError ):
69+ with tempfile .TemporaryDirectory () as tmp_dir :
70+ ThinLayerPysces (doc , tmp_dir )
71+
6372 @staticmethod
6473 def _extract_parameter (doc : v2 .EnzymeMLDocument , symbol : str ) -> v2 .Parameter :
6574 param = next (p for p in doc .parameters if p .symbol == symbol )
You can’t perform that action at this time.
0 commit comments