Skip to content

Commit

Permalink
updating for refactoring validation in biosimulators-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrkarr committed Apr 18, 2021
1 parent 4e74975 commit b5ff307
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Base OS
FROM python:3.7.9-slim-buster

ARG VERSION="0.1.11"
ARG VERSION="0.1.12"
ARG SIMULATOR_VERSION="v0.11.16"

# metadata
Expand Down
2 changes: 1 addition & 1 deletion biosimulators_amici/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.11'
__version__ = '0.1.12'
26 changes: 18 additions & 8 deletions biosimulators_amici/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Variable, Symbol)
from biosimulators_utils.sedml import validation
from biosimulators_utils.sedml.exec import exec_sed_doc
from biosimulators_utils.utils.core import validate_str_value, parse_value
from biosimulators_utils.utils.core import validate_str_value, parse_value, raise_errors_warnings
import amici
import functools
import importlib.util
Expand Down Expand Up @@ -128,13 +128,23 @@ def validate_sed_task(task, variables):
:obj:`dict` of :obj:`str` to :obj:`str`: dictionary that maps each XPath to the
value of the attribute of the object in the XML file that matches the XPath
"""
validation.validate_task(task)
validation.validate_model_language(task.model.language, ModelLanguage.SBML)
validation.validate_model_change_types(task.model.changes, ())
validation.validate_model_changes(task.model.changes)
validation.validate_simulation_type(task.simulation, (UniformTimeCourseSimulation, ))
validation.validate_uniform_time_course_simulation(task.simulation)
validation.validate_data_generator_variables(variables)
model = task.model
sim = task.simulation

raise_errors_warnings(validation.validate_task(task),
error_summary='Task `{}` is invalid.'.format(task.id))
raise_errors_warnings(validation.validate_model_language(task.model.language, ModelLanguage.SBML),
error_summary='Language for model `{}` is not supported.'.format(model.id))
raise_errors_warnings(validation.validate_model_change_types(task.model.changes, ()),
error_summary='Changes for model `{}` are not supported.'.format(model.id))
raise_errors_warnings(validation.validate_model_changes(task.model),
error_summary='Changes for model `{}` are invalid.'.format(model.id))
raise_errors_warnings(validation.validate_simulation_type(task.simulation, (UniformTimeCourseSimulation, )),
error_summary='{} `{}` is not supported.'.format(sim.__class__.__name__, sim.id))
raise_errors_warnings(validation.validate_simulation(task.simulation),
error_summary='Simulation `{}` is invalid.'.format(sim.id))
raise_errors_warnings(validation.validate_data_generator_variables(variables),
error_summary='Data generator variables for task `{}` are invalid.'.format(task.id))
return validation.validate_variable_xpaths(variables, task.model.source, attr='id')


Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
amici >= 0.11.14
biosimulators_utils[logging] >= 0.1.52
amici >= 0.11.16
biosimulators_utils[logging] >= 0.1.53
numpy
sympy >= 1.7

0 comments on commit b5ff307

Please sign in to comment.