Skip to content

Commit b7763ef

Browse files
author
MD-Models Bot
committed
Model update
1 parent 6a8fe43 commit b7763ef

File tree

7 files changed

+287
-235
lines changed

7 files changed

+287
-235
lines changed

docs/model.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ This page provides comprehensive information about the structure and components
3636
enzymemldocument(EnzymeMLDocument) --> reaction(Reaction)
3737
enzymemldocument(EnzymeMLDocument) --> measurement(Measurement)
3838
enzymemldocument(EnzymeMLDocument) --> equation(Equation)
39+
enzymemldocument(EnzymeMLDocument) --> parameter(Parameter)
3940
vessel(Vessel) --> unitdefinition(UnitDefinition)
4041
reaction(Reaction) --> equation(Equation)
4142
reaction(Reaction) --> reactionelement(ReactionElement)
4243
equation(Equation) --> equationtype(EquationType)
4344
equation(Equation) --> variable(Variable)
44-
equation(Equation) --> parameter(Parameter)
4545
parameter(Parameter) --> unitdefinition(UnitDefinition)
4646
measurement(Measurement) --> measurementdata(MeasurementData)
4747
measurement(Measurement) --> unitdefinition(UnitDefinition)
@@ -73,8 +73,8 @@ This page provides comprehensive information about the structure and components
7373

7474

7575
## Ontologies
76-
- [OBO](http://purl.obolibrary.org/obo/)
7776
- [schema](https://schema.org/)
77+
- [OBO](http://purl.obolibrary.org/obo/)
7878

7979

8080
## Types
@@ -143,6 +143,11 @@ __equations__ [`list[Equation]`](#equation)
143143
- Contains ordinary differential equations that describe the kinetic model.
144144

145145

146+
__parameters__ [`list[Parameter]`](#parameter)
147+
148+
- List of parameters that are part of the equation
149+
150+
146151
------
147152

148153
### Creator
@@ -384,11 +389,6 @@ __variables__ [`list[Variable]`](#variable)
384389
- List of variables that are part of the equation
385390

386391

387-
__parameters__ [`list[Parameter]`](#parameter)
388-
389-
- List of parameters that are part of the equation
390-
391-
392392
------
393393

394394
### Variable

python/pyenzyme/dataclass_models.py

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class EnzymeMLDocument:
2828
reactions: List[Reaction] = field(default_factory=list)
2929
measurements: List[Measurement] = field(default_factory=list)
3030
equations: List[Equation] = field(default_factory=list)
31+
parameters: List[Parameter] = field(default_factory=list)
3132

3233
# JSON-LD fields
3334
id: str = field(
@@ -44,8 +45,8 @@ class EnzymeMLDocument:
4445
metadata=config(field_name="@context"),
4546
default_factory=lambda: {
4647
"enzml": "http://www.enzymeml.org/v2/",
47-
"OBO": "http://purl.obolibrary.org/obo/",
4848
"schema": "https://schema.org/",
49+
"OBO": "http://purl.obolibrary.org/obo/",
4950
"name": "schema:title",
5051
"references": {
5152
"@id": "schema:citation",
@@ -241,15 +242,13 @@ def add_to_equations(
241242
equation_type: EquationType,
242243
species_id: Optional[str] = None,
243244
variables: list[Variable] = [],
244-
parameters: list[Parameter] = [],
245245
**kwargs,
246246
):
247247
params = {
248248
"equation": equation,
249249
"equation_type": equation_type,
250250
"species_id": species_id,
251251
"variables": variables,
252-
"parameters": parameters,
253252
}
254253

255254
if "id" in kwargs:
@@ -259,6 +258,40 @@ def add_to_equations(
259258

260259
return self.equations[-1]
261260

261+
def add_to_parameters(
262+
self,
263+
id: str,
264+
name: str,
265+
symbol: str,
266+
value: Optional[float] = None,
267+
unit: Optional[UnitDefinition] = None,
268+
initial_value: Optional[float] = None,
269+
upper: Optional[float] = None,
270+
lower: Optional[float] = None,
271+
stderr: Optional[float] = None,
272+
constant: Optional[bool] = True,
273+
**kwargs,
274+
):
275+
params = {
276+
"id": id,
277+
"name": name,
278+
"symbol": symbol,
279+
"value": value,
280+
"unit": unit,
281+
"initial_value": initial_value,
282+
"upper": upper,
283+
"lower": lower,
284+
"stderr": stderr,
285+
"constant": constant,
286+
}
287+
288+
if "id" in kwargs:
289+
params["id"] = kwargs["id"]
290+
291+
self.parameters.append(Parameter(**params))
292+
293+
return self.parameters[-1]
294+
262295

263296
@dataclass_json
264297
@dataclass
@@ -280,8 +313,8 @@ class Creator:
280313
metadata=config(field_name="@context"),
281314
default_factory=lambda: {
282315
"enzml": "http://www.enzymeml.org/v2/",
283-
"OBO": "http://purl.obolibrary.org/obo/",
284316
"schema": "https://schema.org/",
317+
"OBO": "http://purl.obolibrary.org/obo/",
285318
"given_name": "schema:givenName",
286319
"family_name": "schema:familyName",
287320
"mail": "schema:email",
@@ -310,8 +343,8 @@ class Vessel:
310343
metadata=config(field_name="@context"),
311344
default_factory=lambda: {
312345
"enzml": "http://www.enzymeml.org/v2/",
313-
"OBO": "http://purl.obolibrary.org/obo/",
314346
"schema": "https://schema.org/",
347+
"OBO": "http://purl.obolibrary.org/obo/",
315348
"id": {
316349
"@id": "schema:identifier",
317350
"@type": "@id",
@@ -357,8 +390,8 @@ class Protein:
357390
metadata=config(field_name="@context"),
358391
default_factory=lambda: {
359392
"enzml": "http://www.enzymeml.org/v2/",
360-
"OBO": "http://purl.obolibrary.org/obo/",
361393
"schema": "https://schema.org/",
394+
"OBO": "http://purl.obolibrary.org/obo/",
362395
"id": {
363396
"@type": "@id",
364397
},
@@ -402,8 +435,8 @@ class Complex:
402435
metadata=config(field_name="@context"),
403436
default_factory=lambda: {
404437
"enzml": "http://www.enzymeml.org/v2/",
405-
"OBO": "http://purl.obolibrary.org/obo/",
406438
"schema": "https://schema.org/",
439+
"OBO": "http://purl.obolibrary.org/obo/",
407440
"id": {
408441
"@id": "schema:identifier",
409442
"@type": "@id",
@@ -450,8 +483,8 @@ class SmallMolecule:
450483
metadata=config(field_name="@context"),
451484
default_factory=lambda: {
452485
"enzml": "http://www.enzymeml.org/v2/",
453-
"OBO": "http://purl.obolibrary.org/obo/",
454486
"schema": "https://schema.org/",
487+
"OBO": "http://purl.obolibrary.org/obo/",
455488
"id": {
456489
"@id": "schema:identifier",
457490
"@type": "@id",
@@ -495,8 +528,8 @@ class Reaction:
495528
metadata=config(field_name="@context"),
496529
default_factory=lambda: {
497530
"enzml": "http://www.enzymeml.org/v2/",
498-
"OBO": "http://purl.obolibrary.org/obo/",
499531
"schema": "https://schema.org/",
532+
"OBO": "http://purl.obolibrary.org/obo/",
500533
"id": {
501534
"@id": "schema:identifier",
502535
"@type": "@id",
@@ -544,8 +577,8 @@ class ReactionElement:
544577
metadata=config(field_name="@context"),
545578
default_factory=lambda: {
546579
"enzml": "http://www.enzymeml.org/v2/",
547-
"OBO": "http://purl.obolibrary.org/obo/",
548580
"schema": "https://schema.org/",
581+
"OBO": "http://purl.obolibrary.org/obo/",
549582
"species_id": {
550583
"@type": "@id",
551584
},
@@ -562,7 +595,6 @@ class Equation:
562595
default=None, metadata=config(exclude=lambda x: x is None)
563596
)
564597
variables: List[Variable] = field(default_factory=list)
565-
parameters: List[Parameter] = field(default_factory=list)
566598

567599
# JSON-LD fields
568600
id: str = field(
@@ -579,8 +611,8 @@ class Equation:
579611
metadata=config(field_name="@context"),
580612
default_factory=lambda: {
581613
"enzml": "http://www.enzymeml.org/v2/",
582-
"OBO": "http://purl.obolibrary.org/obo/",
583614
"schema": "https://schema.org/",
615+
"OBO": "http://purl.obolibrary.org/obo/",
584616
"species_id": {
585617
"@type": "@id",
586618
},
@@ -603,40 +635,6 @@ def add_to_variables(
603635

604636
return self.variables[-1]
605637

606-
def add_to_parameters(
607-
self,
608-
id: str,
609-
name: str,
610-
symbol: str,
611-
value: Optional[float] = None,
612-
unit: Optional[UnitDefinition] = None,
613-
initial_value: Optional[float] = None,
614-
upper: Optional[float] = None,
615-
lower: Optional[float] = None,
616-
stderr: Optional[float] = None,
617-
constant: Optional[bool] = True,
618-
**kwargs,
619-
):
620-
params = {
621-
"id": id,
622-
"name": name,
623-
"symbol": symbol,
624-
"value": value,
625-
"unit": unit,
626-
"initial_value": initial_value,
627-
"upper": upper,
628-
"lower": lower,
629-
"stderr": stderr,
630-
"constant": constant,
631-
}
632-
633-
if "id" in kwargs:
634-
params["id"] = kwargs["id"]
635-
636-
self.parameters.append(Parameter(**params))
637-
638-
return self.parameters[-1]
639-
640638

641639
@dataclass_json
642640
@dataclass
@@ -659,8 +657,8 @@ class Variable:
659657
metadata=config(field_name="@context"),
660658
default_factory=lambda: {
661659
"enzml": "http://www.enzymeml.org/v2/",
662-
"OBO": "http://purl.obolibrary.org/obo/",
663660
"schema": "https://schema.org/",
661+
"OBO": "http://purl.obolibrary.org/obo/",
664662
"id": "schema:identifier",
665663
},
666664
)
@@ -706,8 +704,8 @@ class Parameter:
706704
metadata=config(field_name="@context"),
707705
default_factory=lambda: {
708706
"enzml": "http://www.enzymeml.org/v2/",
709-
"OBO": "http://purl.obolibrary.org/obo/",
710707
"schema": "https://schema.org/",
708+
"OBO": "http://purl.obolibrary.org/obo/",
711709
"id": {
712710
"@id": "schema:identifier",
713711
"@type": "@id",
@@ -749,8 +747,8 @@ class Measurement:
749747
metadata=config(field_name="@context"),
750748
default_factory=lambda: {
751749
"enzml": "http://www.enzymeml.org/v2/",
752-
"OBO": "http://purl.obolibrary.org/obo/",
753750
"schema": "https://schema.org/",
751+
"OBO": "http://purl.obolibrary.org/obo/",
754752
"id": {
755753
"@id": "schema:identifier",
756754
"@type": "@id",
@@ -824,8 +822,8 @@ class MeasurementData:
824822
metadata=config(field_name="@context"),
825823
default_factory=lambda: {
826824
"enzml": "http://www.enzymeml.org/v2/",
827-
"OBO": "http://purl.obolibrary.org/obo/",
828825
"schema": "https://schema.org/",
826+
"OBO": "http://purl.obolibrary.org/obo/",
829827
"species_id": {
830828
"@type": "@id",
831829
},
@@ -856,8 +854,8 @@ class UnitDefinition:
856854
metadata=config(field_name="@context"),
857855
default_factory=lambda: {
858856
"enzml": "http://www.enzymeml.org/v2/",
859-
"OBO": "http://purl.obolibrary.org/obo/",
860857
"schema": "https://schema.org/",
858+
"OBO": "http://purl.obolibrary.org/obo/",
861859
},
862860
)
863861

@@ -911,8 +909,8 @@ class BaseUnit:
911909
metadata=config(field_name="@context"),
912910
default_factory=lambda: {
913911
"enzml": "http://www.enzymeml.org/v2/",
914-
"OBO": "http://purl.obolibrary.org/obo/",
915912
"schema": "https://schema.org/",
913+
"OBO": "http://purl.obolibrary.org/obo/",
916914
},
917915
)
918916

0 commit comments

Comments
 (0)