fern.network.sbml
Class SBMLNetwork

java.lang.Object
  extended by fern.network.AbstractNetworkImpl
      extended by fern.network.sbml.SBMLNetwork
All Implemented Interfaces:
Network

public class SBMLNetwork
extends AbstractNetworkImpl

For specifications of the sbml format refer to http:\\www.sbml.org. Not every feature is implemented in FERN (for a list please see the user guide).

When you want to use a sbml model with events included, you have to call registerEvents, since the event handling is treated by SBMLEventHandlerObservers which need to be attached to the Simulator.

Author:
Florian Erhard

Constructor Summary
SBMLNetwork(File file)
          Creates a network from a sbmlfile.
SBMLNetwork(File file, boolean ignoreExceptions)
          Creates a network from a sbml file.
SBMLNetwork(Network net)
          Create a SBMLNetwork from an existing Network.
 
Method Summary
 long getInitialAmount(int species)
          Gets the initial amount of the specified molecule species.
 org.sbml.libsbml.Model getSBMLModel()
          Gets the libsbml model.
 void registerEvents(Simulator sim)
          Registers the SBMLEventHandlerObserver for each event in the sbml file to the Simulator.
 void saveToFile(File file)
          Saves the current SBMLNetwork to a file.
 void saveToFile(File file, long level, long version)
          Saves the current SBMLNetwork to a sbml file with given level and version.
 void setInitialAmount(int species, long value)
          Sets the initial amount of the specified molecule species.
 
Methods inherited from class fern.network.AbstractNetworkImpl
getAmountManager, getAnnotationManager, getName, getNumReactions, getNumSpecies, getProducts, getPropensityCalculator, getReactants, getReactionName, getSpeciesByName, getSpeciesMapping, getSpeciesName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SBMLNetwork

public SBMLNetwork(File file)
            throws FeatureNotSupportedException
Creates a network from a sbmlfile. If the file contains features not supported by FERN, an exception will be thrown.

Parameters:
file - SBML file
Throws:
FeatureNotSupportedException

SBMLNetwork

public SBMLNetwork(File file,
                   boolean ignoreExceptions)
            throws FeatureNotSupportedException
Creates a network from a sbml file. If the file contains features not supported by FERN, depending on ignoreExceptions they will be ignored or a exception is thrown.

Parameters:
file - SBML file
ignoreExceptions - wheter or not exceptions should be thrown
Throws:
FeatureNotSupportedException

SBMLNetwork

public SBMLNetwork(Network net)
Create a SBMLNetwork from an existing Network. The constant for the rate reaction is obtained by the propensity calculator by setting each reactant species' amount to 1.

Parameters:
net - the network to create a SBMLNetwork from
Method Detail

registerEvents

public void registerEvents(Simulator sim)
Registers the SBMLEventHandlerObserver for each event in the sbml file to the Simulator.

Parameters:
sim - the simulator

getInitialAmount

public long getInitialAmount(int species)
Description copied from interface: Network
Gets the initial amount of the specified molecule species.

Parameters:
species - index of the species
Returns:
initial amount of the species

setInitialAmount

public void setInitialAmount(int species,
                             long value)
Description copied from interface: Network
Sets the initial amount of the specified molecule species.

Parameters:
species - index of the species
value - initial amount of the species

getSBMLModel

public org.sbml.libsbml.Model getSBMLModel()
Gets the libsbml model.

Returns:
sbml model

saveToFile

public void saveToFile(File file)
                throws IOException
Saves the current SBMLNetwork to a file.

Parameters:
file - the file to save the network in
Throws:
IOException - if the file cannot be written

saveToFile

public void saveToFile(File file,
                       long level,
                       long version)
                throws IOException
Saves the current SBMLNetwork to a sbml file with given level and version.

Parameters:
file - the file to save the network in
level - sbml level
version - sbml version
Throws:
IOException - if the file cannot be written