SBML assignment

Skip to first unread message

Hideki Oka

Mar 29, 2022, 4:50:22 AMMar 29
to COPASI User Forum
How COPASI solves discrepancy between SBML assignment order and real calculation order ? I meet a big trouble.


Frank Bergmann

Mar 29, 2022, 5:28:48 AMMar 29
to COPASI User Forum
Hello Oka, 

in SBML assignment rules are not allowed to have algebraic loops. It does not specify the order  in which  assignment rules are calculated, or how many times. 

  For example this set of assignments is invalid: a = a + 1; or b = c + 10 and c = b + 12, as they contain loops. 
  On the other hand here a valid example: b = a + 10; a = 10;

There are tests in the SBML test suite that ensure this. 

COPASI looks at the dependencies of the rules, and evaluates them as efficiently as possible. 

I'd be happy to look at the model in question, so we can solve a specific problem, or you could list your assignments here and we can have a look . 


Hideki Oka

Apr 10, 2022, 10:57:29 PMApr 10
to COPASI User Forum
Dear Frank,

Thank you for your reply.
I am going to run C code which COPASI outputs.
This code also have algebraic errors. I correct by rearranging the orders and run it, but failed.
May be a unit problem, especially time unit or parameter normalization ....
I am sorry my model is another person's one and is difficult to pass to you.
I am very happy if you show me some C code which runs successfully output an correct answer.

Best regards,


2022年3月29日火曜日 18:28:48 UTC+9

Frank Bergmann

Apr 11, 2022, 2:36:00 AMApr 11
to COPASI User Forum
Just seeing the code, it should be possible to construct an arbitrary model (with non-descript variables A, B C..), that it could run on (We would just have to know which of the variable is then changed by the code piece, and which of them already have assignments on them). 

I can of course create an example for you, but i don't yet have enough information as to what the example should encompass. If you write in abstract terms what the example should do, then i could do that, maybe in a simple form like: 

* read sbml model (that has species a, b, c, and an assignment rule on c)
* add an assignment to b that depends on a and c

or some such. Once i have that specification i'm happy to create such an example. 

Another approach would be for you to perform the individual steps, you perform in your c program, in the COPASI user interface, saving the model after each step. And then compare the difference, what do you achieve in that step in the C++ program, what is the different result (if any) when doing this in the GUI. 

All the best

Hideki Oka

Apr 12, 2022, 4:40:45 AMApr 12
to COPASI User Forum
Dear Frank,

Instead of my modell, similar model is registered in BioModels MODEL1807190001.
Thanks to Dr. Sveshnikova.
This SBML model runs successfully on COPASI.
But C code from COPASI shows errors because of assignment ordering.
I put out y[30] values for example.
  0  1.378446e-22

 1  -2.366583e-30

 2  1.095960e-16

 3  1.577722e-30

 4  -4.930381e-32

 5  3.000000e-15

 6  6.000000e-13

 7  -1.972152e-31

 8  3.000000e-16

 9  3.336215e-05

10  6.088643e-01

11  3.000000e-15

12  9.033210e+01

13  1.800000e-10

14  0.000000e+00

15  1.800000e-10

16  0.000000e+00

17  nan

18  nan

19  5.194856e+00

20  1.323489e-02

21  nan

22  3.968254e-01

23  2.381154e-01

24  nan

25  1.786551e+00

26  inf

27  0.000000e+00

28  0.000000e+00

29  0.000000e+00

I hope C code from COPASI have a right answer,

Because COPASI seems to get a right answer, what does COPASI do ?

Best regards,


2022年4月11日月曜日 15:36:00 UTC+9

Frank Bergmann

Apr 13, 2022, 4:19:53 AMApr 13
to COPASI User Forum
Now I understood you, you were talking about the C Exporter. And indeed, the ODE exporters (same for Berkeley Madonna and XPP) were written mainly with ODE's in mind. While we tried to export assignments as well, the ODE export does not use the same dependency resolution as COPASI does. 

Sorry for the inconvenience

Reply all
Reply to author
0 new messages