diff --git a/docs/model.md b/docs/model.md index 7b8578c..379c6de 100644 --- a/docs/model.md +++ b/docs/model.md @@ -46,8 +46,8 @@ This page provides comprehensive information about the structure and components measurement(Measurement) --> measurementdata(MeasurementData) measurement(Measurement) --> unitdefinition(UnitDefinition) measurementdata(MeasurementData) --> unitdefinition(UnitDefinition) - measurementdata(MeasurementData) --> unitdefinition(UnitDefinition) measurementdata(MeasurementData) --> datatypes(DataTypes) + measurementdata(MeasurementData) --> unitdefinition(UnitDefinition) unitdefinition(UnitDefinition) --> baseunit(BaseUnit) baseunit(BaseUnit) --> unittype(UnitType) @@ -73,8 +73,8 @@ This page provides comprehensive information about the structure and components ## Ontologies -- [schema](https://schema.org/) - [OBO](http://purl.obolibrary.org/obo/) +- [schema](https://schema.org/) ## Types @@ -525,11 +525,6 @@ __data_unit__* [`UnitDefinition`](#unitdefinition) - SI unit of the data that was measured. -__time_unit__* [`UnitDefinition`](#unitdefinition) - -- Time unit of the replicate. - - __data_type__* [`DataTypes`](#datatypes) - Type of data that was measured (e.g. concentration) @@ -540,16 +535,21 @@ __prepared__ `float` - Amount of the reactant before the measurement. This field should be used for specifying the prepared amount of a species in the reaction mix. Not to be confused with -__data__* `list[float]` +__data__ `list[float]` - Data that was measured. -__time__* `list[float]` +__time__ `list[float]` - Time steps of the replicate. +__time_unit__ [`UnitDefinition`](#unitdefinition) + +- Time unit of the replicate. + + __is_simulated__* `boolean` - Whether or not the data has been generated by simulation. diff --git a/python/pyenzyme/dataclass_models.py b/python/pyenzyme/dataclass_models.py index fbfbf5d..fa594ae 100644 --- a/python/pyenzyme/dataclass_models.py +++ b/python/pyenzyme/dataclass_models.py @@ -14,12 +14,8 @@ class EnzymeMLDocument: name: str references: List[str] = field(default_factory=list) - created: Optional[str] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - modified: Optional[str] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) + created: Optional[str] = field(default=None, metadata=config(exclude=lambda x: x is None)) + modified: Optional[str] = field(default=None, metadata=config(exclude=lambda x: x is None)) creators: List[Creator] = field(default_factory=list) vessels: List[Vessel] = field(default_factory=list) proteins: List[Protein] = field(default_factory=list) @@ -33,20 +29,20 @@ class EnzymeMLDocument: # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:EnzymeMLDocument/" + str(uuid4()), + default_factory=lambda: "enzml:EnzymeMLDocument/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: [ + default_factory = lambda: [ "enzml:EnzymeMLDocument", ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "name": "schema:title", "references": { "@id": "schema:citation", @@ -55,9 +51,10 @@ class EnzymeMLDocument: "created": "schema:dateCreated", "modified": "schema:dateModified", "creators": "schema:creator", - }, + } ) + def add_to_creators( self, given_name: str, @@ -65,22 +62,29 @@ def add_to_creators( mail: str, **kwargs, ): - params = {"given_name": given_name, "family_name": family_name, "mail": mail} + params = { + "given_name": given_name, + "family_name": family_name, + "mail": mail + } if "id" in kwargs: params["id"] = kwargs["id"] - self.creators.append(Creator(**params)) + self.creators.append( + Creator(**params) + ) return self.creators[-1] + def add_to_vessels( self, id: str, name: str, volume: float, unit: UnitDefinition, - constant: bool = True, + constant: bool= True, **kwargs, ): params = { @@ -88,27 +92,30 @@ def add_to_vessels( "name": name, "volume": volume, "unit": unit, - "constant": constant, + "constant": constant } if "id" in kwargs: params["id"] = kwargs["id"] - self.vessels.append(Vessel(**params)) + self.vessels.append( + Vessel(**params) + ) return self.vessels[-1] + def add_to_proteins( self, id: str, name: str, - constant: bool = False, - sequence: Optional[str] = None, - vessel_id: Optional[str] = None, - ecnumber: Optional[str] = None, - organism: Optional[str] = None, - organism_tax_id: Optional[str] = None, - references: list[str] = [], + constant: bool= False, + sequence: Optional[str]= None, + vessel_id: Optional[str]= None, + ecnumber: Optional[str]= None, + organism: Optional[str]= None, + organism_tax_id: Optional[str]= None, + references: list[str]= [], **kwargs, ): params = { @@ -120,48 +127,54 @@ def add_to_proteins( "ecnumber": ecnumber, "organism": organism, "organism_tax_id": organism_tax_id, - "references": references, + "references": references } if "id" in kwargs: params["id"] = kwargs["id"] - self.proteins.append(Protein(**params)) + self.proteins.append( + Protein(**params) + ) return self.proteins[-1] + def add_to_complexes( self, id: str, name: str, - constant: bool = False, - participants: list[str] = [], + constant: bool= False, + participants: list[str]= [], **kwargs, ): params = { "id": id, "name": name, "constant": constant, - "participants": participants, + "participants": participants } if "id" in kwargs: params["id"] = kwargs["id"] - self.complexes.append(Complex(**params)) + self.complexes.append( + Complex(**params) + ) return self.complexes[-1] + def add_to_small_molecules( self, id: str, name: str, - constant: bool = False, - vessel_id: Optional[str] = None, - canonical_smiles: Optional[str] = None, - inchi: Optional[str] = None, - inchikey: Optional[str] = None, - references: list[str] = [], + constant: bool= False, + vessel_id: Optional[str]= None, + canonical_smiles: Optional[str]= None, + inchi: Optional[str]= None, + inchikey: Optional[str]= None, + references: list[str]= [], **kwargs, ): params = { @@ -172,24 +185,27 @@ def add_to_small_molecules( "canonical_smiles": canonical_smiles, "inchi": inchi, "inchikey": inchikey, - "references": references, + "references": references } if "id" in kwargs: params["id"] = kwargs["id"] - self.small_molecules.append(SmallMolecule(**params)) + self.small_molecules.append( + SmallMolecule(**params) + ) return self.small_molecules[-1] + def add_to_reactions( self, id: str, name: str, - reversible: bool = False, - kinetic_law: Optional[Equation] = None, - species: list[ReactionElement] = [], - modifiers: list[str] = [], + reversible: bool= False, + kinetic_law: Optional[Equation]= None, + species: list[ReactionElement]= [], + modifiers: list[str]= [], **kwargs, ): params = { @@ -198,25 +214,28 @@ def add_to_reactions( "reversible": reversible, "kinetic_law": kinetic_law, "species": species, - "modifiers": modifiers, + "modifiers": modifiers } if "id" in kwargs: params["id"] = kwargs["id"] - self.reactions.append(Reaction(**params)) + self.reactions.append( + Reaction(**params) + ) return self.reactions[-1] + def add_to_measurements( self, id: str, name: str, - species_data: list[MeasurementData] = [], - group_id: Optional[str] = None, - ph: Optional[float] = None, - temperature: Optional[float] = None, - temperature_unit: Optional[UnitDefinition] = None, + species_data: list[MeasurementData]= [], + group_id: Optional[str]= None, + ph: Optional[float]= None, + temperature: Optional[float]= None, + temperature_unit: Optional[UnitDefinition]= None, **kwargs, ): params = { @@ -226,50 +245,56 @@ def add_to_measurements( "group_id": group_id, "ph": ph, "temperature": temperature, - "temperature_unit": temperature_unit, + "temperature_unit": temperature_unit } if "id" in kwargs: params["id"] = kwargs["id"] - self.measurements.append(Measurement(**params)) + self.measurements.append( + Measurement(**params) + ) return self.measurements[-1] + def add_to_equations( self, equation: str, equation_type: EquationType, - species_id: Optional[str] = None, - variables: list[Variable] = [], + species_id: Optional[str]= None, + variables: list[Variable]= [], **kwargs, ): params = { "equation": equation, "equation_type": equation_type, "species_id": species_id, - "variables": variables, + "variables": variables } if "id" in kwargs: params["id"] = kwargs["id"] - self.equations.append(Equation(**params)) + self.equations.append( + Equation(**params) + ) return self.equations[-1] + def add_to_parameters( self, id: str, name: str, symbol: str, - value: Optional[float] = None, - unit: Optional[UnitDefinition] = None, - initial_value: Optional[float] = None, - upper: Optional[float] = None, - lower: Optional[float] = None, - stderr: Optional[float] = None, - constant: Optional[bool] = True, + value: Optional[float]= None, + unit: Optional[UnitDefinition]= None, + initial_value: Optional[float]= None, + upper: Optional[float]= None, + lower: Optional[float]= None, + stderr: Optional[float]= None, + constant: Optional[bool]= True, **kwargs, ): params = { @@ -282,17 +307,18 @@ def add_to_parameters( "upper": upper, "lower": lower, "stderr": stderr, - "constant": constant, + "constant": constant } if "id" in kwargs: params["id"] = kwargs["id"] - self.parameters.append(Parameter(**params)) + self.parameters.append( + Parameter(**params) + ) return self.parameters[-1] - @dataclass_json @dataclass class Creator: @@ -303,22 +329,24 @@ class Creator: # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:Creator/" + str(uuid4()), + default_factory=lambda: "enzml:Creator/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: ["enzml:Creator", "schema:person"], + default_factory = lambda: [ + "enzml:Creator","schema:person" + ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "given_name": "schema:givenName", "family_name": "schema:familyName", "mail": "schema:email", - }, + } ) @@ -333,25 +361,27 @@ class Vessel: # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:Vessel/" + str(uuid4()), + default_factory=lambda: "enzml:Vessel/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: ["enzml:Vessel", "OBO:OBI_0400081"], + default_factory = lambda: [ + "enzml:Vessel","OBO:OBI_0400081" + ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": { "@id": "schema:identifier", "@type": "@id", }, "name": "schema:name", "volume": "OBO:OBI_0002139", - }, + } ) @@ -360,38 +390,30 @@ class Vessel: class Protein: name: str constant: bool = False - sequence: Optional[str] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - vessel_id: Optional[str] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - ecnumber: Optional[str] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - organism: Optional[str] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - organism_tax_id: Optional[str] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) + sequence: Optional[str] = field(default=None, metadata=config(exclude=lambda x: x is None)) + vessel_id: Optional[str] = field(default=None, metadata=config(exclude=lambda x: x is None)) + ecnumber: Optional[str] = field(default=None, metadata=config(exclude=lambda x: x is None)) + organism: Optional[str] = field(default=None, metadata=config(exclude=lambda x: x is None)) + organism_tax_id: Optional[str] = field(default=None, metadata=config(exclude=lambda x: x is None)) references: List[str] = field(default_factory=list) # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:Protein/" + str(uuid4()), + default_factory=lambda: "enzml:Protein/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: ["enzml:Protein", "schema:Protein"], + default_factory = lambda: [ + "enzml:Protein","schema:Protein" + ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": { "@type": "@id", }, @@ -409,7 +431,7 @@ class Protein: "@id": "schema:citation", "@type": "@id", }, - }, + } ) @@ -423,20 +445,20 @@ class Complex: # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:Complex/" + str(uuid4()), + default_factory=lambda: "enzml:Complex/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: [ + default_factory = lambda: [ "enzml:Complex", ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": { "@id": "schema:identifier", "@type": "@id", @@ -445,7 +467,7 @@ class Complex: "participants": { "@type": "@id", }, - }, + } ) @@ -454,37 +476,29 @@ class Complex: class SmallMolecule: name: str constant: bool = False - vessel_id: Optional[str] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - canonical_smiles: Optional[str] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - inchi: Optional[str] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - inchikey: Optional[str] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) + vessel_id: Optional[str] = field(default=None, metadata=config(exclude=lambda x: x is None)) + canonical_smiles: Optional[str] = field(default=None, metadata=config(exclude=lambda x: x is None)) + inchi: Optional[str] = field(default=None, metadata=config(exclude=lambda x: x is None)) + inchikey: Optional[str] = field(default=None, metadata=config(exclude=lambda x: x is None)) references: List[str] = field(default_factory=list) # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:SmallMolecule/" + str(uuid4()), + default_factory=lambda: "enzml:SmallMolecule/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: [ + default_factory = lambda: [ "enzml:SmallMolecule", ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": { "@id": "schema:identifier", "@type": "@id", @@ -498,7 +512,7 @@ class SmallMolecule: "@id": "schema:citation", "@type": "@id", }, - }, + } ) @@ -507,29 +521,27 @@ class SmallMolecule: class Reaction: name: str reversible: bool = False - kinetic_law: Optional[Equation] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) + kinetic_law: Optional[Equation] = field(default=None, metadata=config(exclude=lambda x: x is None)) species: List[ReactionElement] = field(default_factory=list) modifiers: List[str] = field(default_factory=list) # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:Reaction/" + str(uuid4()), + default_factory=lambda: "enzml:Reaction/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: [ + default_factory = lambda: [ "enzml:Reaction", ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": { "@id": "schema:identifier", "@type": "@id", @@ -537,21 +549,27 @@ class Reaction: "modifiers": { "@type": "@id", }, - }, + } ) + def add_to_species( self, species_id: str, stoichiometry: float, **kwargs, ): - params = {"species_id": species_id, "stoichiometry": stoichiometry} + params = { + "species_id": species_id, + "stoichiometry": stoichiometry + } if "id" in kwargs: params["id"] = kwargs["id"] - self.species.append(ReactionElement(**params)) + self.species.append( + ReactionElement(**params) + ) return self.species[-1] @@ -565,24 +583,24 @@ class ReactionElement: # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:ReactionElement/" + str(uuid4()), + default_factory=lambda: "enzml:ReactionElement/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: [ + default_factory = lambda: [ "enzml:ReactionElement", ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "species_id": { "@type": "@id", }, - }, + } ) @@ -591,34 +609,33 @@ class ReactionElement: class Equation: equation: str equation_type: EquationType - species_id: Optional[str] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) + species_id: Optional[str] = field(default=None, metadata=config(exclude=lambda x: x is None)) variables: List[Variable] = field(default_factory=list) # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:Equation/" + str(uuid4()), + default_factory=lambda: "enzml:Equation/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: [ + default_factory = lambda: [ "enzml:Equation", ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "species_id": { "@type": "@id", }, - }, + } ) + def add_to_variables( self, id: str, @@ -626,16 +643,21 @@ def add_to_variables( symbol: str, **kwargs, ): - params = {"id": id, "name": name, "symbol": symbol} + params = { + "id": id, + "name": name, + "symbol": symbol + } if "id" in kwargs: params["id"] = kwargs["id"] - self.variables.append(Variable(**params)) + self.variables.append( + Variable(**params) + ) return self.variables[-1] - @dataclass_json @dataclass class Variable: @@ -645,22 +667,22 @@ class Variable: # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:Variable/" + str(uuid4()), + default_factory=lambda: "enzml:Variable/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: [ + default_factory = lambda: [ "enzml:Variable", ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": "schema:identifier", - }, + } ) @@ -669,48 +691,36 @@ class Variable: class Parameter: name: str symbol: str - value: Optional[float] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - unit: Optional[UnitDefinition] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - initial_value: Optional[float] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - upper: Optional[float] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - lower: Optional[float] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - stderr: Optional[float] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) + value: Optional[float] = field(default=None, metadata=config(exclude=lambda x: x is None)) + unit: Optional[UnitDefinition] = field(default=None, metadata=config(exclude=lambda x: x is None)) + initial_value: Optional[float] = field(default=None, metadata=config(exclude=lambda x: x is None)) + upper: Optional[float] = field(default=None, metadata=config(exclude=lambda x: x is None)) + lower: Optional[float] = field(default=None, metadata=config(exclude=lambda x: x is None)) + stderr: Optional[float] = field(default=None, metadata=config(exclude=lambda x: x is None)) constant: bool = True # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:Parameter/" + str(uuid4()), + default_factory=lambda: "enzml:Parameter/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: [ + default_factory = lambda: [ "enzml:Parameter", ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": { "@id": "schema:identifier", "@type": "@id", }, - }, + } ) @@ -719,36 +729,28 @@ class Parameter: class Measurement: name: str species_data: List[MeasurementData] = field(default_factory=list) - group_id: Optional[str] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - ph: Optional[float] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - temperature: Optional[float] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - temperature_unit: Optional[UnitDefinition] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) + group_id: Optional[str] = field(default=None, metadata=config(exclude=lambda x: x is None)) + ph: Optional[float] = field(default=None, metadata=config(exclude=lambda x: x is None)) + temperature: Optional[float] = field(default=None, metadata=config(exclude=lambda x: x is None)) + temperature_unit: Optional[UnitDefinition] = field(default=None, metadata=config(exclude=lambda x: x is None)) # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:Measurement/" + str(uuid4()), + default_factory=lambda: "enzml:Measurement/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: [ + default_factory = lambda: [ "enzml:Measurement", ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": { "@id": "schema:identifier", "@type": "@id", @@ -756,38 +758,41 @@ class Measurement: "group_id": { "@type": "@id", }, - }, + } ) + def add_to_species_data( self, species_id: str, initial: float, data_unit: UnitDefinition, - time_unit: UnitDefinition, data_type: DataTypes, - prepared: Optional[float] = None, - data: list[float] = [], - time: list[float] = [], - is_simulated: bool = False, + prepared: Optional[float]= None, + data: list[float]= [], + time: list[float]= [], + time_unit: Optional[UnitDefinition]= None, + is_simulated: bool= False, **kwargs, ): params = { "species_id": species_id, "initial": initial, "data_unit": data_unit, - "time_unit": time_unit, "data_type": data_type, "prepared": prepared, "data": data, "time": time, - "is_simulated": is_simulated, + "time_unit": time_unit, + "is_simulated": is_simulated } if "id" in kwargs: params["id"] = kwargs["id"] - self.species_data.append(MeasurementData(**params)) + self.species_data.append( + MeasurementData(**params) + ) return self.species_data[-1] @@ -798,120 +803,114 @@ class MeasurementData: species_id: str initial: float data_unit: UnitDefinition - time_unit: UnitDefinition data_type: DataTypes - prepared: Optional[float] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) + prepared: Optional[float] = field(default=None, metadata=config(exclude=lambda x: x is None)) data: List[float] = field(default_factory=list) time: List[float] = field(default_factory=list) + time_unit: Optional[UnitDefinition] = field(default=None, metadata=config(exclude=lambda x: x is None)) is_simulated: bool = False # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:MeasurementData/" + str(uuid4()), + default_factory=lambda: "enzml:MeasurementData/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: [ + default_factory = lambda: [ "enzml:MeasurementData", ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "species_id": { "@type": "@id", }, - }, + } ) @dataclass_json @dataclass class UnitDefinition: - name: Optional[str] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) + name: Optional[str] = field(default=None, metadata=config(exclude=lambda x: x is None)) base_units: List[BaseUnit] = field(default_factory=list) # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:UnitDefinition/" + str(uuid4()), + default_factory=lambda: "enzml:UnitDefinition/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: [ + default_factory = lambda: [ "enzml:UnitDefinition", ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", - }, + "schema": "https://schema.org/", + } ) + def add_to_base_units( self, kind: UnitType, exponent: int, - multiplier: Optional[float] = None, - scale: Optional[float] = None, + multiplier: Optional[float]= None, + scale: Optional[float]= None, **kwargs, ): params = { "kind": kind, "exponent": exponent, "multiplier": multiplier, - "scale": scale, + "scale": scale } if "id" in kwargs: params["id"] = kwargs["id"] - self.base_units.append(BaseUnit(**params)) + self.base_units.append( + BaseUnit(**params) + ) return self.base_units[-1] - @dataclass_json @dataclass class BaseUnit: kind: UnitType exponent: int - multiplier: Optional[float] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) - scale: Optional[float] = field( - default=None, metadata=config(exclude=lambda x: x is None) - ) + multiplier: Optional[float] = field(default=None, metadata=config(exclude=lambda x: x is None)) + scale: Optional[float] = field(default=None, metadata=config(exclude=lambda x: x is None)) # JSON-LD fields id: str = field( metadata=config(field_name="@id"), - default_factory=lambda: "enzml:BaseUnit/" + str(uuid4()), + default_factory=lambda: "enzml:BaseUnit/" + str(uuid4()) ) __type__: list[str] = field( metadata=config(field_name="@type"), - default_factory=lambda: [ + default_factory = lambda: [ "enzml:BaseUnit", ], ) __context__: dict[str, str | dict] = field( metadata=config(field_name="@context"), - default_factory=lambda: { + default_factory = lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", - }, + "schema": "https://schema.org/", + } ) @@ -921,7 +920,6 @@ class EquationType(Enum): ODE = "ode" RATE_LAW = "rateLaw" - class DataTypes(Enum): ABSORBANCE = "http://purl.allotrope.org/ontologies/quality#AFQ_0000061" CONCENTRATION = "http://purl.obolibrary.org/obo/PATO_0000033" @@ -930,7 +928,6 @@ class DataTypes(Enum): PEAK_AREA = "http://purl.allotrope.org/ontologies/result#AFR_0001073" TRANSMITTANCE = "http://purl.allotrope.org/ontologies/result#AFR_0002261" - class UnitType(Enum): AMPERE = "ampere" AVOGADRO = "avogadro" @@ -965,4 +962,4 @@ class UnitType(Enum): TESLA = "tesla" VOLT = "volt" WATT = "watt" - WEBER = "weber" + WEBER = "weber" \ No newline at end of file diff --git a/python/pyenzyme/pydantic_models.py b/python/pyenzyme/pydantic_models.py index f5784ba..314e63b 100644 --- a/python/pyenzyme/pydantic_models.py +++ b/python/pyenzyme/pydantic_models.py @@ -1,11 +1,12 @@ ## This is a generated file. Do not modify it manually! from __future__ import annotations -from pydantic import BaseModel, Field, ConfigDict -from typing import Optional, Generic, TypeVar + from enum import Enum +from typing import Generic, Optional, TypeVar from uuid import uuid4 -from datetime import date, datetime + +from pydantic import BaseModel, ConfigDict, Field # Filter Wrapper definition used to filter a list of objects # based on their attributes @@ -105,8 +106,8 @@ class EnzymeMLDocument(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "name": "schema:title", "references": { "@id": "schema:citation", @@ -548,8 +549,8 @@ class Creator(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "given_name": "schema:givenName", "family_name": "schema:familyName", "mail": "schema:email", @@ -646,8 +647,8 @@ class Vessel(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": { "@id": "schema:identifier", "@type": "@id", @@ -751,8 +752,8 @@ class Protein(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": { "@type": "@id", }, @@ -864,8 +865,8 @@ class Complex(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": { "@id": "schema:identifier", "@type": "@id", @@ -972,8 +973,8 @@ class SmallMolecule(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": { "@id": "schema:identifier", "@type": "@id", @@ -1083,8 +1084,8 @@ class Reaction(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": { "@id": "schema:identifier", "@type": "@id", @@ -1211,8 +1212,8 @@ class ReactionElement(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "species_id": { "@type": "@id", }, @@ -1310,8 +1311,8 @@ class Equation(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "species_id": { "@type": "@id", }, @@ -1436,8 +1437,8 @@ class Variable(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": "schema:identifier", }, ) @@ -1539,8 +1540,8 @@ class Parameter(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": { "@id": "schema:identifier", "@type": "@id", @@ -1642,8 +1643,8 @@ class Measurement(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "id": { "@id": "schema:identifier", "@type": "@id", @@ -1736,11 +1737,11 @@ def add_to_species_data( species_id: str, initial: float, data_unit: UnitDefinition, - time_unit: UnitDefinition, data_type: DataTypes, prepared: Optional[float] = None, data: list[float] = [], time: list[float] = [], + time_unit: Optional[UnitDefinition] = None, is_simulated: bool = False, **kwargs, ): @@ -1748,11 +1749,11 @@ def add_to_species_data( "species_id": species_id, "initial": initial, "data_unit": data_unit, - "time_unit": time_unit, "data_type": data_type, "prepared": prepared, "data": data, "time": time, + "time_unit": time_unit, "is_simulated": is_simulated, } @@ -1772,11 +1773,11 @@ class MeasurementData(BaseModel): species_id: str initial: float data_unit: UnitDefinition - time_unit: UnitDefinition data_type: DataTypes prepared: Optional[float] = Field(default=None) data: list[float] = Field(default_factory=list) time: list[float] = Field(default_factory=list) + time_unit: Optional[UnitDefinition] = Field(default=None) is_simulated: bool = False # JSON-LD fields @@ -1794,8 +1795,8 @@ class MeasurementData(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", "species_id": { "@type": "@id", }, @@ -1892,8 +1893,8 @@ class UnitDefinition(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", }, ) @@ -2022,8 +2023,8 @@ class BaseUnit(BaseModel): serialization_alias="@context", default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", - "schema": "https://schema.org/", "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", }, ) diff --git a/schemes/enzymeml.json b/schemes/enzymeml.json index 6d86f9e..ab92a95 100644 --- a/schemes/enzymeml.json +++ b/schemes/enzymeml.json @@ -88,6 +88,92 @@ }, "description": "This is the root object that composes all objects found in an EnzymeML document. It also includes general metadata such as the name of the document, when it was created/modified, and references to publications, databases, and arbitrary links to the web.", "definitions": { + "Parameter": { + "title": "Parameter", + "type": "object", + "properties": { + "id": { + "title": "id", + "description": "Unique identifier of the parameter.", + "term": "schema:identifier", + "type": "string" + }, + "name": { + "title": "name", + "description": "Name of the parameter.", + "type": "string" + }, + "symbol": { + "title": "symbol", + "description": "Symbol of the parameter.", + "type": "string" + }, + "value": { + "title": "value", + "description": "Numerical value of the estimated parameter.", + "type": "number" + }, + "unit": { + "$ref": "#/definitions/UnitDefinition" + }, + "initial_value": { + "title": "initial_value", + "description": "Initial value that was used for the parameter estimation.", + "type": "number" + }, + "upper": { + "title": "upper", + "description": "Upper bound of the estimated parameter.", + "type": "number" + }, + "lower": { + "title": "lower", + "description": "Lower bound of the estimated parameter.", + "type": "number" + }, + "stderr": { + "title": "stderr", + "description": "Standard error of the estimated parameter.", + "type": "number" + }, + "constant": { + "title": "constant", + "description": "Specifies if this parameter is constant", + "type": "boolean" + } + }, + "description": "This object describes the parameters of the kinetic model and can include all estimated values." + }, + "Complex": { + "title": "Complex", + "type": "object", + "properties": { + "id": { + "title": "id", + "description": "Unique identifier of the complex.", + "term": "schema:identifier", + "type": "string" + }, + "name": { + "title": "name", + "term": "schema:name", + "type": "string" + }, + "constant": { + "title": "constant", + "type": "boolean" + }, + "participants": { + "title": "participants", + "description": "Array of IDs the complex contains", + "type": "array", + "items": { + "type": "string" + } + } + }, + "description": "This object describes complexes made of reactants and/or proteins that were used or produced in the course of the experiment." + }, "SmallMolecule": { "title": "SmallMolecule", "type": "object", @@ -140,6 +226,59 @@ }, "description": "This object describes the reactants that were used or produced in the course of the experiment." }, + "Equation": { + "title": "Equation", + "type": "object", + "properties": { + "species_id": { + "title": "species_id", + "description": "Internal identifier to a species defined in the EnzymeMLDocument, given it is a rate equation.", + "type": "string" + }, + "equation": { + "title": "equation", + "description": "Mathematical expression of the equation.", + "type": "string" + }, + "equation_type": { + "title": "equation_type", + "$ref": "#/definitions/EquationType" + }, + "variables": { + "type": "array", + "items": { + "$ref": "#/definitions/Variable" + } + } + }, + "description": "This object describes an equation that can be used to model the kinetics of a reaction. There are different types of equations that can be used to model the kinetics of a reaction. The equation can be an ordinary differential equation, a rate law or assignment rule." + }, + "Creator": { + "title": "Creator", + "type": "object", + "properties": { + "given_name": { + "title": "given_name", + "description": "Given name of the author or contributor.", + "term": "schema:givenName", + "type": "string" + }, + "family_name": { + "title": "family_name", + "description": "Family name of the author or contributor.", + "term": "schema:familyName", + "type": "string" + }, + "mail": { + "title": "mail", + "description": "Email address of the author or contributor.", + "term": "schema:email", + "type": "string" + } + }, + "description": "The creator object contains all information about authors that contributed to the resulting document.", + "term": "schema:person" + }, "Measurement": { "title": "Measurement", "type": "object", @@ -184,32 +323,6 @@ }, "description": "This object describes the result of a measurement, which includes time course data of any type defined in DataTypes. It includes initial concentrations of all species used in a single measurement." }, - "Creator": { - "title": "Creator", - "type": "object", - "properties": { - "given_name": { - "title": "given_name", - "description": "Given name of the author or contributor.", - "term": "schema:givenName", - "type": "string" - }, - "family_name": { - "title": "family_name", - "description": "Family name of the author or contributor.", - "term": "schema:familyName", - "type": "string" - }, - "mail": { - "title": "mail", - "description": "Email address of the author or contributor.", - "term": "schema:email", - "type": "string" - } - }, - "description": "The creator object contains all information about authors that contributed to the resulting document.", - "term": "schema:person" - }, "Vessel": { "title": "Vessel", "type": "object", @@ -244,6 +357,46 @@ "description": "This object describes vessels in which the experiment has been carried out. These can include any type of vessel used in biocatalytic experiments.", "term": "OBO:OBI_0400081" }, + "Reaction": { + "title": "Reaction", + "type": "object", + "properties": { + "id": { + "title": "id", + "description": "Unique identifier of the reaction.", + "term": "schema:identifier", + "type": "string" + }, + "name": { + "title": "name", + "description": "Name of the reaction.", + "type": "string" + }, + "reversible": { + "title": "reversible", + "description": "Whether the reaction is reversible or irreversible", + "type": "boolean" + }, + "kinetic_law": { + "$ref": "#/definitions/Equation" + }, + "species": { + "type": "array", + "items": { + "$ref": "#/definitions/ReactionElement" + } + }, + "modifiers": { + "title": "modifiers", + "description": "List of reaction elements that are not part of the reaction but influence it.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "description": "This object describes a chemical or enzymatic reaction that was investigated in the course of the experiment. All species used within this object need to be part of the data model." + }, "Protein": { "title": "Protein", "type": "object", @@ -303,159 +456,6 @@ }, "description": "This object describes the proteins that were used or formed throughout the experiment.", "term": "schema:Protein" - }, - "Equation": { - "title": "Equation", - "type": "object", - "properties": { - "species_id": { - "title": "species_id", - "description": "Internal identifier to a species defined in the EnzymeMLDocument, given it is a rate equation.", - "type": "string" - }, - "equation": { - "title": "equation", - "description": "Mathematical expression of the equation.", - "type": "string" - }, - "equation_type": { - "title": "equation_type", - "$ref": "#/definitions/EquationType" - }, - "variables": { - "type": "array", - "items": { - "$ref": "#/definitions/Variable" - } - } - }, - "description": "This object describes an equation that can be used to model the kinetics of a reaction. There are different types of equations that can be used to model the kinetics of a reaction. The equation can be an ordinary differential equation, a rate law or assignment rule." - }, - "Complex": { - "title": "Complex", - "type": "object", - "properties": { - "id": { - "title": "id", - "description": "Unique identifier of the complex.", - "term": "schema:identifier", - "type": "string" - }, - "name": { - "title": "name", - "term": "schema:name", - "type": "string" - }, - "constant": { - "title": "constant", - "type": "boolean" - }, - "participants": { - "title": "participants", - "description": "Array of IDs the complex contains", - "type": "array", - "items": { - "type": "string" - } - } - }, - "description": "This object describes complexes made of reactants and/or proteins that were used or produced in the course of the experiment." - }, - "Reaction": { - "title": "Reaction", - "type": "object", - "properties": { - "id": { - "title": "id", - "description": "Unique identifier of the reaction.", - "term": "schema:identifier", - "type": "string" - }, - "name": { - "title": "name", - "description": "Name of the reaction.", - "type": "string" - }, - "reversible": { - "title": "reversible", - "description": "Whether the reaction is reversible or irreversible", - "type": "boolean" - }, - "kinetic_law": { - "$ref": "#/definitions/Equation" - }, - "species": { - "type": "array", - "items": { - "$ref": "#/definitions/ReactionElement" - } - }, - "modifiers": { - "title": "modifiers", - "description": "List of reaction elements that are not part of the reaction but influence it.", - "type": "array", - "items": { - "type": "string" - } - } - }, - "description": "This object describes a chemical or enzymatic reaction that was investigated in the course of the experiment. All species used within this object need to be part of the data model." - }, - "Parameter": { - "title": "Parameter", - "type": "object", - "properties": { - "id": { - "title": "id", - "description": "Unique identifier of the parameter.", - "term": "schema:identifier", - "type": "string" - }, - "name": { - "title": "name", - "description": "Name of the parameter.", - "type": "string" - }, - "symbol": { - "title": "symbol", - "description": "Symbol of the parameter.", - "type": "string" - }, - "value": { - "title": "value", - "description": "Numerical value of the estimated parameter.", - "type": "number" - }, - "unit": { - "$ref": "#/definitions/UnitDefinition" - }, - "initial_value": { - "title": "initial_value", - "description": "Initial value that was used for the parameter estimation.", - "type": "number" - }, - "upper": { - "title": "upper", - "description": "Upper bound of the estimated parameter.", - "type": "number" - }, - "lower": { - "title": "lower", - "description": "Lower bound of the estimated parameter.", - "type": "number" - }, - "stderr": { - "title": "stderr", - "description": "Standard error of the estimated parameter.", - "type": "number" - }, - "constant": { - "title": "constant", - "description": "Specifies if this parameter is constant", - "type": "boolean" - } - }, - "description": "This object describes the parameters of the kinetic model and can include all estimated values." } } } \ No newline at end of file diff --git a/schemes/enzymeml.xsd b/schemes/enzymeml.xsd index c847052..c19383a 100644 --- a/schemes/enzymeml.xsd +++ b/schemes/enzymeml.xsd @@ -656,13 +656,6 @@ - - - - Time unit of the replicate. - - - @@ -677,20 +670,27 @@ - + Data that was measured. - + Time steps of the replicate. + + + + Time unit of the replicate. + + + diff --git a/specifications/enzymeml.md b/specifications/enzymeml.md index 5568eaf..0b2a0e7 100644 --- a/specifications/enzymeml.md +++ b/specifications/enzymeml.md @@ -351,22 +351,22 @@ This object describes a single entity of a measurement, which corresponds to one - __data_unit__ - Type: UnitDefinition - Description: SI unit of the data that was measured. -- __data__ +- data - Type: float[] - Description: Data that was measured. -- __time__ +- time - Type: float[] - Description: Time steps of the replicate. -- __time_unit__ +- time_unit - Type: UnitDefinition - Description: Time unit of the replicate. +- __data_type__ + - Type: DataTypes + - Description: Type of data that was measured (e.g. concentration) - __is_simulated__ - Type: boolean - Description: Whether or not the data has been generated by simulation. - Default: False -- __data_type__ - - Type: DataTypes - - Description: Type of data that was measured (e.g. concentration) ## Enumerations diff --git a/typescript/src/index.ts b/typescript/src/index.ts index f262ab1..53f6097 100644 --- a/typescript/src/index.ts +++ b/typescript/src/index.ts @@ -416,24 +416,24 @@ export const MeasurementCodec = D.lazy("Measurement", () => D.struct({ * @param initial - Initial amount of the measurement data. This must be the same as the first data point in the * @param data_unit - SI unit of the data that was measured. - * @param time_unit - Time unit of the replicate. * @param data_type - Type of data that was measured (e.g. concentration) * @param prepared - Amount of the reactant before the measurement. This field should be used for specifying the prepared amount of a species in the reaction mix. Not to be confused with * @param data - Data that was measured. * @param time - Time steps of the replicate. + * @param time_unit - Time unit of the replicate. * @param is_simulated - Whether or not the data has been generated by simulation. **/ export interface MeasurementData extends JsonLd { species_id: string; initial: number; data_unit: UnitDefinition; - time_unit: UnitDefinition; data_type: DataTypes; prepared?: number | null; - data: number[]; - time: number[]; + data?: number[] | null; + time?: number[] | null; + time_unit?: UnitDefinition | null; is_simulated: boolean; } @@ -441,11 +441,11 @@ export const MeasurementDataCodec = D.lazy("MeasurementData", () => D.struct({ species_id: D.string, initial: D.number, data_unit: UnitDefinitionCodec, - time_unit: UnitDefinitionCodec, data_type: DataTypesCodec, prepared: D.nullable(D.number), data: D.array(D.number), time: D.array(D.number), + time_unit: D.nullable(UnitDefinitionCodec), is_simulated: D.boolean, }));