From fe3d3bbda9a29470f6adeafc9f2776ce5c0a450d Mon Sep 17 00:00:00 2001 From: "Frank T. Bergmann" Date: Fri, 23 Aug 2024 14:17:49 +0200 Subject: [PATCH] - can not assume filenames --- pyenzyme/sbml/omex.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pyenzyme/sbml/omex.py b/pyenzyme/sbml/omex.py index 1f86734..c7aba86 100644 --- a/pyenzyme/sbml/omex.py +++ b/pyenzyme/sbml/omex.py @@ -67,7 +67,24 @@ def read_sbml_omex(path: Path) -> tuple[Path, Path | None]: """ omex = Omex.from_omex(path) - sbml_file = omex.get_path("./model.xml") - data = omex.get_path("./data.tsv") + + # get first sbml entry in manifest + sbml_entry = None + for entry in omex.manifest.entries: + if '/sbml' in entry.format: + sbml_entry = entry.location + if entry.master: + break + sbml_file = omex.get_path(sbml_entry) + + + # we really need to get all of the data entries from the manifest + # but for now just get the first one + data_entry = None + for entry in omex.manifest.entries: + if '/csv' in entry.format or '/tsv' in entry.format: + data_entry = entry.location + break + data = omex.get_path(data_entry) return sbml_file, data