Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two fixes: #19

Merged
merged 5 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion biosimulators_tellurium/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.40'
__version__ = '0.1.41'
33 changes: 26 additions & 7 deletions biosimulators_tellurium/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,22 @@
return ret
elif isinstance(task, RepeatedTask):
for sub_task in task.sub_tasks:
submodels = get_all_tasks_from_task(sub_task.task)
ret.update(submodels)
subtasks = get_all_tasks_from_task(sub_task.task)
ret.update(subtasks)
return ret
else:
raise NotImplementedError("Tasks other than 'Task' or 'RepeatedTask' are not supported.")

Check warning on line 323 in biosimulators_tellurium/core.py

View check run for this annotation

Codecov / codecov/patch

biosimulators_tellurium/core.py#L323

Added line #L323 was not covered by tests


def get_all_task_changes_from_task(task):
ret = set()
if isinstance(task, Task):
return ret
elif isinstance(task, RepeatedTask):
ret.update(task.changes)
for sub_task in task.sub_tasks:
subtask_changes = get_all_task_changes_from_task(sub_task.task)
ret.update(subtask_changes)
return ret
else:
raise NotImplementedError("Tasks other than 'Task' or 'RepeatedTask' are not supported.")
Expand Down Expand Up @@ -352,6 +366,7 @@
config = get_config()

alltasks = get_all_tasks_from_task(task)
alltaskchanges = get_all_task_changes_from_task(task)

if config.VALIDATE_SEDML:
for subtask in alltasks:
Expand All @@ -377,9 +392,7 @@
solvers = {}
for subtasks in alltasks:
model = subtask.model
allchanges = model.changes
if isinstance(task, RepeatedTask):
allchanges = allchanges + task.changes
allchanges = model.changes + list(alltaskchanges)
sim = subtask.simulation
model_etree = lxml.etree.parse(model.source)

Expand Down Expand Up @@ -548,13 +561,19 @@
if not isinstance(change, ModelAttributeChange) and not isinstance(change, ComputeModelChange):
continue
if hasattr(model, "change") and change.model.id != model_id:
raise NotImplementedError("Unable to process a change to model " + change.model_id + " inside a task concerning model " + model_id)
raise NotImplementedError("Unable to process a change to model '" + change.model_id

Check warning on line 564 in biosimulators_tellurium/core.py

View check run for this annotation

Codecov / codecov/patch

biosimulators_tellurium/core.py#L564

Added line #L564 was not covered by tests
+ "' inside a task concerning model '" + model_id + "'")
if hasattr(model, "symbol") and change.symbol:
raise NotImplementedError("Unable to process a change to model " + change.model_id + " with the symbol " + change.symbol)
raise NotImplementedError("Unable to process a change to model '" + change.model_id

Check warning on line 567 in biosimulators_tellurium/core.py

View check run for this annotation

Codecov / codecov/patch

biosimulators_tellurium/core.py#L567

Added line #L567 was not covered by tests
+ "' with the symbol '" + change.symbol + "'")
else:
change.symbol = None
__, sep, __ = change.target.rpartition('/@')

if "reaction[" in change.target and "kineticLaw/" in change.target:
raise NotImplementedError("Unable to process a change to model '" + model_id + "' with the target "

Check warning on line 574 in biosimulators_tellurium/core.py

View check run for this annotation

Codecov / codecov/patch

biosimulators_tellurium/core.py#L574

Added line #L574 was not covered by tests
+ change.target + " because changing local parameters is not yet implemented.")

sbml_id = change_targets_to_sbml_ids[change.target]

if alg_kisao_id == 'KISAO_0000029' and sbml_id in species_ids:
Expand Down