libSBML C API
5.18.0
|
An object of class KineticLaw_t is used to describe the rate at which the process defined by a given Reaction_t takes place. KineticLaw_t has subelements called "math" (for MathML content) and "listOfParameters" (of class ListOfParameters_t), in addition to the attributes and subelements it inherits from SBase_t.
KineticLaw_t's "math" subelement for holding a MathML formula (required through SBML Level 3 Version 1, but optional as of SBML Level 3 Version 2) defines the rate of the reaction. The formula may refer to other entities in a model as well as local parameter definitions within the scope of the Reaction_t (see below). It is important to keep in mind, however, that the only Species_t identifiers that can be used in this formula are those declared in the lists of reactants, products and modifiers in the Reaction_t structure. (In other words, before a species can be referenced in the KineticLaw_t, it must be declared in one of those lists.)
KineticLaw_t provides a way to define local parameters whose identifiers can be used in the "math" formula of that KineticLaw_t instance. Prior to SBML Level 3, these parameter definitions are stored inside a "listOfParameters" subelement containing Parameter_t objects; in SBML Level 3, this is achieved using a specialized object class called LocalParameter_t and the containing subelement is called "listOfLocalParameters". In both cases, the parameters so defined are only visible within the KineticLaw_t (or, as of SBML Level 3 Version 2, only visible within the parent Reaction_t); they cannot be accessed outside. A local parameter within one reaction is not visible from within another reaction, nor is it visible to any other construct outside of the KineticLaw_t in which it is defined. In addition, another important feature is that if such a Parameter_t (or in Level 3, LocalParameter_t) object has the same identifier as another object in the scope of the enclosing Model_t, the definition inside the KineticLaw_t takes precedence. In other words, within the KineticLaw_t's "math" formula, references to local parameter identifiers shadow any identical global identifiers.
The values of local parameters defined within KineticLaw_t objects cannot change. In SBML Level 3, this quality is built into the LocalParameter_t construct. In Level 2, where the same kind of Parameter_t object class is used as for global parameters, the Parameter_t objects' "constant" attribute must always have a value of true
(either explicitly or left to its default value).
A common misconception is that different classes of objects (e.g., species, compartments, parameters) in SBML have different identifier scopes. They do not. The implication is that if a KineticLaw_t's local parameter definition uses an identifier identical to any other identifier defined in the model outside the KineticLaw_t, even if the other identifier does not belong to a parameter type of object, the local parameter's identifier takes precedence within that KineticLaw_t's "math" formula. It is not an error in SBML for identifiers to shadow each other this way, but can lead to confusing and subtle errors.
In SBML Level 2 Version 1, the SBML specification included two additional attributes on KineticLaw_t called "substanceUnits" and "timeUnits". They were removed beginning with SBML Level 2 Version 2 because further research determined they introduced many problems. The most significant problem was that their use could easily lead to the creation of valid models whose reactions nevertheless could not be integrated into a system of equations without outside knowledge for converting the quantities used. Examination of real-life models revealed that a common reason for using "substanceUnits" on KineticLaw_t was to set the units of all reactions to the same set of substance units, something that is better achieved by using UnitDefinition_t to redefine "substance"
for the whole Model_t.
As mentioned above, in SBML Level 2 Versions 2–4, local parameters are of class Parameter_t. In SBML Level 3, the class of object is LocalParameter_t.
In SBML Level 3 Version 2, the scope of the LocalParameter_t was expanded to the entire Reaction_t, instead of just the KineticLaw_t. This introduced a single new restriction: an L3v2 LocalParameter_t may not now shadow the id
of any Species_t referenced by a SpeciesReference_t in the same Reaction_t. Other than that, there is no difference in any core construct. However, packages may take advantage of this new scope by adding elements to the Reaction_t that may now reference a LocalParameter_t defined in the same Reaction_t.
Public Member Functions | |
int | KineticLaw_addLocalParameter (KineticLaw_t *kl, const LocalParameter_t *p) |
Adds a copy of the given LocalParameter_t structure to the list of local parameters in the given KineticLaw_t structure. More... | |
int | KineticLaw_addParameter (KineticLaw_t *kl, const Parameter_t *p) |
Adds a copy of the given Parameter_t structure to the list of local parameters in the given KineticLaw_t structure. More... | |
KineticLaw_t * | KineticLaw_clone (const KineticLaw_t *kl) |
Returns a deep copy of the given KineticLaw_t structure. More... | |
int | KineticLaw_containsUndeclaredUnits (KineticLaw_t *kl) |
Predicate returning true or false depending on whether the math expression of this KineticLaw_t contains parameters/numbers with undeclared units. More... | |
KineticLaw_t * | KineticLaw_create (unsigned int level, unsigned int version) |
Creates a new KineticLaw_t structure using the given SBML level and version values. More... | |
LocalParameter_t * | KineticLaw_createLocalParameter (KineticLaw_t *kl) |
Creates a new LocalParameter_t structure, adds it to the given KineticLaw_t structures's list of local parameters, and returns a pointer to the LocalParameter_t created. More... | |
Parameter_t * | KineticLaw_createParameter (KineticLaw_t *kl) |
Creates a new Parameter_t structure, adds it to the given KineticLaw_t structures's list of parameters, and returns a pointer to the Parameter_t created. More... | |
KineticLaw_t * | KineticLaw_createWithNS (SBMLNamespaces_t *sbmlns) |
Creates a new KineticLaw_t structure using the given SBMLNamespaces_t structure. More... | |
void | KineticLaw_free (KineticLaw_t *kl) |
Frees the given KineticLaw_t structure. More... | |
UnitDefinition_t * | KineticLaw_getDerivedUnitDefinition (KineticLaw_t *kl) |
Calculates and returns a UnitDefinition_t that expresses the units returned by the math expression of this KineticLaw_t. More... | |
const char * | KineticLaw_getFormula (const KineticLaw_t *kl) |
Gets the mathematical expression of this KineticLaw_t structure as a formula in text-string form. More... | |
ListOf_t * | KineticLaw_getListOfLocalParameters (KineticLaw_t *kl) |
Get the list of local parameters defined for the given KineticLaw_t structure. More... | |
ListOf_t * | KineticLaw_getListOfParameters (KineticLaw_t *kl) |
Get the list of parameters defined for the given KineticLaw_t structure. More... | |
LocalParameter_t * | KineticLaw_getLocalParameter (KineticLaw_t *kl, unsigned int n) |
Get the nth parameter in the list of local parameters in the given KineticLaw_t structure. More... | |
LocalParameter_t * | KineticLaw_getLocalParameterById (KineticLaw_t *kl, const char *sid) |
Get a parameter with identifier "id" out of the list of local parameters defined for the given KineticLaw_t structure. More... | |
const ASTNode_t * | KineticLaw_getMath (const KineticLaw_t *kl) |
Gets the mathematical expression of this KineticLaw_t structure as an ASTNode_t structure. More... | |
const XMLNamespaces_t * | KineticLaw_getNamespaces (KineticLaw_t *kl) |
Returns a list of XMLNamespaces_t associated with this KineticLaw_t structure. More... | |
unsigned int | KineticLaw_getNumLocalParameters (const KineticLaw_t *kl) |
Get the number of local parameters defined in the given KineticLaw_t structure. More... | |
unsigned int | KineticLaw_getNumParameters (const KineticLaw_t *kl) |
Get the number of parameters defined in the given KineticLaw_t structure. More... | |
Parameter_t * | KineticLaw_getParameter (KineticLaw_t *kl, unsigned int n) |
Get the nth parameter in the list of parameters in the given KineticLaw_t structure. More... | |
Parameter_t * | KineticLaw_getParameterById (KineticLaw_t *kl, const char *sid) |
Get a parameter with identifier "id" out of the list of local parameters defined for the given KineticLaw_t structure. More... | |
const char * | KineticLaw_getSubstanceUnits (const KineticLaw_t *kl) |
Gets the value of the "substanceUnits" attribute of the given KineticLaw_t structure. More... | |
const char * | KineticLaw_getTimeUnits (const KineticLaw_t *kl) |
Gets the value of the "timeUnits" attribute of the given KineticLaw_t structure. More... | |
int | KineticLaw_isSetFormula (const KineticLaw_t *kl) |
Predicate returning 1 (true) or 0 (false) depending on whether the "formula" attribute of the given KineticLaw_t structure is set. More... | |
int | KineticLaw_isSetMath (const KineticLaw_t *kl) |
Predicate returning 1 (true) or 0 (false) depending on whether the "math" subelement of the given KineticLaw_t structure is set. More... | |
int | KineticLaw_isSetSubstanceUnits (const KineticLaw_t *kl) |
Predicate returning 1 (true) or 0 (false) depending on whether the "timeUnits" attribute of the given KineticLaw_t structure is set. More... | |
int | KineticLaw_isSetTimeUnits (const KineticLaw_t *kl) |
Predicate returning 1 (true) or 0 (false) depending on whether the "timeUnits" attribute of the given KineticLaw_t structure is set. More... | |
LocalParameter_t * | KineticLaw_removeLocalParameter (KineticLaw_t *kl, unsigned int n) |
Removes the nth LocalParameter_t structure from the list of local parameters in this KineticLaw_t structure and returns a pointer to it. More... | |
LocalParameter_t * | KineticLaw_removeLocalParameterById (KineticLaw_t *kl, const char *sid) |
Removes the LocalParameter_t structure with the given "id" attribute from the list of local parameters in this KineticLaw_t structure and returns a pointer to it. More... | |
Parameter_t * | KineticLaw_removeParameter (KineticLaw_t *kl, unsigned int n) |
Removes the nth Parameter_t structure from the list of parameters in this KineticLaw_t structure and returns a pointer to it. More... | |
Parameter_t * | KineticLaw_removeParameterById (KineticLaw_t *kl, const char *sid) |
Removes the Parameter_t structure with the given "id" attribute from the list of parameters in this KineticLaw_t structure and returns a pointer to it. More... | |
int | KineticLaw_setFormula (KineticLaw_t *kl, const char *formula) |
Sets the formula of the given KineticLaw_t structure. More... | |
int | KineticLaw_setMath (KineticLaw_t *kl, const ASTNode_t *math) |
Sets the formula of the given KineticLaw_t structure. More... | |
int | KineticLaw_setSubstanceUnits (KineticLaw_t *kl, const char *sid) |
Sets the "substanceUnits" attribute of the given KineticLaw_t structure. More... | |
int | KineticLaw_setTimeUnits (KineticLaw_t *kl, const char *sid) |
Sets the "timeUnits" attribute of the given KineticLaw_t structure. More... | |
int | KineticLaw_unsetSubstanceUnits (KineticLaw_t *kl) |
Unsets the "substanceUnits" attribute of the given KineticLaw_t structure. More... | |
int | KineticLaw_unsetTimeUnits (KineticLaw_t *kl) |
Unsets the "timeUnits" attribute of the given KineticLaw_t structure. More... | |
int KineticLaw_addLocalParameter | ( | KineticLaw_t * | kl, |
const LocalParameter_t * | p | ||
) |
Adds a copy of the given LocalParameter_t structure to the list of local parameters in the given KineticLaw_t structure.
kl | the KineticLaw_t structure. |
p | a pointer to a LocalParameter_t structure. |
int KineticLaw_addParameter | ( | KineticLaw_t * | kl, |
const Parameter_t * | p | ||
) |
Adds a copy of the given Parameter_t structure to the list of local parameters in the given KineticLaw_t structure.
kl | the KineticLaw_t structure. |
p | a pointer to a Parameter_t structure. |
KineticLaw_t * KineticLaw_clone | ( | const KineticLaw_t * | kl | ) |
Returns a deep copy of the given KineticLaw_t structure.
kl | the KineticLaw_t structure. |
int KineticLaw_containsUndeclaredUnits | ( | KineticLaw_t * | kl | ) |
Predicate returning true
or false
depending on whether the math expression of this KineticLaw_t contains parameters/numbers with undeclared units.
true
if the math expression of this KineticLaw_t includes parameters/numbers with undeclared units, false
otherwise.true
indicates that the UnitDefinition_t returned by the getDerivedUnitDefinition function may not accurately represent the units of the expression.KineticLaw_t * KineticLaw_create | ( | unsigned int | level, |
unsigned int | version | ||
) |
Creates a new KineticLaw_t structure using the given SBML level
and version
values.
level | an unsigned int, the SBML Level to assign to this KineticLaw_t. |
version | an unsigned int, the SBML Version to assign to this KineticLaw_t. |
LocalParameter_t * KineticLaw_createLocalParameter | ( | KineticLaw_t * | kl | ) |
Creates a new LocalParameter_t structure, adds it to the given KineticLaw_t structures's list of local parameters, and returns a pointer to the LocalParameter_t created.
kl | the KineticLaw_t structure. |
NULL
if kl
is NULL
, or if its namepace indicates it is an SBML Level 1 or 2 object.Parameter_t * KineticLaw_createParameter | ( | KineticLaw_t * | kl | ) |
Creates a new Parameter_t structure, adds it to the given KineticLaw_t structures's list of parameters, and returns a pointer to the Parameter_t created.
kl | the KineticLaw_t structure. |
NULL
if kl
is NULL
, or if its namepace indicates it is an SBML Level 3 object.KineticLaw_t * KineticLaw_createWithNS | ( | SBMLNamespaces_t * | sbmlns | ) |
Creates a new KineticLaw_t structure using the given SBMLNamespaces_t structure.
sbmlns | SBMLNamespaces_t, a pointer to an SBMLNamespaces_t structure to assign to this KineticLaw_t. |
void KineticLaw_free | ( | KineticLaw_t * | kl | ) |
Frees the given KineticLaw_t structure.
kl | the KineticLaw_t structure. |
UnitDefinition_t * KineticLaw_getDerivedUnitDefinition | ( | KineticLaw_t * | kl | ) |
Calculates and returns a UnitDefinition_t that expresses the units returned by the math expression of this KineticLaw_t.
Note that the functionality that facilitates unit analysis depends on the model as a whole. Thus, in cases where the object has not been added to a model or the model itself is incomplete, unit analysis is not possible and this method will return NULL
.
const char * KineticLaw_getFormula | ( | const KineticLaw_t * | kl | ) |
Gets the mathematical expression of this KineticLaw_t structure as a formula in text-string form.
This is fundamentally equivalent to KineticLaw_getMath(). It is provided principally for compatibility with SBML Level 1.
kl | the KineticLaw_t structure. |
ListOf_t * KineticLaw_getListOfLocalParameters | ( | KineticLaw_t * | kl | ) |
Get the list of local parameters defined for the given KineticLaw_t structure.
kl | the KineticLaw_t structure. |
ListOf_t * KineticLaw_getListOfParameters | ( | KineticLaw_t * | kl | ) |
Get the list of parameters defined for the given KineticLaw_t structure.
kl | the KineticLaw_t structure. |
LocalParameter_t * KineticLaw_getLocalParameter | ( | KineticLaw_t * | kl, |
unsigned int | n | ||
) |
Get the nth parameter in the list of local parameters in the given KineticLaw_t structure.
Callers should first find out how many parameters are in the list by calling KineticLaw_getNumLocalParameters().
kl | the KineticLaw_t structure. |
n | the index of the LocalParameter_t structure sought. |
LocalParameter_t * KineticLaw_getLocalParameterById | ( | KineticLaw_t * | kl, |
const char * | sid | ||
) |
Get a parameter with identifier "id" out of the list of local parameters defined for the given KineticLaw_t structure.
kl | the KineticLaw_t structure. |
sid | the identifier of the LocalParameter_t structure sought. |
id
, or NULL
if no such LocalParameter_t exists in the given KineticLaw_t structure. const ASTNode_t * KineticLaw_getMath | ( | const KineticLaw_t * | kl | ) |
Gets the mathematical expression of this KineticLaw_t structure as an ASTNode_t structure.
This is fundamentally equivalent to KineticLaw_getFormula(). The latter is provided principally for compatibility with SBML Level 1, which represented mathematical formulas in text-string form.
kl | the KineticLaw_t structure. |
const XMLNamespaces_t * KineticLaw_getNamespaces | ( | KineticLaw_t * | kl | ) |
Returns a list of XMLNamespaces_t associated with this KineticLaw_t structure.
kl | the KineticLaw_t structure. |
unsigned int KineticLaw_getNumLocalParameters | ( | const KineticLaw_t * | kl | ) |
Get the number of local parameters defined in the given KineticLaw_t structure.
kl | the KineticLaw_t structure. |
unsigned int KineticLaw_getNumParameters | ( | const KineticLaw_t * | kl | ) |
Get the number of parameters defined in the given KineticLaw_t structure.
kl | the KineticLaw_t structure. |
Parameter_t * KineticLaw_getParameter | ( | KineticLaw_t * | kl, |
unsigned int | n | ||
) |
Get the nth parameter in the list of parameters in the given KineticLaw_t structure.
Callers should first find out how many parameters are in the list by calling KineticLaw_getNumParameters().
kl | the KineticLaw_t structure. |
n | the index of the Parameter_t structure sought. |
Parameter_t * KineticLaw_getParameterById | ( | KineticLaw_t * | kl, |
const char * | sid | ||
) |
Get a parameter with identifier "id" out of the list of local parameters defined for the given KineticLaw_t structure.
kl | the KineticLaw_t structure. |
sid | the identifier of the Parameter_t structure sought. |
id
, or NULL
if no such Parameter_t exists in the given KineticLaw_t structure. const char * KineticLaw_getSubstanceUnits | ( | const KineticLaw_t * | kl | ) |
Gets the value of the "substanceUnits" attribute of the given KineticLaw_t structure.
kl | the KineticLaw_t structure. |
const char * KineticLaw_getTimeUnits | ( | const KineticLaw_t * | kl | ) |
Gets the value of the "timeUnits" attribute of the given KineticLaw_t structure.
kl | the KineticLaw_t structure. |
int KineticLaw_isSetFormula | ( | const KineticLaw_t * | kl | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the "formula" attribute of the given KineticLaw_t structure is set.
This is fundamentally equivalent to KineticLaw_isSetMath(). It is provided principally for compatibility with SBML Level 1.
kl | the KineticLaw_t structure. |
1
(true) if the formula (or equivalently the "math" subelement) of the given KineticLaw_t structure is set, 0
(false) otherwise.int KineticLaw_isSetMath | ( | const KineticLaw_t * | kl | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the "math" subelement of the given KineticLaw_t structure is set.
This is fundamentally equivalent to KineticLaw_isSetFormula(). The latter provided principally for compatibility with SBML Level 1, which represented mathematical formulas in text-string form.
kl | the KineticLaw_t structure. |
1
(true) if the "math" subelement of the given KineticLaw_t structure is set, 0
(false) otherwise. int KineticLaw_isSetSubstanceUnits | ( | const KineticLaw_t * | kl | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the "timeUnits" attribute of the given KineticLaw_t structure is set.
kl | the KineticLaw_t structure. |
1
(true) if the "timeUnits" attribute of the given KineticLaw_t structure is set, 0
(false) otherwise.int KineticLaw_isSetTimeUnits | ( | const KineticLaw_t * | kl | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the "timeUnits" attribute of the given KineticLaw_t structure is set.
kl | the KineticLaw_t structure. |
1
(true) if the "timeUnits" attribute of the given KineticLaw_t structure is set, 0
(false) otherwise.LocalParameter_t * KineticLaw_removeLocalParameter | ( | KineticLaw_t * | kl, |
unsigned int | n | ||
) |
Removes the nth LocalParameter_t structure from the list of local parameters in this KineticLaw_t structure and returns a pointer to it.
The caller owns the returned structure and is responsible for deleting it.
kl | the KineticLaw_t structure. |
n | the integer index of the LocalParameter_t sought. |
NULL
is returned if the given index is out of range. LocalParameter_t * KineticLaw_removeLocalParameterById | ( | KineticLaw_t * | kl, |
const char * | sid | ||
) |
Removes the LocalParameter_t structure with the given "id" attribute from the list of local parameters in this KineticLaw_t structure and returns a pointer to it.
The caller owns the returned structure and is responsible for deleting it.
kl | the KineticLaw_t structure. |
sid | the string of the "id" attribute of the LocalParameter_t sought. |
NULL
is returned if no KineticLaw_t structure with the identifier exists in this KineticLaw_t structure. Parameter_t * KineticLaw_removeParameter | ( | KineticLaw_t * | kl, |
unsigned int | n | ||
) |
Removes the nth Parameter_t structure from the list of parameters in this KineticLaw_t structure and returns a pointer to it.
The caller owns the returned structure and is responsible for deleting it.
kl | the KineticLaw_t structure. |
n | the integer index of the Parameter_t sought. |
NULL
is returned if the given index is out of range. Parameter_t * KineticLaw_removeParameterById | ( | KineticLaw_t * | kl, |
const char * | sid | ||
) |
Removes the Parameter_t structure with the given "id" attribute from the list of parameters in this KineticLaw_t structure and returns a pointer to it.
The caller owns the returned structure and is responsible for deleting it.
kl | the KineticLaw_t structure. |
sid | the string of the "id" attribute of the Parameter_t sought. |
NULL
is returned if no KineticLaw_t structure with the identifier exists in this KineticLaw_t structure. int KineticLaw_setFormula | ( | KineticLaw_t * | kl, |
const char * | formula | ||
) |
Sets the formula of the given KineticLaw_t structure.
This is fundamentally equivalent to KineticLaw_setMath(). It is provided principally for compatibility with SBML Level 1.
kl | the KineticLaw_t structure. |
formula | the mathematical expression, in text-string form. |
int KineticLaw_setMath | ( | KineticLaw_t * | kl, |
const ASTNode_t * | math | ||
) |
Sets the formula of the given KineticLaw_t structure.
This is fundamentally equivalent to KineticLaw_setFormula(). The latter provided principally for compatibility with SBML Level 1, which represented mathematical formulas in text-string form.
kl | the KineticLaw_t structure. |
math | an ASTNode_t structure representing the mathematical formula. |
int KineticLaw_setSubstanceUnits | ( | KineticLaw_t * | kl, |
const char * | sid | ||
) |
Sets the "substanceUnits" attribute of the given KineticLaw_t structure.
The identifier string sid
is copied.
kl | the KineticLaw_t structure. |
sid | the identifier of the units. |
sid
of NULL is equivalent to unsetting the "substanceUnits" attribute.int KineticLaw_setTimeUnits | ( | KineticLaw_t * | kl, |
const char * | sid | ||
) |
Sets the "timeUnits" attribute of the given KineticLaw_t structure.
The identifier string sid
is copied.
kl | the KineticLaw_t structure. |
sid | the identifier of the units. |
sid
of NULL is equivalent to unsetting the "timeUnits" attribute.int KineticLaw_unsetSubstanceUnits | ( | KineticLaw_t * | kl | ) |
Unsets the "substanceUnits" attribute of the given KineticLaw_t structure.
kl | the KineticLaw_t structure. |
int KineticLaw_unsetTimeUnits | ( | KineticLaw_t * | kl | ) |
Unsets the "timeUnits" attribute of the given KineticLaw_t structure.
kl | the KineticLaw_t structure. |