Skip to content

Commit e8cf9ec

Browse files
authored
Merge pull request #19 from biosimulators/fixes
Two fixes:
2 parents eed7e34 + e8c71cd commit e8cf9ec

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

biosimulators_tellurium/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.1.40'
1+
__version__ = '0.1.41'

biosimulators_tellurium/core.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,22 @@ def get_all_tasks_from_task(task):
316316
return ret
317317
elif isinstance(task, RepeatedTask):
318318
for sub_task in task.sub_tasks:
319-
submodels = get_all_tasks_from_task(sub_task.task)
320-
ret.update(submodels)
319+
subtasks = get_all_tasks_from_task(sub_task.task)
320+
ret.update(subtasks)
321+
return ret
322+
else:
323+
raise NotImplementedError("Tasks other than 'Task' or 'RepeatedTask' are not supported.")
324+
325+
326+
def get_all_task_changes_from_task(task):
327+
ret = set()
328+
if isinstance(task, Task):
329+
return ret
330+
elif isinstance(task, RepeatedTask):
331+
ret.update(task.changes)
332+
for sub_task in task.sub_tasks:
333+
subtask_changes = get_all_task_changes_from_task(sub_task.task)
334+
ret.update(subtask_changes)
321335
return ret
322336
else:
323337
raise NotImplementedError("Tasks other than 'Task' or 'RepeatedTask' are not supported.")
@@ -352,6 +366,7 @@ def preprocess_sed_task(task, variables, config=None, simulator_config=None):
352366
config = get_config()
353367

354368
alltasks = get_all_tasks_from_task(task)
369+
alltaskchanges = get_all_task_changes_from_task(task)
355370

356371
if config.VALIDATE_SEDML:
357372
for subtask in alltasks:
@@ -377,9 +392,7 @@ def preprocess_sed_task(task, variables, config=None, simulator_config=None):
377392
solvers = {}
378393
for subtasks in alltasks:
379394
model = subtask.model
380-
allchanges = model.changes
381-
if isinstance(task, RepeatedTask):
382-
allchanges = allchanges + task.changes
395+
allchanges = model.changes + list(alltaskchanges)
383396
sim = subtask.simulation
384397
model_etree = lxml.etree.parse(model.source)
385398

@@ -548,13 +561,19 @@ def get_model_change_target_tellurium_change_map(model_etree, changes, alg_kisao
548561
if not isinstance(change, ModelAttributeChange) and not isinstance(change, ComputeModelChange):
549562
continue
550563
if hasattr(model, "change") and change.model.id != model_id:
551-
raise NotImplementedError("Unable to process a change to model " + change.model_id + " inside a task concerning model " + model_id)
564+
raise NotImplementedError("Unable to process a change to model '" + change.model_id
565+
+ "' inside a task concerning model '" + model_id + "'")
552566
if hasattr(model, "symbol") and change.symbol:
553-
raise NotImplementedError("Unable to process a change to model " + change.model_id + " with the symbol " + change.symbol)
567+
raise NotImplementedError("Unable to process a change to model '" + change.model_id
568+
+ "' with the symbol '" + change.symbol + "'")
554569
else:
555570
change.symbol = None
556571
__, sep, __ = change.target.rpartition('/@')
557572

573+
if "reaction[" in change.target and "kineticLaw/" in change.target:
574+
raise NotImplementedError("Unable to process a change to model '" + model_id + "' with the target "
575+
+ change.target + " because changing local parameters is not yet implemented.")
576+
558577
sbml_id = change_targets_to_sbml_ids[change.target]
559578

560579
if alg_kisao_id == 'KISAO_0000029' and sbml_id in species_ids:

0 commit comments

Comments
 (0)