diff --git a/tests/fixtures/sbml/ode_example_enzml.json b/tests/fixtures/sbml/ode_example_enzml.json index 57a2b6e3..ca2dca0b 100644 --- a/tests/fixtures/sbml/ode_example_enzml.json +++ b/tests/fixtures/sbml/ode_example_enzml.json @@ -12,7 +12,7 @@ "modified": "schema:dateModified", "creators": "schema:creator" }, - "@id": "enzml:EnzymeMLDocument/44649453-a157-4cb7-be07-8fb09a82f4ca", + "@id": "enzml:EnzymeMLDocument/833d46aa-58c7-4d42-b341-43f1fe0fece0", "@type": [ "enzml:EnzymeMLDocument" ], @@ -32,7 +32,7 @@ "name": "schema:name", "volume": "OBO:OBI_0002139" }, - "@id": "enzml:Vessel/02063116-73f1-4ba1-b166-8fe835e55659", + "@id": "enzml:Vessel/abc02182-675a-4fd7-b067-9f376f17b874", "@type": [ "enzml:Vessel", "OBO:OBI_0400081" @@ -59,7 +59,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/efd21ea0-af02-4920-9036-9c8337cf0421", + "@id": "enzml:BaseUnit/7ea9c0d4-dcbb-4e59-94f2-7b1779e35b1b", "@type": [ "enzml:BaseUnit" ], @@ -96,7 +96,7 @@ "@type": "@id" } }, - "@id": "enzml:Protein/cf3097ad-5833-4ff8-99f1-784cd5f673ca", + "@id": "enzml:Protein/487be0d2-e325-4f0b-857b-3bd8d54c4003", "@type": [ "enzml:Protein", "schema:Protein" @@ -127,7 +127,7 @@ "@type": "@id" } }, - "@id": "enzml:Complex/fa79ccd6-acbe-47e4-a8d1-795eb18346db", + "@id": "enzml:Complex/2f52086d-d7a8-4a2d-870b-bd6bafd91504", "@type": [ "enzml:Complex" ], @@ -160,7 +160,7 @@ "@type": "@id" } }, - "@id": "enzml:SmallMolecule/5375d6fb-6246-43b0-bc81-d47e3e72493f", + "@id": "enzml:SmallMolecule/551e35d3-ae18-490d-b4a7-003fcd28f446", "@type": [ "enzml:SmallMolecule" ], @@ -191,7 +191,7 @@ "@type": "@id" } }, - "@id": "enzml:SmallMolecule/c7318d93-2a0f-44c0-9ebe-a79fc27bf01e", + "@id": "enzml:SmallMolecule/1a93b3f8-ce94-429d-975b-ff6a837b0424", "@type": [ "enzml:SmallMolecule" ], @@ -219,7 +219,7 @@ "@type": "@id" } }, - "@id": "enzml:Measurement/ef303c49-7554-4367-9f44-cb6e9838c1be", + "@id": "enzml:Measurement/83db3a41-626e-461b-80d2-9618997c6af3", "@type": [ "enzml:Measurement" ], @@ -235,7 +235,7 @@ "@type": "@id" } }, - "@id": "enzml:MeasurementData/3beaeb28-72a4-4398-ae34-c9208c03aa0b", + "@id": "enzml:MeasurementData/a1e71511-2b64-40af-a50f-7ede47b45baa", "@type": [ "enzml:MeasurementData" ], @@ -260,7 +260,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/cff3e0ad-ce88-479a-8c01-b06e012e3195", + "@id": "enzml:BaseUnit/0a98675d-d6e6-4551-8f2a-90483c57936d", "@type": [ "enzml:BaseUnit" ], @@ -274,7 +274,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/df1eed89-6a35-483e-a187-b981d9ee0405", + "@id": "enzml:BaseUnit/335f309c-13e0-4eb8-9765-3945a8683f7f", "@type": [ "enzml:BaseUnit" ], @@ -303,12 +303,12 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/634613e6-a06f-42e9-9e11-b32c3e6f6f09", + "@id": "enzml:BaseUnit/4e3a6a14-ca74-4c8a-b00f-45a3cfea6e11", "@type": [ "enzml:BaseUnit" ], "kind": "second", - "exponent": -1, + "exponent": 1, "scale": 1.0 } ] @@ -351,7 +351,7 @@ "@type": "@id" } }, - "@id": "enzml:MeasurementData/00c0dabc-47cc-40d5-a4d5-7809880aad52", + "@id": "enzml:MeasurementData/9de1a9fe-ede0-4e0b-a8cc-84e8dce6cb57", "@type": [ "enzml:MeasurementData" ], @@ -376,7 +376,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/cff3e0ad-ce88-479a-8c01-b06e012e3195", + "@id": "enzml:BaseUnit/0a98675d-d6e6-4551-8f2a-90483c57936d", "@type": [ "enzml:BaseUnit" ], @@ -390,7 +390,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/df1eed89-6a35-483e-a187-b981d9ee0405", + "@id": "enzml:BaseUnit/335f309c-13e0-4eb8-9765-3945a8683f7f", "@type": [ "enzml:BaseUnit" ], @@ -419,12 +419,12 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/634613e6-a06f-42e9-9e11-b32c3e6f6f09", + "@id": "enzml:BaseUnit/4e3a6a14-ca74-4c8a-b00f-45a3cfea6e11", "@type": [ "enzml:BaseUnit" ], "kind": "second", - "exponent": -1, + "exponent": 1, "scale": 1.0 } ] @@ -480,7 +480,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/83915bc7-e2b4-450f-b363-20eb027d1f3d", + "@id": "enzml:BaseUnit/31d5028b-2d30-4053-87e7-00b42a40b165", "@type": [ "enzml:BaseUnit" ], @@ -504,7 +504,7 @@ "@type": "@id" } }, - "@id": "enzml:Measurement/28bb1de1-4cd9-45e2-b160-3a2dd5ce3e34", + "@id": "enzml:Measurement/f7603279-9db3-4039-b501-97fee1f05c4b", "@type": [ "enzml:Measurement" ], @@ -520,7 +520,7 @@ "@type": "@id" } }, - "@id": "enzml:MeasurementData/24b00355-6bad-4771-a0e5-e65c7560b3a9", + "@id": "enzml:MeasurementData/f8d7f530-1f92-4cd7-b460-54b9cb03678b", "@type": [ "enzml:MeasurementData" ], @@ -545,7 +545,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/cff3e0ad-ce88-479a-8c01-b06e012e3195", + "@id": "enzml:BaseUnit/0a98675d-d6e6-4551-8f2a-90483c57936d", "@type": [ "enzml:BaseUnit" ], @@ -559,7 +559,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/df1eed89-6a35-483e-a187-b981d9ee0405", + "@id": "enzml:BaseUnit/335f309c-13e0-4eb8-9765-3945a8683f7f", "@type": [ "enzml:BaseUnit" ], @@ -588,12 +588,12 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/634613e6-a06f-42e9-9e11-b32c3e6f6f09", + "@id": "enzml:BaseUnit/4e3a6a14-ca74-4c8a-b00f-45a3cfea6e11", "@type": [ "enzml:BaseUnit" ], "kind": "second", - "exponent": -1, + "exponent": 1, "scale": 1.0 } ] @@ -636,7 +636,7 @@ "@type": "@id" } }, - "@id": "enzml:MeasurementData/405dfbaf-cc21-41d4-836d-fdadc1d0c1b3", + "@id": "enzml:MeasurementData/828564ec-ec24-42c2-98b2-115fdc1f2a3c", "@type": [ "enzml:MeasurementData" ], @@ -661,7 +661,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/cff3e0ad-ce88-479a-8c01-b06e012e3195", + "@id": "enzml:BaseUnit/0a98675d-d6e6-4551-8f2a-90483c57936d", "@type": [ "enzml:BaseUnit" ], @@ -675,7 +675,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/df1eed89-6a35-483e-a187-b981d9ee0405", + "@id": "enzml:BaseUnit/335f309c-13e0-4eb8-9765-3945a8683f7f", "@type": [ "enzml:BaseUnit" ], @@ -704,12 +704,12 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/634613e6-a06f-42e9-9e11-b32c3e6f6f09", + "@id": "enzml:BaseUnit/4e3a6a14-ca74-4c8a-b00f-45a3cfea6e11", "@type": [ "enzml:BaseUnit" ], "kind": "second", - "exponent": -1, + "exponent": 1, "scale": 1.0 } ] @@ -765,7 +765,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/83915bc7-e2b4-450f-b363-20eb027d1f3d", + "@id": "enzml:BaseUnit/31d5028b-2d30-4053-87e7-00b42a40b165", "@type": [ "enzml:BaseUnit" ], @@ -787,23 +787,80 @@ "@type": "@id" } }, - "@id": "enzml:Equation/87c7fc6d-6933-42be-a33a-c8eecb5901b7", + "@id": "enzml:Equation/69aec529-07bc-447a-8169-a20dc623c81a", "@type": [ "enzml:Equation" ], - "equation": "E_tot*kcat*s0/(K_m + s0)", + "equation": "E_tot * kcat * s0 / (K_m + s0)", + "equation_type": "ode", + "species_id": "s1", + "variables": [ + { + "@context": { + "enzml": "http://www.enzymeml.org/v2/", + "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", + "id": "schema:identifier" + }, + "@id": "enzml:Variable/b4d171e6-c5ee-416b-859f-6560c5f18b5d", + "@type": [ + "enzml:Variable" + ], + "id": "s0", + "name": "s0", + "symbol": "s0" + } + ] + }, + { + "@context": { + "enzml": "http://www.enzymeml.org/v2/", + "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", + "species_id": { + "@type": "@id" + } + }, + "@id": "enzml:Equation/e1e66a46-8111-4003-9eeb-f163081c2e96", + "@type": [ + "enzml:Equation" + ], + "equation": "100", + "equation_type": "initialAssignment", + "species_id": "E_tot", + "variables": [] + } + ], + "parameters": [ + { + "@context": { + "enzml": "http://www.enzymeml.org/v2/", + "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", + "id": { + "@id": "schema:identifier", + "@type": "@id" + } + }, + "@id": "enzml:Parameter/2872b6d6-191f-4bc4-a36a-130eb4534837", + "@type": [ + "enzml:Parameter" + ], + "id": "kcat", + "name": "kcat", + "symbol": "kcat", "unit": { "@context": { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "OBO:UO_0000063", + "@id": "OBO:UO_0000010", "@type": [ "OBO:UO_0000000" ], "id": "u4", - "name": "mmol / l s", + "name": "1 / s", "base_units": [ { "@context": { @@ -811,35 +868,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/cff3e0ad-ce88-479a-8c01-b06e012e3195", - "@type": [ - "enzml:BaseUnit" - ], - "kind": "mole", - "exponent": 1, - "scale": -3.0 - }, - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "enzml:BaseUnit/df1eed89-6a35-483e-a187-b981d9ee0405", - "@type": [ - "enzml:BaseUnit" - ], - "kind": "litre", - "exponent": -1, - "scale": 1.0 - }, - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "enzml:BaseUnit/634613e6-a06f-42e9-9e11-b32c3e6f6f09", + "@id": "enzml:BaseUnit/4e3a6a14-ca74-4c8a-b00f-45a3cfea6e11", "@type": [ "enzml:BaseUnit" ], @@ -849,223 +878,93 @@ } ] }, - "equation_type": "ode", - "species_id": "s1", - "variables": [ - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/", - "id": "schema:identifier" - }, - "@id": "enzml:Variable/49c819d7-0f8a-4d2e-9a82-09cf62d48aad", - "@type": [ - "enzml:Variable" - ], - "id": "s0", - "name": "s0", - "symbol": "s0" + "upper": 100.0, + "lower": 0.0, + "stderr": 0.1, + "constant": true + }, + { + "@context": { + "enzml": "http://www.enzymeml.org/v2/", + "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", + "id": { + "@id": "schema:identifier", + "@type": "@id" } + }, + "@id": "enzml:Parameter/31e315d7-8e87-4ef9-9ca4-1e9e08f2ded7", + "@type": [ + "enzml:Parameter" ], - "parameters": [ - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/", - "id": { - "@id": "schema:identifier", - "@type": "@id" - } - }, - "@id": "enzml:Parameter/404206dc-7e11-432e-b1a8-871b822325ef", - "@type": [ - "enzml:Parameter" - ], - "id": "kcat", - "name": "kcat", - "symbol": "kcat", - "unit": { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "OBO:UO_0000010", - "@type": [ - "OBO:UO_0000000" - ], - "id": "u5", - "name": "1 / s", - "base_units": [ - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "enzml:BaseUnit/634613e6-a06f-42e9-9e11-b32c3e6f6f09", - "@type": [ - "enzml:BaseUnit" - ], - "kind": "second", - "exponent": -1, - "scale": 1.0 - } - ] - }, - "upper": 100.0, - "lower": 0.0, - "stderr": 0.1, - "constant": true + "id": "K_m", + "name": "K_m", + "symbol": "K_m", + "unit": { + "@context": { + "enzml": "http://www.enzymeml.org/v2/", + "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/" }, - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/", - "id": { - "@id": "schema:identifier", - "@type": "@id" - } - }, - "@id": "enzml:Parameter/a5b7ca60-4945-4cfe-9eb9-6c97dfdaa770", - "@type": [ - "enzml:Parameter" - ], - "id": "K_m", - "name": "K_m", - "symbol": "K_m", - "unit": { + "@id": "OBO:UO_0000063", + "@type": [ + "OBO:UO_0000000" + ], + "id": "u2", + "name": "mmol / l", + "base_units": [ + { "@context": { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "OBO:UO_0000063", + "@id": "enzml:BaseUnit/0a98675d-d6e6-4551-8f2a-90483c57936d", "@type": [ - "OBO:UO_0000000" + "enzml:BaseUnit" ], - "id": "u2", - "name": "mmol / l", - "base_units": [ - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "enzml:BaseUnit/cff3e0ad-ce88-479a-8c01-b06e012e3195", - "@type": [ - "enzml:BaseUnit" - ], - "kind": "mole", - "exponent": 1, - "scale": -3.0 - }, - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "enzml:BaseUnit/df1eed89-6a35-483e-a187-b981d9ee0405", - "@type": [ - "enzml:BaseUnit" - ], - "kind": "litre", - "exponent": -1, - "scale": 1.0 - } - ] - }, - "upper": 100.0, - "lower": 0.0, - "stderr": 0.1, - "constant": true - }, - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/", - "id": { - "@id": "schema:identifier", - "@type": "@id" - } + "kind": "mole", + "exponent": 1, + "scale": -3.0 }, - "@id": "enzml:Parameter/26b501d3-7200-4813-ac11-b62f0f665054", - "@type": [ - "enzml:Parameter" - ], - "id": "E_tot", - "name": "E_tot", - "symbol": "E_tot", - "unit": { + { "@context": { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "OBO:UO_0000063", + "@id": "enzml:BaseUnit/335f309c-13e0-4eb8-9765-3945a8683f7f", "@type": [ - "OBO:UO_0000000" + "enzml:BaseUnit" ], - "id": "u2", - "name": "mmol / l", - "base_units": [ - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "enzml:BaseUnit/cff3e0ad-ce88-479a-8c01-b06e012e3195", - "@type": [ - "enzml:BaseUnit" - ], - "kind": "mole", - "exponent": 1, - "scale": -3.0 - }, - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "enzml:BaseUnit/df1eed89-6a35-483e-a187-b981d9ee0405", - "@type": [ - "enzml:BaseUnit" - ], - "kind": "litre", - "exponent": -1, - "scale": 1.0 - } - ] - }, - "upper": 100.0, - "lower": 0.0, - "stderr": 0.1, - "constant": true - } - ] + "kind": "litre", + "exponent": -1, + "scale": 1.0 + } + ] + }, + "upper": 100.0, + "lower": 0.0, + "stderr": 0.1, + "constant": true }, { "@context": { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", - "species_id": { + "id": { + "@id": "schema:identifier", "@type": "@id" } }, - "@id": "enzml:Equation/3991effb-6394-4b6d-baa8-a06462e2101f", + "@id": "enzml:Parameter/d49325e0-8483-469a-9d6d-1bcadac2bb98", "@type": [ - "enzml:Equation" + "enzml:Parameter" ], - "equation": "100", + "id": "E_tot", + "name": "E_tot", + "symbol": "E_tot", "unit": { "@context": { "enzml": "http://www.enzymeml.org/v2/", @@ -1085,7 +984,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/cff3e0ad-ce88-479a-8c01-b06e012e3195", + "@id": "enzml:BaseUnit/0a98675d-d6e6-4551-8f2a-90483c57936d", "@type": [ "enzml:BaseUnit" ], @@ -1099,7 +998,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/df1eed89-6a35-483e-a187-b981d9ee0405", + "@id": "enzml:BaseUnit/335f309c-13e0-4eb8-9765-3945a8683f7f", "@type": [ "enzml:BaseUnit" ], @@ -1109,10 +1008,10 @@ } ] }, - "equation_type": "initialAssignment", - "species_id": "E_tot", - "variables": [], - "parameters": [] + "upper": 100.0, + "lower": 0.0, + "stderr": 0.1, + "constant": true } ] } \ No newline at end of file diff --git a/tests/fixtures/sbml/ode_example_sbml.xml b/tests/fixtures/sbml/ode_example_sbml.xml index 7d4ca6b1..dc3baf8c 100644 --- a/tests/fixtures/sbml/ode_example_sbml.xml +++ b/tests/fixtures/sbml/ode_example_sbml.xml @@ -2,22 +2,22 @@ - + - - + + - - + + @@ -56,7 +56,7 @@ - + @@ -71,21 +71,7 @@ - - - - - - - - - - - - - - - + @@ -104,7 +90,7 @@ + rdf:about="http://www.enzymeml.org/v2/Vessel/abc02182-675a-4fd7-b067-9f376f17b874"> Vessel 1 10.0 @@ -121,7 +107,7 @@ + rdf:about="http://www.enzymeml.org/v2/Protein/487be0d2-e325-4f0b-857b-3bd8d54c4003"> Enzyme MTEY E.coli @@ -141,7 +127,7 @@ + rdf:about="http://www.enzymeml.org/v2/Complex/2f52086d-d7a8-4a2d-870b-bd6bafd91504"> Enzyme-Substrate Complex @@ -157,7 +143,7 @@ + rdf:about="http://www.enzymeml.org/v2/SmallMolecule/551e35d3-ae18-490d-b4a7-003fcd28f446"> Substrate @@ -173,7 +159,7 @@ + rdf:about="http://www.enzymeml.org/v2/SmallMolecule/1a93b3f8-ce94-429d-975b-ff6a837b0424"> Product @@ -186,11 +172,11 @@ - + + rdf:about="http://www.enzymeml.org/v2/Parameter/2872b6d6-191f-4bc4-a36a-130eb4534837"> @@ -205,7 +191,7 @@ + rdf:about="http://www.enzymeml.org/v2/Parameter/31e315d7-8e87-4ef9-9ca4-1e9e08f2ded7"> @@ -220,7 +206,7 @@ + rdf:about="http://www.enzymeml.org/v2/Parameter/d49325e0-8483-469a-9d6d-1bcadac2bb98"> diff --git a/tests/fixtures/sbml/odes_example.omex b/tests/fixtures/sbml/odes_example.omex new file mode 100644 index 00000000..087704de Binary files /dev/null and b/tests/fixtures/sbml/odes_example.omex differ diff --git a/tests/fixtures/sbml/reaction_example_enzml.json b/tests/fixtures/sbml/reaction_example_enzml.json index 7e01e7f9..b264df26 100644 --- a/tests/fixtures/sbml/reaction_example_enzml.json +++ b/tests/fixtures/sbml/reaction_example_enzml.json @@ -12,7 +12,7 @@ "modified": "schema:dateModified", "creators": "schema:creator" }, - "@id": "enzml:EnzymeMLDocument/b8426986-8c86-43f9-a03e-efbc1577d70a", + "@id": "enzml:EnzymeMLDocument/0dd4f410-0464-451f-ae3f-a45d11b7c181", "@type": [ "enzml:EnzymeMLDocument" ], @@ -32,7 +32,7 @@ "name": "schema:name", "volume": "OBO:OBI_0002139" }, - "@id": "enzml:Vessel/e594aa18-c317-4e87-b68f-ca7337c910d0", + "@id": "enzml:Vessel/a2ea41db-032c-4a61-a7d5-254137d0bce9", "@type": [ "enzml:Vessel", "OBO:OBI_0400081" @@ -59,7 +59,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/26d67db7-127b-4bf5-8578-dfc75ec003d8", + "@id": "enzml:BaseUnit/c64d956a-7d88-4886-8c05-8f2458178c0f", "@type": [ "enzml:BaseUnit" ], @@ -96,7 +96,7 @@ "@type": "@id" } }, - "@id": "enzml:Protein/de66507f-620a-42ee-9162-7401630cc4bc", + "@id": "enzml:Protein/42828d0d-f4ac-489b-acd5-cd74c080f340", "@type": [ "enzml:Protein", "schema:Protein" @@ -130,7 +130,7 @@ "@type": "@id" } }, - "@id": "enzml:SmallMolecule/210850a2-7071-4594-9762-d0520bd2ded6", + "@id": "enzml:SmallMolecule/e794f30d-51ea-4b89-a5d7-555bcd70efe5", "@type": [ "enzml:SmallMolecule" ], @@ -159,7 +159,7 @@ "@type": "@id" } }, - "@id": "enzml:SmallMolecule/5f11bcce-405f-4b0e-9a58-7e812c80fcc5", + "@id": "enzml:SmallMolecule/4b8a1f78-1874-447a-aee7-a80970bb1301", "@type": [ "enzml:SmallMolecule" ], @@ -184,7 +184,7 @@ "@type": "@id" } }, - "@id": "enzml:Reaction/e236d1d1-c83a-45bb-859a-51bd15cee184", + "@id": "enzml:Reaction/d62c8122-e540-441b-97b5-87ed786d61ff", "@type": [ "enzml:Reaction" ], @@ -200,68 +200,11 @@ "@type": "@id" } }, - "@id": "enzml:Equation/deb8cae4-181a-47de-b5c5-282fdabd69d6", + "@id": "enzml:Equation/f9c5b6d8-e3df-4caa-8c09-cdaf433bf964", "@type": [ "enzml:Equation" ], - "equation": "kcat*p0*s0/(K_m + s0)", - "unit": { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "OBO:UO_0000063", - "@type": [ - "OBO:UO_0000000" - ], - "id": "u1", - "name": "mmol / l s", - "base_units": [ - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "enzml:BaseUnit/801b612f-9b16-4030-bc53-20e00d9e525b", - "@type": [ - "enzml:BaseUnit" - ], - "kind": "mole", - "exponent": 1, - "scale": -3.0 - }, - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "enzml:BaseUnit/8c63ea70-d26e-45e4-beef-651da82864d0", - "@type": [ - "enzml:BaseUnit" - ], - "kind": "litre", - "exponent": -1, - "scale": 1.0 - }, - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "enzml:BaseUnit/ec7aa14e-db13-4b05-ac2a-19973ff83e5a", - "@type": [ - "enzml:BaseUnit" - ], - "kind": "second", - "exponent": -1, - "scale": 1.0 - } - ] - }, + "equation": "kcat * p0 * s0 / (K_m + s0)", "equation_type": "rateLaw", "variables": [ { @@ -271,7 +214,7 @@ "schema": "https://schema.org/", "id": "schema:identifier" }, - "@id": "enzml:Variable/2805b7f6-e844-422f-ac91-d7a9fbb3c98e", + "@id": "enzml:Variable/e8925678-42a3-4ae9-b6b0-1acf57e931fe", "@type": [ "enzml:Variable" ], @@ -286,7 +229,7 @@ "schema": "https://schema.org/", "id": "schema:identifier" }, - "@id": "enzml:Variable/9ee004f8-07ca-45b6-a1e8-4583c4e86fe7", + "@id": "enzml:Variable/f92597cf-ca5d-4287-83fb-d37e10f6bcf2", "@type": [ "enzml:Variable" ], @@ -294,124 +237,6 @@ "name": "s0", "symbol": "s0" } - ], - "parameters": [ - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/", - "id": { - "@id": "schema:identifier", - "@type": "@id" - } - }, - "@id": "enzml:Parameter/6b315b1b-26df-41a6-8a4f-1fc508e92a61", - "@type": [ - "enzml:Parameter" - ], - "id": "K_m", - "name": "K_m", - "symbol": "K_m", - "unit": { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "OBO:UO_0000063", - "@type": [ - "OBO:UO_0000000" - ], - "id": "u2", - "name": "mmol / l", - "base_units": [ - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "enzml:BaseUnit/801b612f-9b16-4030-bc53-20e00d9e525b", - "@type": [ - "enzml:BaseUnit" - ], - "kind": "mole", - "exponent": 1, - "scale": -3.0 - }, - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "enzml:BaseUnit/8c63ea70-d26e-45e4-beef-651da82864d0", - "@type": [ - "enzml:BaseUnit" - ], - "kind": "litre", - "exponent": -1, - "scale": 1.0 - } - ] - }, - "upper": 100.0, - "lower": 0.0, - "stderr": 0.1, - "constant": true - }, - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/", - "id": { - "@id": "schema:identifier", - "@type": "@id" - } - }, - "@id": "enzml:Parameter/6619c640-3bbc-4b9d-b1e5-22665776bdaf", - "@type": [ - "enzml:Parameter" - ], - "id": "kcat", - "name": "kcat", - "symbol": "kcat", - "unit": { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "OBO:UO_0000010", - "@type": [ - "OBO:UO_0000000" - ], - "id": "u3", - "name": "1 / s", - "base_units": [ - { - "@context": { - "enzml": "http://www.enzymeml.org/v2/", - "OBO": "http://purl.obolibrary.org/obo/", - "schema": "https://schema.org/" - }, - "@id": "enzml:BaseUnit/ec7aa14e-db13-4b05-ac2a-19973ff83e5a", - "@type": [ - "enzml:BaseUnit" - ], - "kind": "second", - "exponent": -1, - "scale": 1.0 - } - ] - }, - "upper": 100.0, - "lower": 0.0, - "stderr": 0.1, - "constant": true - } ] }, "species": [ @@ -424,7 +249,7 @@ "@type": "@id" } }, - "@id": "enzml:ReactionElement/d709628a-f70c-48bf-b2ae-33fe2a13b310", + "@id": "enzml:ReactionElement/64a1ab7c-7a6b-4479-afa4-a5732d1149c3", "@type": [ "enzml:ReactionElement" ], @@ -440,7 +265,7 @@ "@type": "@id" } }, - "@id": "enzml:ReactionElement/5286412a-e094-4a49-8cb9-e9e8e6c0ade4", + "@id": "enzml:ReactionElement/58c5315f-c835-46df-afb6-309aa61925c6", "@type": [ "enzml:ReactionElement" ], @@ -467,7 +292,7 @@ "@type": "@id" } }, - "@id": "enzml:Measurement/f4a6a78a-50eb-4850-b0e8-80b4155b75f2", + "@id": "enzml:Measurement/fee8c4cb-a15f-4ee4-b7c7-bcb9cf54ed6f", "@type": [ "enzml:Measurement" ], @@ -483,7 +308,7 @@ "@type": "@id" } }, - "@id": "enzml:MeasurementData/9d071dc1-70a5-4c78-bbe0-5fd5e8fad74f", + "@id": "enzml:MeasurementData/face315a-fd44-4b49-9f1d-0522b22aa073", "@type": [ "enzml:MeasurementData" ], @@ -499,7 +324,7 @@ "@type": [ "OBO:UO_0000000" ], - "id": "u2", + "id": "u1", "name": "mmol / l", "base_units": [ { @@ -508,7 +333,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/801b612f-9b16-4030-bc53-20e00d9e525b", + "@id": "enzml:BaseUnit/040c4b08-0af8-41d5-b3b6-0fa479ece06f", "@type": [ "enzml:BaseUnit" ], @@ -522,7 +347,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/8c63ea70-d26e-45e4-beef-651da82864d0", + "@id": "enzml:BaseUnit/5069824d-7d9b-4afd-860d-232049d5fe2f", "@type": [ "enzml:BaseUnit" ], @@ -542,7 +367,7 @@ "@type": [ "OBO:UO_0000000" ], - "id": "u4", + "id": "u2", "name": "s", "base_units": [ { @@ -551,12 +376,12 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/ec7aa14e-db13-4b05-ac2a-19973ff83e5a", + "@id": "enzml:BaseUnit/1be2e5cf-2afd-4b04-a4c7-22cc42fde9b6", "@type": [ "enzml:BaseUnit" ], "kind": "second", - "exponent": -1, + "exponent": 1, "scale": 1.0 } ] @@ -599,7 +424,7 @@ "@type": "@id" } }, - "@id": "enzml:MeasurementData/0970bcda-cb12-4049-a1e1-9b8c2a59c425", + "@id": "enzml:MeasurementData/bbe483a3-d68a-44ed-8acd-0fe94b4b2f7a", "@type": [ "enzml:MeasurementData" ], @@ -615,7 +440,7 @@ "@type": [ "OBO:UO_0000000" ], - "id": "u2", + "id": "u1", "name": "mmol / l", "base_units": [ { @@ -624,7 +449,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/801b612f-9b16-4030-bc53-20e00d9e525b", + "@id": "enzml:BaseUnit/040c4b08-0af8-41d5-b3b6-0fa479ece06f", "@type": [ "enzml:BaseUnit" ], @@ -638,7 +463,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/8c63ea70-d26e-45e4-beef-651da82864d0", + "@id": "enzml:BaseUnit/5069824d-7d9b-4afd-860d-232049d5fe2f", "@type": [ "enzml:BaseUnit" ], @@ -658,7 +483,7 @@ "@type": [ "OBO:UO_0000000" ], - "id": "u4", + "id": "u2", "name": "s", "base_units": [ { @@ -667,12 +492,12 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/ec7aa14e-db13-4b05-ac2a-19973ff83e5a", + "@id": "enzml:BaseUnit/1be2e5cf-2afd-4b04-a4c7-22cc42fde9b6", "@type": [ "enzml:BaseUnit" ], "kind": "second", - "exponent": -1, + "exponent": 1, "scale": 1.0 } ] @@ -719,7 +544,7 @@ "@type": [ "OBO:UO_0000000" ], - "id": "u5", + "id": "u3", "name": "K", "base_units": [ { @@ -728,7 +553,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/ff8443f5-375d-4fbe-b199-598194298fb4", + "@id": "enzml:BaseUnit/a3eac754-8efc-479a-b12d-7910d4881e7f", "@type": [ "enzml:BaseUnit" ], @@ -752,7 +577,7 @@ "@type": "@id" } }, - "@id": "enzml:Measurement/a1fda09a-634e-4482-8d66-069b0e615ef5", + "@id": "enzml:Measurement/aed20526-1899-43b8-bf3c-5dea15ff814d", "@type": [ "enzml:Measurement" ], @@ -768,7 +593,7 @@ "@type": "@id" } }, - "@id": "enzml:MeasurementData/8c1fce82-7dbe-499e-b20d-6b0bb4887ed8", + "@id": "enzml:MeasurementData/f7fc7642-f8ee-4e28-bfb6-c8ae924a51b0", "@type": [ "enzml:MeasurementData" ], @@ -784,7 +609,7 @@ "@type": [ "OBO:UO_0000000" ], - "id": "u2", + "id": "u1", "name": "mmol / l", "base_units": [ { @@ -793,7 +618,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/801b612f-9b16-4030-bc53-20e00d9e525b", + "@id": "enzml:BaseUnit/040c4b08-0af8-41d5-b3b6-0fa479ece06f", "@type": [ "enzml:BaseUnit" ], @@ -807,7 +632,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/8c63ea70-d26e-45e4-beef-651da82864d0", + "@id": "enzml:BaseUnit/5069824d-7d9b-4afd-860d-232049d5fe2f", "@type": [ "enzml:BaseUnit" ], @@ -827,7 +652,7 @@ "@type": [ "OBO:UO_0000000" ], - "id": "u4", + "id": "u2", "name": "s", "base_units": [ { @@ -836,12 +661,12 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/ec7aa14e-db13-4b05-ac2a-19973ff83e5a", + "@id": "enzml:BaseUnit/1be2e5cf-2afd-4b04-a4c7-22cc42fde9b6", "@type": [ "enzml:BaseUnit" ], "kind": "second", - "exponent": -1, + "exponent": 1, "scale": 1.0 } ] @@ -884,7 +709,7 @@ "@type": "@id" } }, - "@id": "enzml:MeasurementData/ab6e6d77-58fe-4da1-a310-9224f573f0da", + "@id": "enzml:MeasurementData/597c85d3-288f-470f-b7aa-8c156c1f2b27", "@type": [ "enzml:MeasurementData" ], @@ -900,7 +725,7 @@ "@type": [ "OBO:UO_0000000" ], - "id": "u2", + "id": "u1", "name": "mmol / l", "base_units": [ { @@ -909,7 +734,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/801b612f-9b16-4030-bc53-20e00d9e525b", + "@id": "enzml:BaseUnit/040c4b08-0af8-41d5-b3b6-0fa479ece06f", "@type": [ "enzml:BaseUnit" ], @@ -923,7 +748,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/8c63ea70-d26e-45e4-beef-651da82864d0", + "@id": "enzml:BaseUnit/5069824d-7d9b-4afd-860d-232049d5fe2f", "@type": [ "enzml:BaseUnit" ], @@ -943,7 +768,7 @@ "@type": [ "OBO:UO_0000000" ], - "id": "u4", + "id": "u2", "name": "s", "base_units": [ { @@ -952,12 +777,12 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/ec7aa14e-db13-4b05-ac2a-19973ff83e5a", + "@id": "enzml:BaseUnit/1be2e5cf-2afd-4b04-a4c7-22cc42fde9b6", "@type": [ "enzml:BaseUnit" ], "kind": "second", - "exponent": -1, + "exponent": 1, "scale": 1.0 } ] @@ -1004,7 +829,7 @@ "@type": [ "OBO:UO_0000000" ], - "id": "u5", + "id": "u3", "name": "K", "base_units": [ { @@ -1013,7 +838,7 @@ "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/" }, - "@id": "enzml:BaseUnit/ff8443f5-375d-4fbe-b199-598194298fb4", + "@id": "enzml:BaseUnit/a3eac754-8efc-479a-b12d-7910d4881e7f", "@type": [ "enzml:BaseUnit" ], @@ -1025,5 +850,123 @@ } } ], - "equations": [] + "equations": [], + "parameters": [ + { + "@context": { + "enzml": "http://www.enzymeml.org/v2/", + "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", + "id": { + "@id": "schema:identifier", + "@type": "@id" + } + }, + "@id": "enzml:Parameter/46faced8-6229-4b7c-b06a-3feb06a11350", + "@type": [ + "enzml:Parameter" + ], + "id": "kcat", + "name": "kcat", + "symbol": "kcat", + "unit": { + "@context": { + "enzml": "http://www.enzymeml.org/v2/", + "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/" + }, + "@id": "OBO:UO_0000010", + "@type": [ + "OBO:UO_0000000" + ], + "id": "u4", + "name": "1 / s", + "base_units": [ + { + "@context": { + "enzml": "http://www.enzymeml.org/v2/", + "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/" + }, + "@id": "enzml:BaseUnit/1be2e5cf-2afd-4b04-a4c7-22cc42fde9b6", + "@type": [ + "enzml:BaseUnit" + ], + "kind": "second", + "exponent": -1, + "scale": 1.0 + } + ] + }, + "upper": 100.0, + "lower": 0.0, + "stderr": 0.1, + "constant": true + }, + { + "@context": { + "enzml": "http://www.enzymeml.org/v2/", + "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/", + "id": { + "@id": "schema:identifier", + "@type": "@id" + } + }, + "@id": "enzml:Parameter/706ce185-8f1d-429e-8c0d-76942326a0df", + "@type": [ + "enzml:Parameter" + ], + "id": "K_m", + "name": "K_m", + "symbol": "K_m", + "unit": { + "@context": { + "enzml": "http://www.enzymeml.org/v2/", + "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/" + }, + "@id": "OBO:UO_0000063", + "@type": [ + "OBO:UO_0000000" + ], + "id": "u1", + "name": "mmol / l", + "base_units": [ + { + "@context": { + "enzml": "http://www.enzymeml.org/v2/", + "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/" + }, + "@id": "enzml:BaseUnit/040c4b08-0af8-41d5-b3b6-0fa479ece06f", + "@type": [ + "enzml:BaseUnit" + ], + "kind": "mole", + "exponent": 1, + "scale": -3.0 + }, + { + "@context": { + "enzml": "http://www.enzymeml.org/v2/", + "OBO": "http://purl.obolibrary.org/obo/", + "schema": "https://schema.org/" + }, + "@id": "enzml:BaseUnit/5069824d-7d9b-4afd-860d-232049d5fe2f", + "@type": [ + "enzml:BaseUnit" + ], + "kind": "litre", + "exponent": -1, + "scale": 1.0 + } + ] + }, + "upper": 100.0, + "lower": 0.0, + "stderr": 0.1, + "constant": true + } + ] } \ No newline at end of file diff --git a/tests/fixtures/sbml/reaction_example_sbml.xml b/tests/fixtures/sbml/reaction_example_sbml.xml index d346fc53..95a3e463 100644 --- a/tests/fixtures/sbml/reaction_example_sbml.xml +++ b/tests/fixtures/sbml/reaction_example_sbml.xml @@ -2,22 +2,22 @@ - - + + - + - - + + - + - + - - + + @@ -34,7 +34,7 @@ - + @@ -45,35 +45,33 @@ - - + - + - - + - + - + - + - + @@ -85,18 +83,6 @@ - - - - - - - - - - - - @@ -104,7 +90,7 @@ + rdf:about="http://www.enzymeml.org/v2/Vessel/a2ea41db-032c-4a61-a7d5-254137d0bce9"> Vessel 1 10.0 @@ -121,7 +107,7 @@ + rdf:about="http://www.enzymeml.org/v2/Protein/42828d0d-f4ac-489b-acd5-cd74c080f340"> Enzyme MTEY @@ -138,7 +124,7 @@ + rdf:about="http://www.enzymeml.org/v2/SmallMolecule/e794f30d-51ea-4b89-a5d7-555bcd70efe5"> Substrate @@ -150,7 +136,7 @@ + rdf:about="http://www.enzymeml.org/v2/SmallMolecule/4b8a1f78-1874-447a-aee7-a80970bb1301"> Product @@ -159,11 +145,11 @@ - + + rdf:about="http://www.enzymeml.org/v2/Parameter/46faced8-6229-4b7c-b06a-3feb06a11350"> @@ -174,11 +160,11 @@ - + + rdf:about="http://www.enzymeml.org/v2/Parameter/706ce185-8f1d-429e-8c0d-76942326a0df"> @@ -204,8 +190,8 @@ - + diff --git a/tests/fixtures/sbml/reactions_example.omex b/tests/fixtures/sbml/reactions_example.omex new file mode 100644 index 00000000..ce6e4e12 Binary files /dev/null and b/tests/fixtures/sbml/reactions_example.omex differ diff --git a/tests/integration/test_sbml.py b/tests/integration/test_sbml.py new file mode 100644 index 00000000..f6acb232 --- /dev/null +++ b/tests/integration/test_sbml.py @@ -0,0 +1,40 @@ +from pathlib import Path + +from pyenzyme import EnzymeMLDocument +from pyenzyme.tools import to_dict_wo_json_ld + + +class TestSBML: + def test_parse_sbml_odes(self): + # Arrange + path = Path("tests/fixtures/sbml/odes_example.omex") + + # Act + enzmldoc = EnzymeMLDocument.from_sbml(path) + + # Assert + parsed_doc = to_dict_wo_json_ld(enzmldoc) + expected_doc = to_dict_wo_json_ld( + EnzymeMLDocument.read("tests/fixtures/sbml/ode_example_enzml.json") + ) + + assert ( + parsed_doc == expected_doc + ), "Parsed document does not match expected document" + + def test_parse_sbml_reactions(self): + # Arrange + path = Path("tests/fixtures/sbml/reactions_example.omex") + + # Act + enzmldoc = EnzymeMLDocument.from_sbml(path) + + # Assert + parsed_doc = to_dict_wo_json_ld(enzmldoc) + expected_doc = to_dict_wo_json_ld( + EnzymeMLDocument.read("tests/fixtures/sbml/reaction_example_enzml.json") + ) + + assert ( + parsed_doc == expected_doc + ), "Parsed document does not match expected document" diff --git a/tests/unit/test_equations.py b/tests/unit/test_equations.py index 4a1496cc..f0b20cec 100644 --- a/tests/unit/test_equations.py +++ b/tests/unit/test_equations.py @@ -2,16 +2,22 @@ from pyenzyme.equations._chem import build_reaction, build_reactions from pyenzyme.equations._math import build_equation, build_equations -from pyenzyme.model import EquationType +from pyenzyme.model import EquationType, EnzymeMLDocument +from pyenzyme.units import s class TestMathEquations: def test_parse_equation(self): # Arrange + enzmldoc = EnzymeMLDocument(name="Test") equation = "s1'(t) = kcat * p0(t) * s0(t)" # Act - equation = build_equation(equation) + equation = build_equation( + equation=equation, + unit_mapping={"kcat": 1 / s}, + enzmldoc=enzmldoc, + ) # Assert expected_vars = ["p0", "s0"] @@ -23,41 +29,54 @@ def test_parse_equation(self): assert ( equation.equation == "kcat*p0*s0" ), "Equation is not correct. Got {equation.equation.equation}" - assert equation.parameters[0].name == "kcat", "Parameter name is not correct" - assert ( - equation.parameters[0].symbol == "kcat" - ), "Parameter symbol is not correct" for var in equation.variables: assert var.name in expected_vars assert var.symbol in expected_vars - for param in equation.parameters: + for param in enzmldoc.parameters: assert param.name in expected_params assert param.symbol in expected_params + assert param.id in expected_params + assert param.unit is not None def test_invalid_equation_no_right(self): # Arrange + enzmldoc = EnzymeMLDocument(name="Test") equation = "s1'(t) =" # Act with pytest.raises(ValueError): - equation = build_equation(equation) + build_equation( + equation=equation, + unit_mapping={"kcat": 1 / s}, + enzmldoc=enzmldoc, + ) def test_invalid_equation_no_equals(self): # Arrange + enzmldoc = EnzymeMLDocument(name="Test") equation = "s1'(t) kcat * p0(t) * s0(t)" # Act with pytest.raises(ValueError): - equation = build_equation(equation) + build_equation( + equation=equation, + unit_mapping={"kcat": 1 / s}, + enzmldoc=enzmldoc, + ) def test_equation_with_funs(self): # Arrange + enzmldoc = EnzymeMLDocument(name="Test") equation = "s1'(t) = kcat * exp(p0(t) * t)" # Act - equation = build_equation(equation) + equation = build_equation( + equation=equation, + unit_mapping={"kcat": 1 / s}, + enzmldoc=enzmldoc, + ) # Assert assert ( @@ -69,10 +88,15 @@ def test_equation_with_funs(self): def test_equation_with_fun_only_t(self): # Arrange + enzmldoc = EnzymeMLDocument(name="Test") equation = "s1'(t) = kcat * exp(t)" # Act - equation = build_equation(equation) + equation = build_equation( + equation=equation, + unit_mapping={"kcat": 1 / s}, + enzmldoc=enzmldoc, + ) # Assert assert ( @@ -84,23 +108,32 @@ def test_equation_with_fun_only_t(self): def test_multiple_equations(self): # Arrange + enzmldoc = EnzymeMLDocument(name="Test") equations = [ "s1'(t) = kcat * E_tot * s0(t)", "E_tot = p0(t) + p1(t)", ] # Act - equations = build_equations(*equations) + equations = build_equations( + *equations, + unit_mapping={"kcat": 1 / s}, + enzmldoc=enzmldoc, + ) # Assert assert len(equations) == 2, f"Expected 2 equations. Got {len(equations)}" def test_init_assigment_equation(self): # Arrange + enzmldoc = EnzymeMLDocument(name="Test") equation = "E_tot = p0 + p1" # Act - equation = build_equation(equation) + equation = build_equation( + equation, + enzmldoc=enzmldoc, + ) # Assert assert ( @@ -115,10 +148,14 @@ def test_init_assigment_equation(self): def test_assigment_equation(self): # Arrange + enzmldoc = EnzymeMLDocument(name="Test") equation = "E_tot(t) = p0 + p1" # Act - equation = build_equation(equation) + equation = build_equation( + equation=equation, + enzmldoc=enzmldoc, + ) # Assert assert (