@@ -316,8 +316,22 @@ def get_all_tasks_from_task(task):
316
316
return ret
317
317
elif isinstance (task , RepeatedTask ):
318
318
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 )
321
335
return ret
322
336
else :
323
337
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):
352
366
config = get_config ()
353
367
354
368
alltasks = get_all_tasks_from_task (task )
369
+ alltaskchanges = get_all_task_changes_from_task (task )
355
370
356
371
if config .VALIDATE_SEDML :
357
372
for subtask in alltasks :
@@ -377,9 +392,7 @@ def preprocess_sed_task(task, variables, config=None, simulator_config=None):
377
392
solvers = {}
378
393
for subtasks in alltasks :
379
394
model = subtask .model
380
- allchanges = model .changes
381
- if isinstance (task , RepeatedTask ):
382
- allchanges = allchanges + task .changes
395
+ allchanges = model .changes + list (alltaskchanges )
383
396
sim = subtask .simulation
384
397
model_etree = lxml .etree .parse (model .source )
385
398
@@ -548,13 +561,19 @@ def get_model_change_target_tellurium_change_map(model_etree, changes, alg_kisao
548
561
if not isinstance (change , ModelAttributeChange ) and not isinstance (change , ComputeModelChange ):
549
562
continue
550
563
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 + "'" )
552
566
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 + "'" )
554
569
else :
555
570
change .symbol = None
556
571
__ , sep , __ = change .target .rpartition ('/@' )
557
572
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
+
558
577
sbml_id = change_targets_to_sbml_ids [change .target ]
559
578
560
579
if alg_kisao_id == 'KISAO_0000029' and sbml_id in species_ids :
0 commit comments