You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The optional attributes "initialAmount" and "initialConcentration", both having a data type of double, can be used to set the initial quantity of the species in the compartment where the species is located. These attributes are mutually exclusive; i.e., only one can have a value on any given instance of a Species_t object. Missing "initialAmount" and "initialConcentration" values implies that their values either are unknown, or to be obtained from an external source, or determined by an InitialAssignment_t or other SBML construct elsewhere in the model.
Until MIRA supports initialAmount, here is a workaround:
defupdate_SBML_for_MIRA(original_sbml_file, updated_sbml_file):
"""Updates the SBML file to ensure that the species name, initial concentrations, and has_only_substance_units are set."""# Read the SBML filedocument=libsbml.readSBMLFromFile(original_sbml_file)
model=document.getModel()
forspeciesinmodel.getListOfSpecies():
# Check if species has a valid IDifnotspecies.isSetId() ornotspecies.getId():
raiseValueError("A species found without a valid ID.")
# Set the species name to the ID if the name is not validifnotspecies.isSetName() ornotspecies.getName():
species.setName(species.getId())
# Set initial concentration using initial amount if not already validifnotspecies.isSetInitialConcentration() orspecies.getInitialConcentration() <=0:
ifspecies.isSetInitialAmount() andspecies.getInitialAmount() >=0:
species.setInitialConcentration(species.getInitialAmount())
else:
raiseValueError(f"Species '{species.getId()}' does not have a valid initial concentration or amount.")
# Set has_only_substance_units to Falsespecies.setHasOnlySubstanceUnits(False)
# Write the updated SBML filelibsbml.writeSBMLToFile(document, updated_sbml_file)
The text was updated successfully, but these errors were encountered:
djinnome
changed the title
initialAmount is not supported, but initialConcentration is
SBML initialAmount is not supported, but initialConcentration is
Sep 24, 2024
Hi folks,
If an SBML model contains
initialAmount
instead ofinitialConcentration
, then MIRA cannot read in the intial amount.From the libsbml specification:
Until MIRA supports
initialAmount
, here is a workaround:The text was updated successfully, but these errors were encountered: