From a57a7325a496760a151f4055c1366e900a18c980 Mon Sep 17 00:00:00 2001 From: Jan Range Date: Mon, 19 Aug 2024 21:27:15 +0200 Subject: [PATCH] update tests --- tests/fixtures/sbml/ode_example_enzml.json | 415 +++++++----------- tests/fixtures/sbml/ode_example_sbml.xml | 46 +- tests/fixtures/sbml/odes_example.omex | Bin 0 -> 2429 bytes .../fixtures/sbml/reaction_example_enzml.json | 389 +++++++--------- tests/fixtures/sbml/reaction_example_sbml.xml | 66 ++- tests/fixtures/sbml/reactions_example.omex | Bin 0 -> 2212 bytes tests/integration/test_sbml.py | 40 ++ tests/unit/test_equations.py | 65 ++- 8 files changed, 456 insertions(+), 565 deletions(-) create mode 100644 tests/fixtures/sbml/odes_example.omex create mode 100644 tests/fixtures/sbml/reactions_example.omex create mode 100644 tests/integration/test_sbml.py diff --git a/tests/fixtures/sbml/ode_example_enzml.json b/tests/fixtures/sbml/ode_example_enzml.json index 57a2b6e..ca2dca0 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 7d4ca6b..dc3baf8 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 0000000000000000000000000000000000000000..087704deb80a5f2edbf78637d98194f6b7c3735e GIT binary patch literal 2429 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 - - + + - + - - + + - + - + - - + + @@ -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 0000000000000000000000000000000000000000..ce6e4e12f4887700d95ac896785b467c6d5771a3 GIT binary patch literal 2212 zcmZ{lc{CJiAIHZs#)LaDh_W;oMH+h}g=`tiFm}e?kbN0TR1Db_BVx!H`%+{q7ll%m zh;A9tof$%n(qhYUF^E_1d(L~`+d1#^{P8`%^PKNF&+qfk2V>5~Eerqvcmd3EsPiW- zyX_AL6NVE2;6KPlyqm715 zM7r!ZmxmI-w*lZQZM(YJ9z%;)vh+{eF+Pv?G<0(q4_*E|)|}Kwpug*BpJ_e&W;=Z- zyT2kp4i6fU8GE8SZ7rm?JxuG6$a;nUo}ppoJyl}TvX)ZjCYEQK$2yZ8yJ9mhlepSm?Syy4LQ9CUW8^aEm zts~C~x$9U#u0w~e=8YKzB|E4l8un>;>BHzsVwYLVX6em~b6ZUOy z+srj6q+4^yG8Zi+q?Jn~zGin<$^t(xW}nO>X;sQ))T&9`Z%M`}ubA$}DSCLsVU*a5 z3;pGY<$w6GV=F0Nbac21i!E#$_f|L# zqbm<&iMb884cENkl`Zns>Q%jyu9q*nl=4Ptr5}~ti0iEhr)s7mMPf`Bpk6A$?a1p@ z$TvbMXC3{+rIUiE#E3SDAzN6&2XPp&y;~Rf z>b7!J{;K%MoX6|w_>Ruq*>AJE=DwXe6OV|)LHCG6>nSG_*`pvJA2kW+k@OdL;#)tF z2lXg{&IeZv44CH+_h=7tWK2$nt&$$6M|PL{Fh1h-JcL<)KrEF<^z4|4Pupzh6nAf4 zzsWNg%`*Q(%jGotKWGqmP3T9<@s#!mizk^?Df%qQ4%63vV#m(UIuD`^SeH+_hE=$#i2;|(u}C~>t~#JTF;hA&QQE&4xcwO0Ha1!x1c}Zz|z4FWsKz;nJwZV zX;C$-fcQ3lGw0iaWRaWC-I19j5V6zUsg7JY)aPy<<`1u$g1-?7j7^ zJ%E2Vv(53eg98O_eN#=|Y&7dksH_sL#g%?L-ph==V#~Nl5Y-HG<``?CeY{o14_8H>{BUXovl~jpK^%1#UZyohD?&G{^Q0`a`jo&X^kkQh2p{oFhQ+5g zOoU6|?|Pjg6{&7l`vfZ1v|L4Sf}xKQ$j7;NH*3D#sh*KB@QUeyG`LG$NacVt!J}Sa;`fBBqZC{?j>!IDN5jqnCBC-bkN&m^rR;>-aZ8z z)KB&F#2#w3FjVD-D)8cL^+^Hbx_JY)lrETK$6f~)m8y@ezGzQ~H5T^}?ql*4`=3@! zh?$2u7&gaJ`L4`P19xVnxj@mhYjMvCxnJ~kS6gVjnll|*7j~o^H-0Z~;b&wWIVH=1cT)acxs-b{O>YP7zGa=x5Sf&4@`^av@V>!6ZxL{Do=Bt|1 zE`-ITxY#dI3uU`w5B=h@;ZlK_eZJXvTS|-=7We#6S)*7{mdMN5ou;$R0%*EC>aQfn z%%>MJ>CR8dAL{$#GjiyA%N`DHA zga?K!;i49r%y{+eh&nkh@CM&>^;XnM2l)i1D7AjtCbmURcS#xFgeHp=moWXPu_vDR2}ihp6K=Iu}d#HS~L#vx;X{%t+yb#$`ght@HtQyzF@ z*0~yHhHWfR^Bf!aPmgeJ8@GlW_`{v!r(^*DZ?8x%L}bJjH=_P;3CH=lN4|@V85^^+ zrLZ<=_&EFYC3T+W;{Ky%7roK;1uTi|Dr$m z*uPKJji2$q+W)ors~7*%0|2US@EvUUUrYX4`xV3AHCxc%P%!4e1LXn$TnD%IAU_|x H0RaC3h8X0l literal 0 HcmV?d00001 diff --git a/tests/integration/test_sbml.py b/tests/integration/test_sbml.py new file mode 100644 index 0000000..f6acb23 --- /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 4a1496c..f0b20ce 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 (