libSBML
5.8.0

org.sbml.libsbml
Class Reaction

java.lang.Object
  extended by org.sbml.libsbml.SBase
      extended by org.sbml.libsbml.Reaction

public class Reaction
extends SBase

Implementation of SBML's Reaction construct.

A reaction represents any transformation, transport or binding process, typically a chemical reaction, that can change the quantity of one or more species. In SBML, a reaction is defined primarily in terms of the participating reactants and products (and their corresponding stoichiometries), along with optional modifier species, an optional rate at which the reaction takes place, and optional parameters.

As with other major object in SBML, Reaction has a mandatory attribute, 'id', used to give the compartment type an identifier. The identifier must be a text string conforming to the identifer syntax permitted in SBML. In SBML Level 2 and Level 3, the reaction 'id' identifier can be used in mathematical formulas elsewhere in an SBML model to represent the rate of that reaction; this usage is explained below. Reaction also has an optional 'name' attribute, of type string. The 'id' and 'name' must be used according to the guidelines described in the SBML specification.

The species participating as reactants, products, and/or modifiers in a reaction are declared using lists of SpeciesReference and/or ModifierSpeciesReference instances stored in subelements 'listOfReactants', 'listOfProducts' and 'listOfModifiers'. Certain restrictions are placed on the appearance of species in reaction definitions:

A reaction can contain up to one KineticLaw object in a subelement named 'kineticLaw'. It defines the speed at which the process defined by the reaction takes place. The description of KineticLaw provides more details about its use. Note that although the inclusion of a KineticLaw object in an instance of a Reaction component is optional, there is no useful default that can be substituted in place of a missing rate expression in a reaction. Moreover, a reaction's rate cannot be defined in any other way in SBML—InitialAssignment, AssignmentRule, RateRule, AlgebraicRule, Event, and other constructs in SBML cannot be used to set the reaction rate separately. Nevertheless, for some modeling applications, reactions without any defined rate can be perfectly acceptable.

Reaction also has a boolean attribute named 'reversible' for indicating whether the reaction is reversible. This attribute is optional in SBML Level 2, with a default of true; it is mandatory in SBML Level 3 (with no default value). To say that a reaction is reversible is to say it can proceed in either the forward or the reverse direction. Although the reversibility of a reaction can sometimes be deduced by inspecting its rate expression, this is not always the case, especially for complicated expressions. Moreover, the need in SBML to allow rate expressions (i.e., KineticLaw) to be optional leads to the need for a separate flag indicating reversibility. Note that labeling a reaction as irreversible is an assertion that the reaction always proceeds in the given forward direction. (Why else would it be flagged as irreversible?) This implies the rate expression in the KineticLaw always has a non-negative value during simulations. Software tools could provide a means of optionally testing that this condition holds. The presence of reversibility information in two places (i.e., the rate expression and the 'reversible' attribute on Reaction) leaves open the possibility that a model could contain contradictory information, but the creation of such a model would be an error on the part of the software generating it.

The Reaction object class has another boolean attribute called 'fast'. This attribute is optional in SBML Level 2, with a default of false; it is mandatory in SBML Level 3 (with no default value). It is used to indicate that a reaction occurs on a vastly faster time scale than others in a system. Readers are directed to the SBML Level 2 Version 4 specification, which provides more detail about the conditions under which a reaction can be considered to be fast in this sense. The attribute's default value is false. SBML Level 1 and Level 2 Version 1 incorrectly claimed that software tools could ignore this attribute if they did not implement support for the corresponding concept; however, further research in SBML has revealed that this is not true, and 'fast' cannot be ignored if it is set to true. SBML Level 2 Versions 2–4 therefore stipulate that if a model has any reactions with 'fast' set to true, a software tool must be able to respect the attribute or else indicate to the user that it does not have the capacity to do so. Analysis software cannot ignore the value of the 'fast' attribute because doing so may lead to different results as compared to a software system that does make use of 'fast'.

In SBML Level 3 Version 1, the Reaction object has an additional optional attribute named 'compartment', whose value must be the identifier of a compartment defined in the enclosing Model object. The 'compartment' attribute can be used to indicate the compartment in which the reaction is assumed to take place. If the attribute is present, its value must be the identifier of a Compartment object defined in the enclosing Model object. Similar to the 'reversible' attribute, the value of the 'compartment' attribute has no direct impact on the construction of mathematical equations for the SBML model. When a kinetic law is given for a reaction, the compartment location may already be implicit in the kinetic law (although this cannot always be guaranteed). Nevertheless, software tools may find the 'compartment' attribute value useful for such purposes as analyzing the structure of the model, guiding the modeler in constructing correct rate formulas, and visualization purposes.

Readers are urged to read the SBML specification for more details about the proper use of Reaction.


Constructor Summary
Reaction(long level, long version)
          Creates a new Reaction using the given SBML level and version values.
Reaction(Reaction orig)
          Copy constructor; creates a copy of this Reaction.
Reaction(SBMLNamespaces sbmlns)
          Creates a new Reaction using the given SBMLNamespaces object sbmlns.
 
Method Summary
 int addModifier(ModifierSpeciesReference msr)
          Adds a given ModifierSpeciesReference object as a product in this Reaction.
 int addProduct(SpeciesReference sr)
          Adds a given SpeciesReference object as a product in this Reaction.
 int addReactant(SpeciesReference sr)
          Adds a given SpeciesReference object as a reactant in this Reaction.
 Reaction cloneObject()
          Creates and returns a deep copy of this Reaction.
 KineticLaw createKineticLaw()
          Creates a new KineticLaw object, installs it as this Reaction's 'kineticLaw' subelement, and returns it.
 ModifierSpeciesReference createModifier()
          Creates a new ModifierSpeciesReference, adds it to this Reaction's list of modifiers and returns it.
 SpeciesReference createProduct()
          Creates a new SpeciesReference, adds it to this Reaction's list of products, and returns it.
 SpeciesReference createReactant()
          Creates a new SpeciesReference, adds it to this Reaction's list of reactants, and returns it.
 void delete()
          Explicitly deletes the underlying native object.
 String getCompartment()
          (SBML Level 3 only) Returns the value of the 'compartment' attribute on the Reaction.
 SBase getElementByMetaId(String metaid)
          Returns the first child element it can find with the given metaid, or null if no such object is found.
 SBase getElementBySId(String id)
          Returns the first child element found that has the given id in the model-wide SId namespace, or null if no such object is found.
 String getElementName()
          Returns the XML element name of this object, which for Reaction, is always 'reaction'.
 boolean getFast()
          Returns the value of the 'fast' attribute of this Reaction.
 String getId()
          Returns the value of the 'id' attribute of this Reaction.
 KineticLaw getKineticLaw()
          Returns the KineticLaw object contained in this Reaction.
 ListOfSpeciesReferences getListOfModifiers()
          Returns the list of modifiers in this Reaction object.
 ListOfSpeciesReferences getListOfProducts()
          Returns the list of products in this Reaction object.
 ListOfSpeciesReferences getListOfReactants()
          Returns the list of reactants in this Reaction object.
 ModifierSpeciesReference getModifier(long n)
          Returns the nth modifier species (as a ModifierSpeciesReference object) in the list of modifiers of this Reaction.
 ModifierSpeciesReference getModifier(String species)
          Returns the modifier species (as a ModifierSpeciesReference object) having a specific identifier in this Reaction.
 String getName()
          Returns the value of the 'name' attribute of this Reaction.
 long getNumModifiers()
          Returns the number of modifier species in this Reaction.
 long getNumProducts()
          Returns the number of product species in this Reaction.
 long getNumReactants()
          Returns the number of reactant species in this Reaction.
 SpeciesReference getProduct(long n)
          Returns the nth product species (as a SpeciesReference object) in the list of products in this Reaction.
 SpeciesReference getProduct(String species)
          Returns the product species (as a SpeciesReference object) having a specific identifier in this Reaction.
 SpeciesReference getReactant(long n)
          Returns the nth reactant species (as a SpeciesReference object) in the list of reactants in this Reaction.
 SpeciesReference getReactant(String species)
          Returns the reactant species (as a SpeciesReference object) having a specific identifier in this Reaction.
 boolean getReversible()
          Returns the value of the 'reversible' attribute on the Reaction as a boolean value.
 int getTypeCode()
          Returns the libSBML type code for this SBML object.
 boolean hasRequiredAttributes()
          Predicate returning true if all the required attributes for this Reaction object have been set.
 void initDefaults()
          Initializes the fields of this Reaction object to 'typical' default values.
 boolean isSetCompartment()
          Predicate returning true if this Reaction's 'compartment' attribute is set.
 boolean isSetFast()
          Predicate returning true if the value of the 'fast' attribute on this Reaction.
 boolean isSetId()
          Predicate returning true if this Reaction's 'id' attribute is set.
 boolean isSetKineticLaw()
          Predicate returning true if this Reaction contains a kinetic law object.
 boolean isSetName()
          Predicate returning true if this Reaction's 'name' attribute is set.
 boolean isSetReversible()
          Predicate returning true if this Reaction's 'reversible' attribute is set.
 ModifierSpeciesReference removeModifier(long n)
          Removes the nth modifier species (ModifierSpeciesReference object) in the list of modifiers in this Reaction and returns a pointer to it.
 ModifierSpeciesReference removeModifier(String species)
          Removes the modifier species (ModifierSpeciesReference object) having the given 'species' attribute in this Reaction and returns a pointer to it.
 SpeciesReference removeProduct(long n)
          Removes the nth product species (SpeciesReference object) in the list of products in this Reaction and returns a pointer to it.
 SpeciesReference removeProduct(String species)
          Removes the product species (SpeciesReference object) having the given 'species' attribute in this Reaction and returns a pointer to it.
 SpeciesReference removeReactant(long n)
          Removes the nth reactant species (SpeciesReference object) in the list of reactants in this Reaction and returns a pointer to it.
 SpeciesReference removeReactant(String species)
          Removes the reactant species (SpeciesReference object) having the given 'species' attribute in this Reaction and returns a pointer to it.
 void renameSIdRefs(String oldid, String newid)
          Renames all the SIdRef attributes on this element, including any found in MathML
 int setCompartment(String sid)
          Sets the value of the 'compartment' attribute of this Reaction.
 int setFast(boolean value)
          Sets the value of the 'fast' attribute of this Reaction.
 int setId(String sid)
          Sets the value of the 'id' attribute of this Reaction.
 int setKineticLaw(KineticLaw kl)
          Sets the 'kineticLaw' subelement of this Reaction to a copy of the given KineticLaw object.
 int setName(String name)
          Sets the value of the 'name' attribute of this Reaction.
 int setReversible(boolean value)
          Sets the value of the 'reversible' attribute of this Reaction.
 int unsetCompartment()
          Unsets the value of the 'compartment' attribute of this Reaction.
 int unsetFast()
          Unsets the value of the 'fast' attribute of this Reaction.
 int unsetKineticLaw()
          Unsets the 'kineticLaw' subelement of this Reaction.
 int unsetName()
          Unsets the value of the 'name' attribute of this Reaction.
 
Methods inherited from class org.sbml.libsbml.SBase
addCVTerm, addCVTerm, appendAnnotation, appendAnnotation, appendNotes, appendNotes, disablePackage, enablePackage, equals, getAncestorOfType, getAncestorOfType, getAnnotation, getAnnotationString, getColumn, getCVTerm, getCVTerms, getLevel, getLine, getListOfAllElements, getListOfAllElementsFromPlugins, getMetaId, getModel, getModelHistory, getNamespaces, getNotes, getNotesString, getNumCVTerms, getNumPlugins, getPackageName, getPackageVersion, getParentSBMLObject, getPlugin, getPlugin, getResourceBiologicalQualifier, getResourceModelQualifier, getSBMLDocument, getSBOTerm, getSBOTermAsURL, getSBOTermID, getVersion, hashCode, hasValidLevelVersionNamespaceCombination, isPackageEnabled, isPackageURIEnabled, isPkgEnabled, isPkgURIEnabled, isSetAnnotation, isSetMetaId, isSetModelHistory, isSetNotes, isSetSBOTerm, matchesRequiredSBMLNamespacesForAddition, matchesSBMLNamespaces, removeFromParentAndDelete, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, renameMetaIdRefs, renameUnitSIdRefs, replaceTopLevelAnnotationElement, replaceTopLevelAnnotationElement, setAnnotation, setAnnotation, setMetaId, setModelHistory, setNamespaces, setNotes, setNotes, setNotes, setSBOTerm, setSBOTerm, toSBML, unsetAnnotation, unsetCVTerms, unsetId, unsetMetaId, unsetModelHistory, unsetNotes, unsetSBOTerm
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reaction

public Reaction(long level,
                long version)
         throws SBMLConstructorException
Creates a new Reaction using the given SBML level and version values.

Parameters:
level - a long integer, the SBML Level to assign to this Reaction

version - a long integer, the SBML Version to assign to this Reaction

Throws:
SBMLConstructorException - Thrown if the given level and version combination, or this kind of SBML object, are either invalid or mismatched with respect to the parent SBMLDocument object.

Note:
Upon the addition of a Reaction object to an SBMLDocument (e.g., using Model.addReaction(Reaction r)), the SBML Level, SBML Version and XML namespace of the document override the values used when creating the Reaction object via this constructor. This is necessary to ensure that an SBML document is a consistent structure. Nevertheless, the ability to supply the values at the time of creation of a Reaction is an important aid to producing valid SBML. Knowledge of the intented SBML Level and Version determine whether it is valid to assign a particular value to an attribute, or whether it is valid to add an object to an existing SBMLDocument.

Reaction

public Reaction(SBMLNamespaces sbmlns)
         throws SBMLConstructorException
Creates a new Reaction using the given SBMLNamespaces object sbmlns.

The SBMLNamespaces object encapsulates SBML Level/Version/namespaces information. It is used to communicate the SBML Level, Version, and (in Level 3) packages used in addition to SBML Level 3 Core. A common approach to using this class constructor is to create an SBMLNamespaces object somewhere in a program, once, then pass it to object constructors such as this one when needed.

Parameters:
sbmlns - an SBMLNamespaces object.

Throws:
SBMLConstructorException - Thrown if the given level and version combination, or this kind of SBML object, are either invalid or mismatched with respect to the parent SBMLDocument object.

Note:
Upon the addition of a Reaction object to an SBMLDocument (e.g., using Model.addReaction(Reaction r)), the SBML XML namespace of the document overrides the value used when creating the Reaction object via this constructor. This is necessary to ensure that an SBML document is a consistent structure. Nevertheless, the ability to supply the values at the time of creation of a Reaction is an important aid to producing valid SBML. Knowledge of the intented SBML Level and Version determine whether it is valid to assign a particular value to an attribute, or whether it is valid to add an object to an existing SBMLDocument.

Reaction

public Reaction(Reaction orig)
         throws SBMLConstructorException
Copy constructor; creates a copy of this Reaction.

Parameters:
orig - the object to copy.

Throws:
SBMLConstructorException - Thrown if the argument orig is null.
Method Detail

delete

public void delete()
Explicitly deletes the underlying native object.

In general, application software will not need to call this method directly. The Java language binding for libSBML is implemented as a language wrapper that provides a Java interface to libSBML's underlying C++/C code. Some of the Java methods return objects that are linked to objects created not by Java code, but by C++ code. The Java objects wrapped around them will be deleted when the garbage collector invokes the corresponding C++ finalize() methods for the objects. The finalize() methods in turn call the Reaction.delete() method on the libSBML object.

This method is exposed in case calling programs want to ensure that the underlying object is freed immediately, and not at some arbitrary time determined by the Java garbage collector. In normal usage, callers do not need to invoke Reaction.delete() themselves.

Overrides:
delete in class SBase

cloneObject

public Reaction cloneObject()
Creates and returns a deep copy of this Reaction.

Overrides:
cloneObject in class SBase
Returns:
a (deep) copy of this Reaction.

getElementBySId

public SBase getElementBySId(String id)
Returns the first child element found that has the given id in the model-wide SId namespace, or null if no such object is found.

Overrides:
getElementBySId in class SBase
Parameters:
id - string representing the id of objects to find.

Returns:
pointer to the first element found with the given id.

getElementByMetaId

public SBase getElementByMetaId(String metaid)
Returns the first child element it can find with the given metaid, or null if no such object is found.

Overrides:
getElementByMetaId in class SBase
Parameters:
metaid - string representing the metaid of objects to find

Returns:
pointer to the first element found with the given metaid.

renameSIdRefs

public void renameSIdRefs(String oldid,
                          String newid)
Renames all the SIdRef attributes on this element, including any found in MathML

Overrides:
renameSIdRefs in class SBase
Parameters:
oldid - the old identifier
newid - the new identifier

initDefaults

public void initDefaults()
Initializes the fields of this Reaction object to 'typical' default values.

The SBML Reaction component has slightly different aspects and default attribute values in different SBML Levels and Versions. This method sets the values to certain common defaults, based mostly on what they are in SBML Level 2. Specifically:

Warning:
The 'fast' attribute must be used with care. SBML definitions before SBML Level 2 Version 2 incorrectly indicated that software tools could ignore this attribute if they did not implement support for the corresponding concept; however, further research in SBML has revealed that this is not true, and 'fast' cannot be ignored if it is set to true. Beginning with SBML Level 2 Versions 2, the SBML specifications therefore stipulate that if a model has any reactions with 'fast' set to true, a software tool must be able to respect the attribute or else indicate to the user that it does not have the capacity to do so. Readers are directed to the SBML specifications, which provides more detail about the conditions under which a reaction can be considered to be fast in this sense.

getId

public String getId()
Returns the value of the 'id' attribute of this Reaction.

Overrides:
getId in class SBase
Returns:
the id of this Reaction.
See Also:
SBase.isSetMetaId(), SBase.setMetaId(String metaid)

getName

public String getName()
Returns the value of the 'name' attribute of this Reaction.

Overrides:
getName in class SBase
Returns:
the name of this Reaction.
See Also:
SBase.isSetMetaId(), SBase.setMetaId(String metaid)

getKineticLaw

public KineticLaw getKineticLaw()
Returns the KineticLaw object contained in this Reaction.

Returns:
the KineticLaw instance.

getReversible

public boolean getReversible()
Returns the value of the 'reversible' attribute on the Reaction as a boolean value.

Returns:
the reversibility status of this Reaction.

getFast

public boolean getFast()
Returns the value of the 'fast' attribute of this Reaction.

Returns:
the 'fast' status of this Reaction.

Warning:
SBML definitions before SBML Level 2 Version 2 incorrectly indicated that software tools could ignore this attribute if they did not implement support for the corresponding concept; however, further research in SBML has revealed that this is not true, and 'fast' cannot be ignored if it is set to true. SBML Level 2 Versions 2, 3 and 4 therefore stipulate that if a model has any reactions with 'fast' set to true, a software tool must be able to respect the attribute or else indicate to the user that it does not have the capacity to do so. Readers are directed to the SBML Level 2 Version 4 specification, which provides more detail about the conditions under which a reaction can be considered to be fast in this sense.

getCompartment

public String getCompartment()
(SBML Level 3 only) Returns the value of the 'compartment' attribute on the Reaction.

Returns:
the compartment of this Reaction.

Note:
The 'compartment' attribute is available in SBML Level 3 Version 1 Core, but is not present on Reaction in lower Levels of SBML.

isSetId

public boolean isSetId()
Predicate returning true if this Reaction's 'id' attribute is set.

Overrides:
isSetId in class SBase
Returns:
true if the 'id' attribute of this Reaction is set, false otherwise.
See Also:
SBase.getMetaId(), SBase.setMetaId(String metaid)

isSetName

public boolean isSetName()
Predicate returning true if this Reaction's 'name' attribute is set.

Overrides:
isSetName in class SBase
Returns:
true if the 'name' attribute of this Reaction is set, false otherwise.
See Also:
SBase.getMetaId(), SBase.setMetaId(String metaid)

isSetKineticLaw

public boolean isSetKineticLaw()
Predicate returning true if this Reaction contains a kinetic law object.

Returns:
true if a KineticLaw is present in this Reaction,, false otherwise.

isSetFast

public boolean isSetFast()
Predicate returning true if the value of the 'fast' attribute on this Reaction.

Returns:
true if the 'fast' attribute is true, false otherwise.

Warning:
SBML definitions before SBML Level 2 Version 2 incorrectly indicated that software tools could ignore this attribute if they did not implement support for the corresponding concept; however, further research in SBML has revealed that this is not true, and 'fast' cannot be ignored if it is set to true. SBML Level 2 Versions 2, 3 and 4 therefore stipulate that if a model has any reactions with 'fast' set to true, a software tool must be able to respect the attribute or else indicate to the user that it does not have the capacity to do so. Readers are directed to the SBML Level 2 Version 4 specification, which provides more detail about the conditions under which a reaction can be considered to be fast in this sense. Note also that in SBML Level 1, 'fast' is defined as optional with a default of false, which means it is effectively always set.

isSetCompartment

public boolean isSetCompartment()
Predicate returning true if this Reaction's 'compartment' attribute is set.

Returns:
true if the 'compartment' attribute of this Reaction is set, false otherwise.

Note:
The 'compartment' attribute is available in SBML Level 3 Version 1 Core, but is not present on Reaction in lower Levels of SBML.

isSetReversible

public boolean isSetReversible()
Predicate returning true if this Reaction's 'reversible' attribute is set.

Returns:
true if the 'reversible' attribute of this Reaction is set, false otherwise.

setId

public int setId(String sid)
Sets the value of the 'id' attribute of this Reaction.

The string sid is copied. Note that SBML has strict requirements for the syntax of identifiers. The following is a summary of the definition of the SBML identifier type SId, which defines the permitted syntax of identifiers. We express the syntax using an extended form of BNF notation:

letter .= 'a'..'z','A'..'Z'
digit  .= '0'..'9'
idChar .= letter | digit | '_'
SId    .= ( letter | '_' ) idChar*
The characters ( and ) are used for grouping, the character * 'zero or more times', and the character | indicates logical 'or'. The equality of SBML identifiers is determined by an exact character sequence match; i.e., comparisons must be performed in a case-sensitive manner. In addition, there are a few conditions for the uniqueness of identifiers in an SBML model. Please consult the SBML specifications for the exact formulations.

Overrides:
setId in class SBase
Parameters:
sid - the string to use as the identifier of this Reaction

Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:

setName

public int setName(String name)
Sets the value of the 'name' attribute of this Reaction.

The string in name is copied.

Overrides:
setName in class SBase
Parameters:
name - the new name for the Reaction

Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:

setKineticLaw

public int setKineticLaw(KineticLaw kl)
Sets the 'kineticLaw' subelement of this Reaction to a copy of the given KineticLaw object.

Parameters:
kl - the KineticLaw object to use.

Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:

setReversible

public int setReversible(boolean value)
Sets the value of the 'reversible' attribute of this Reaction.

Parameters:
value - the value of the 'reversible' attribute.

Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:

setFast

public int setFast(boolean value)
Sets the value of the 'fast' attribute of this Reaction.

Parameters:
value - the value of the 'fast' attribute.

Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:

Warning:
SBML definitions before SBML Level 2 Version 2 incorrectly indicated that software tools could ignore this attribute if they did not implement support for the corresponding concept; however, further research in SBML has revealed that this is not true, and 'fast' cannot be ignored if it is set to true. SBML Level 2 Versions 2, 3 and 4 therefore stipulate that if a model has any reactions with 'fast' set to true, a software tool must be able to respect the attribute or else indicate to the user that it does not have the capacity to do so. Readers are directed to the SBML Level 2 Version 4 specification, which provides more detail about the conditions under which a reaction can be considered to be fast in this sense.

setCompartment

public int setCompartment(String sid)
Sets the value of the 'compartment' attribute of this Reaction.

The string sid is copied.

Parameters:
sid - the string to use as the compartment of this Reaction

Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:

Note:
The 'compartment' attribute is available in SBML Level 3 Version 1 Core, but is not present on Reaction in lower Levels of SBML.

unsetName

public int unsetName()
Unsets the value of the 'name' attribute of this Reaction.

Overrides:
unsetName in class SBase
Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:

unsetKineticLaw

public int unsetKineticLaw()
Unsets the 'kineticLaw' subelement of this Reaction.

Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:

unsetFast

public int unsetFast()
Unsets the value of the 'fast' attribute of this Reaction.

Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:

Warning:
In SBML Level 1, 'fast' is optional with a default of false, which means it is effectively always set (and reset to false if this method is called). Further, SBML definitions before SBML Level 2 Version 2 incorrectly indicated that software tools could ignore this attribute if they did not implement support for the corresponding concept; however, further research in SBML has revealed that this is not true, and 'fast' cannot be ignored if it is set to true. SBML Level 2 Versions 2, 3 and 4 therefore stipulate that if a model has any reactions with 'fast' set to true, a software tool must be able to respect the attribute or else indicate to the user that it does not have the capacity to do so. Readers are directed to the SBML Level 2 Version 4 specification, which provides more detail about the conditions under which a reaction can be considered to be fast in this sense.

unsetCompartment

public int unsetCompartment()
Unsets the value of the 'compartment' attribute of this Reaction.

Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:

Note:
The 'compartment' attribute is available in SBML Level 3 Version 1 Core, but is not present on Reaction in lower Levels of SBML.

addReactant

public int addReactant(SpeciesReference sr)
Adds a given SpeciesReference object as a reactant in this Reaction.

The SpeciesReference instance in sr is copied.

Parameters:
sr - a SpeciesReference object referring to a Species in the enclosing Model

Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:

See Also:
Reaction.createReactant()
Note:
This method should be used with some caution. The fact that this method copies the object passed to it means that the caller will be left holding a physically different object instance than the one contained in this Reaction. Changes made to the original object instance (such as resetting attribute values) will not affect the instance in the Reaction. In addition, the caller should make sure to free the original object if it is no longer being used, or else a memory leak will result. Please see Reaction.createReactant() for a method that does not lead to these issues.


addProduct

public int addProduct(SpeciesReference sr)
Adds a given SpeciesReference object as a product in this Reaction.

The SpeciesReference instance in sr is copied.

Parameters:
sr - a SpeciesReference object referring to a Species in the enclosing Model

Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:

See Also:
Reaction.createProduct()
Note:
This method should be used with some caution. The fact that this method copies the object passed to it means that the caller will be left holding a physically different object instance than the one contained in this Reaction. Changes made to the original object instance (such as resetting attribute values) will not affect the instance in the Reaction. In addition, the caller should make sure to free the original object if it is no longer being used, or else a memory leak will result. Please see Reaction.createProduct() for a method that does not lead to these issues.


addModifier

public int addModifier(ModifierSpeciesReference msr)
Adds a given ModifierSpeciesReference object as a product in this Reaction.

The ModifierSpeciesReference instance in msr is copied.

Parameters:
msr - a ModifierSpeciesReference object referring to a Species in the enclosing Model

Returns:
integer value indicating success/failure of the function. The possible values returned by this function are:

See Also:
Reaction.createModifier()
Note:
This method should be used with some caution. The fact that this method copies the object passed to it means that the caller will be left holding a physically different object instance than the one contained in this Reaction. Changes made to the original object instance (such as resetting attribute values) will not affect the instance in the Reaction. In addition, the caller should make sure to free the original object if it is no longer being used, or else a memory leak will result. Please see Reaction.createModifier() for a method that does not lead to these issues.


createReactant

public SpeciesReference createReactant()
Creates a new SpeciesReference, adds it to this Reaction's list of reactants, and returns it.

Returns:
a new SpeciesReference object.

createProduct

public SpeciesReference createProduct()
Creates a new SpeciesReference, adds it to this Reaction's list of products, and returns it.

Returns:
a new SpeciesReference object.

createModifier

public ModifierSpeciesReference createModifier()
Creates a new ModifierSpeciesReference, adds it to this Reaction's list of modifiers and returns it.

Returns:
a new ModifierSpeciesReference object.

createKineticLaw

public KineticLaw createKineticLaw()
Creates a new KineticLaw object, installs it as this Reaction's 'kineticLaw' subelement, and returns it.

If this Reaction had a previous KineticLaw, it will be destroyed.

Returns:
the new KineticLaw object

getListOfReactants

public ListOfSpeciesReferences getListOfReactants()
Returns the list of reactants in this Reaction object.

Returns:
the ListOfSpeciesReferences containing the references to the species acting as reactants in this reaction

getListOfProducts

public ListOfSpeciesReferences getListOfProducts()
Returns the list of products in this Reaction object.

Returns:
the ListOfSpeciesReferences containing the references to the species acting as products in this reaction

getListOfModifiers

public ListOfSpeciesReferences getListOfModifiers()
Returns the list of modifiers in this Reaction object.

Returns:
the ListOfSpeciesReferences containing the references to the species acting as modifiers in this reaction

getReactant

public SpeciesReference getReactant(long n)
Returns the nth reactant species (as a SpeciesReference object) in the list of reactants in this Reaction.

Callers should first call getNumReactants() to find out how many reactants there are, to avoid using an invalid index number.

Parameters:
n - the index of the reactant sought.

Returns:
the nth reactant (as a SpeciesReference object) of this Reaction.

getReactant

public SpeciesReference getReactant(String species)
Returns the reactant species (as a SpeciesReference object) having a specific identifier in this Reaction.

Parameters:
species - the identifier of the reactant Species ('species' attribute of the reactant SpeciesReference object)

Returns:
a SpeciesReference object, or null if no species with the given identifier species appears as a reactant in this Reaction.

getProduct

public SpeciesReference getProduct(long n)
Returns the nth product species (as a SpeciesReference object) in the list of products in this Reaction.

Callers should first call getNumProducts() to find out how many products there are, to avoid using an invalid index number.

Parameters:
n - the index of the product sought.

Returns:
the nth product (as a SpeciesReference object) of this Reaction.

getProduct

public SpeciesReference getProduct(String species)
Returns the product species (as a SpeciesReference object) having a specific identifier in this Reaction.

Parameters:
species - the identifier of the product Species ('species' attribute of the product SpeciesReference object)

Returns:
a SpeciesReference object, or null if no species with the given identifier species appears as a product in this Reaction.

getModifier

public ModifierSpeciesReference getModifier(long n)
Returns the nth modifier species (as a ModifierSpeciesReference object) in the list of modifiers of this Reaction.

Callers should first call getNumModifiers() to find out how many modifiers there are, to avoid using an invalid index number.

Parameters:
n - the index of the modifier species sought

Returns:
the nth modifier (as a ModifierSpeciesReference object) of this Reaction.

getModifier

public ModifierSpeciesReference getModifier(String species)
Returns the modifier species (as a ModifierSpeciesReference object) having a specific identifier in this Reaction.

Parameters:
species - the identifier of the modifier Species ('species' attribute of the ModifierSpeciesReference object)

Returns:
a ModifierSpeciesReference object, or null if no species with the given identifier species appears as a modifier in this Reaction.

getNumReactants

public long getNumReactants()
Returns the number of reactant species in this Reaction.

Returns:
the number of reactants in this Reaction.

getNumProducts

public long getNumProducts()
Returns the number of product species in this Reaction.

Returns:
the number of products in this Reaction.

getNumModifiers

public long getNumModifiers()
Returns the number of modifier species in this Reaction.

Returns:
the number of modifiers in this Reaction.

removeReactant

public SpeciesReference removeReactant(long n)
Removes the nth reactant species (SpeciesReference object) in the list of reactants in this Reaction and returns a pointer to it.

The caller owns the returned object and is responsible for deleting it. The caller should first call getNumReactants() to find out how many reactants there are, to avoid using an invalid index number.

Parameters:
n - the index of the reactant SpeciesReference object to remove

Returns:
the removed reactant SpeciesReference object, or null if the given index is out of range.

removeReactant

public SpeciesReference removeReactant(String species)
Removes the reactant species (SpeciesReference object) having the given 'species' attribute in this Reaction and returns a pointer to it.

The caller owns the returned object and is responsible for deleting it.

Parameters:
species - the 'species' attribute of the reactant SpeciesReference object

Returns:
the removed reactant SpeciesReference object, or null if no reactant SpeciesReference object with the given 'species' attribute species exists in this Reaction.

removeProduct

public SpeciesReference removeProduct(long n)
Removes the nth product species (SpeciesReference object) in the list of products in this Reaction and returns a pointer to it.

The caller owns the returned object and is responsible for deleting it. The caller should first call getNumProducts() to find out how many products there are, to avoid using an invalid index number.

Parameters:
n - the index of the product SpeciesReference object to remove

Returns:
the removed product SpeciesReference object, or null if the given index is out of range.

removeProduct

public SpeciesReference removeProduct(String species)
Removes the product species (SpeciesReference object) having the given 'species' attribute in this Reaction and returns a pointer to it.

The caller owns the returned object and is responsible for deleting it.

Parameters:
species - the 'species' attribute of the product SpeciesReference object

Returns:
the removed product SpeciesReference object, or null if no product SpeciesReference object with the given 'species' attribute species exists in this Reaction.

removeModifier

public ModifierSpeciesReference removeModifier(long n)
Removes the nth modifier species (ModifierSpeciesReference object) in the list of modifiers in this Reaction and returns a pointer to it.

The caller owns the returned object and is responsible for deleting it. The caller should first call getNumModifiers() to find out how many modifiers there are, to avoid using an invalid index number.

Parameters:
n - the index of the ModifierSpeciesReference object to remove

Returns:
the removed ModifierSpeciesReference object, or null if the given index is out of range.

removeModifier

public ModifierSpeciesReference removeModifier(String species)
Removes the modifier species (ModifierSpeciesReference object) having the given 'species' attribute in this Reaction and returns a pointer to it.

The caller owns the returned object and is responsible for deleting it.

Parameters:
species - the 'species' attribute of the ModifierSpeciesReference object

Returns:
the removed ModifierSpeciesReference object, or null if no ModifierSpeciesReference object with the given 'species' attribute @p species exists in this Reaction.

getTypeCode

public int getTypeCode()
Returns the libSBML type code for this SBML object.

LibSBML attaches an identifying code to every kind of SBML object. These are known as SBML type codes. In other languages, the set of type codes is stored in an enumeration; in the Java language interface for libSBML, the type codes are defined as static integer constants in the interface class libsbmlConstants. The names of the type codes all begin with the characters SBML_.

Overrides:
getTypeCode in class SBase
Returns:
the SBML type code for this object, or SBML_UNKNOWN (default).

See Also:
Reaction.getElementName()

getElementName

public String getElementName()
Returns the XML element name of this object, which for Reaction, is always 'reaction'.

Overrides:
getElementName in class SBase
Returns:
the name of this element, i.e., 'reaction'.

hasRequiredAttributes

public boolean hasRequiredAttributes()
Predicate returning true if all the required attributes for this Reaction object have been set.

Overrides:
hasRequiredAttributes in class SBase
Returns:
a boolean value indicating whether all the required attributes for this object have been defined.
Note:
The required attributes for a Reaction object are:
  • 'id' (or 'name' in SBML Level 1)
  • 'fast' (in Level 3 only, where it is defined as a required attribute)
  • 'reversible' (in Level 3 only, where it is defined as a required attribute)


libSBML
5.8.0


LibSBML, an application programming interface (API) library for SBML.