Model Classes

class modelclasses.Species(value, valueType, compartment, hasOnlySubstanceUnits, constant=False, metadata=None)

This class represents a species as defined by SBML.

Parameters:
  • value (float) – Sets either the value of conentration or amount, depending on the concentrationIn value.
  • valueType (str) – If valueType is equal to”Concentration”, the amount input is assigned to the concentration member. Otherwise, amount is assigned to the amount member.
  • compartment (Compartment) – Sets the compartment member to reference this input.
  • hasOnlySubstanceUnits (bool) – Determines if the species concentration or amount is used is rate laws
  • constant (bool) – If true, any attempts to modify the amount or concentration member fail.
  • metadata (SBMLMetadata) – An object containing information about the model component stored in the SBML file
metadata

Additional information about the species contained in the SBML model

Type:SBMLMetadata
amount

The total amount of the species that is present. This volume is constant with respect to compartment size, unless the hasOnlySubstanceUnits member equals True and the species is modified by a rule or an event (events are currently not supported). Changes to this member are automatically apply to concentration as well.

Type:float
compartment

The compartment that this species is contained within.

Type:Compartment
concentration

The concentration of the species. Direct changes to this member are automatically applied to amount as well.

Type:float
class modelclasses.Compartment(size, dimensionality, isConstant=False, metadata=None)

This class represents a compartment which is one of the model elements in SBML.

Each species is associated with one compartment by referencing the appropriate compartment with its own compartment member.

Parameters:
  • size (float) – This value represents the size of the shape. Whether this is a volume or an area is determined by the compartments dimensionality. If the compartment is set to be constant, assigning a value to this compartment fails and a warning is raised.
  • dimensionality (int or float) – The number of spatial dimensions this compartment exists in. This is not limited to whole numbers.
  • isConstant (bool) – If true, the compartment will be set to constant and attempts to change the size attribute will raise warnings.
  • metadata (SBMLMetadata) – An object containing information about the model component stored in the SBML file
dimensionality

The dimensionality of the compartment

Type:float
metadata

Additional information about the compartment contained in the SBML model

Type:SBMLMetadata
size

The size of the comparment. This is used by species to calculate their concentrations.

Type:float
class modelclasses.Parameter(value, Id, constant=False, units=None, metadata=None)

This class represents a parameter as defined by SBML.

Parameters:
  • value (float) – Sets either the value of the parameter.
  • Id (str) – The Id of the parameter
  • constant (bool) – If true, any attempts to modify the value member fail.
  • metadata (SBMLMetadata) – An object containing information about the model component stored in the SBML file
metadata

Additional information about the species contained in the SBML model

Type:SBMLMetadata
class modelclasses.Model

This class is inhereted by model classes generated .

SearchParametersByName(name, suppress = False)
SearchCompartmentsByName(name, suppress = False)
SearchSpeciesByName(name, suppress = False)
SearchReactionsByName(name, suppress = False)
SearchFunctionsByName(name, suppress = False)
SearchComponentsByName(componentDict, name, suppress = False)

Searches a dictionary of SBML model components for any components that match the name argument. This method raises an exception if the suppress keyword argument is False and a match is not found. The other search methods (eg. SearchParametersByName) serve as wrappers for this method.

modelclasses.Piecewise(expression1, condition1 [, expression2, condition2 [,...]] [, otherwise])

This function implements the Piecewise function used in SBML models.

Parameters:
  • expressionN (float) – A numerical value calculated using the appropriate expression for a portion of the functions range.
  • conditionN (bool) – A boolean that is true if the independent variable(s) are within the portion of the domain whose range is defined by the corresponding exrpession.
  • otherwise (float) – An optional numerical value that returned if all conditions are false.
Returns:

The first expression passed as arguement with a true condition, read left to right. If all conditions are false, otherwise is returned.

Return type:

float

Raises:

Exception – Raises a generic exception if no condition is true and otherwise is not specified.

Notes

This function is not intended to be used by a user, but is defined to be used by generated Python models. This function is defined in a way that matches how libSBML formats piecewise functions used in SBML models. The inputs to this function are not actually evaluted inside of the function, but are evaluated before being passed to the function. For example, if Piecewise() is called like so:

\[Piecewise(x + 2, x < 3, x + 4, x > 3)\]

and if x = 2, then the arguments will be evaluated to

\[Piecewise(4, True, 6, False)\]

In this case, if x = 3, an exception will be raised, as all conditons will evaluate to False and otherwise is not provided.