Skip to content

Commit

Permalink
fix: matlab loading and sbml validation
Browse files Browse the repository at this point in the history
  • Loading branch information
mihai-sysbio committed Oct 26, 2023
1 parent c7150f7 commit fa3c55b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/cobra.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import cobra
import json
from pathlib import Path

def loadYaml(model_name):
print('load yaml')
Expand Down Expand Up @@ -34,7 +35,10 @@ def loadMatlab(model_name):
is_valid = False
errors = ''
try:
cobra.io.load_matlab_model(model_name + '.mat')
data_dir = Path(".") / ".."
data_dir = data_dir.resolve()
model_path = data_dir / "{}.mat".format(model_name)
cobra.io.load_matlab_model(str(model_path.resolve()))
is_valid = True
except FileNotFoundError:
errors = "File missing"
Expand All @@ -61,9 +65,10 @@ def loadJson(model_name):
def validateSbml(model_name):
print('validate sbml with cobrapy')
is_valid = False
errors = ''
try:
_, result = cobra.io.sbml.validate_sbml_model(model_name + '.xml')
if result == {}:
if result['SBML_FATAL'] == [] and result['SBML_ERROR'] == [] and result['SBML_SCHEMA_ERROR'] == [] and result['COBRA_FATAL'] == [] and result['COBRA_ERROR'] == []:
is_valid = True
else:
raise Exception(result)
Expand Down

0 comments on commit fa3c55b

Please sign in to comment.