How to Handle Species with Mixed Units in COPASI and Why It Divides by Compartment Volume

49 views
Skip to first unread message

Ahmed Atta

unread,
Jan 20, 2025, 10:15:20 AMJan 20
to COPASI User Forum

Hi everyone,

I have a QSP model saved as an SBML file that I want to analyze in COPASI for stability, steady state, and related properties. My model includes species with different units—some are in cells, while others are in concentrations.

When I load the model into COPASI, it automatically divides all species values by the volume of their compartments. I’m unsure why this happens or how to disable this behavior in COPASI.

Additionally, when I modify the compartment volume (e.g., set it to 1), the steady-state and stability results differ significantly from the original.

Could anyone explain why this happens and how I can address it?

Thanks in advance for your help!

Pedro Mendes

unread,
Jan 22, 2025, 12:15:30 PMJan 22
to copasi-u...@googlegroups.com
*** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

Hi,

The SBML standard is somewhat complicated relating to the units of the
reaction rates, particularly versions 1 and 2. So COPASI's
interpretation of the SBML depends on how it was written in particular.

So, to answer your question with precision we would need to see the SBML
file; would you be able to share it with us? (If you prefer you can send
it to my email privately)

SBML levels 1 and 2 allow species to be specified either in units of
amount or concentration; that, in turn, will affect how the rates of
reaction should be interpreted (amount/time or concentration/time); the
division by the volume that COPASI adds depends on which one is used in
the file.

Nothing is a problem when there is only one compartment or if all
compartments have unit size. When they don't the volumes will start
affecting the models (as they should since it is only amounts that are
conserved in reactions across compartments, not the concentrations)

There is a much longer explanation that I'm leaving out for now, if it
is needed I'll bring it up later in this thread

thanks
Pedro


--
Pedro Mendes, PhD
Professor and Director
Richard D. Berlin Center for Cell Analysis and Modeling
University of Connecticut School of Medicine
group website: http://www.comp-sys-bio.org

Lilija

unread,
May 7, 2025, 10:26:06 AMMay 7
to COPASI User Forum

Dear Pedro,

 

Thank you for your response. I’m encountering a similar issue.

 

I would like to obtain a model in mass amounts and I would not like to have a volume scaling of the species.

 

The model is in SBML level 2 version 4 and was exported from SimBiology MATLAB toolbox.

 

How to achieve this?


I am grateful for any leads you may have,

Lilija

Matthias König

unread,
May 7, 2025, 10:51:47 AMMay 7
to copasi-u...@googlegroups.com

Converting species from concentrations to amounts is complex and highly dependent on the structure of your model. Below are some explanations that may help clarify the process:

  • Reaction rates (i.e., the units of kinetic laws) are expressed in substance_unit/time_unit.

  • Depending on whether your species are defined in amounts (hasOnlySubstanceUnits=True) or in concentrations (hasOnlySubstanceUnits=False), the rates are divided by the corresponding compartment volume when generating the differential equations. (These are also weighted by stoichiometric coefficients and any defined conversionFactors.)

There are several possible scenarios depending on how your model is set up:

  1. All species are in amounts (hasOnlySubstanceUnits=True)
    In this case, no changes are necessary—you’re essentially done.

  2. Some or all species are in concentrations (hasOnlySubstanceUnits=False)
    In this case, you’ll need to set hasOnlySubstanceUnits=True for those species and update all rate equations where these species appear.
    For example, if S1 and S2 are in concentration and you want to convert them to amounts, you must update all math expressions involving S1 and S2 to S1/V1 and S2/V2, respectively—i.e., divide each species by its compartment volume to preserve the mathematical meaning.
    Additionally, you’ll need to update all relevant InitialAssignments, AssignmentRules, EventAssignments, and RateRules.

Because this process is error-prone, I recommend the following strategy if you’re determined to convert species to amounts:

  • Create a reference simulation to compare against your converted model.

  • Convert the model to SBML Level 3 Version 2 using libSBML.

  • Load the model using Antimony or sbmlutils.

  • Add complete unit annotations to your model.

  • Run unit validation to ensure all units are consistent—this step is essential for catching any missing volume conversions in your equations.

  • Make the necessary changes and re-validate the model.

  • Run simulations again and confirm that the numerical results are unchanged.

In summary: This is a non-trivial task, and you should only proceed if you clearly understand what you're doing and why.
In my opinion, converting everything to amounts isn’t necessary. You can work with species in either amounts or concentrations. If you need to access amounts explicitly, simply define observables via AssignmentRules, e.g.:

amount_S1 := S1 * V1

Furthermore, tools like libRoadRunner or basico allow you to read out either amounts or concentrations directly.

Could you explain why you need to convert species to amounts? I don’t currently see a compelling use case where this would be required.

Best regards,
Matthias



--
You received this message because you are subscribed to the Google Groups "COPASI User Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to copasi-user-fo...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/copasi-user-forum/c879d185-b914-4c22-a618-51ec65462234n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages