fern.network.fernml
Class FernMLNetwork

java.lang.Object
  extended by fern.network.AbstractNetworkImpl
      extended by fern.network.fernml.FernMLNetwork
All Implemented Interfaces:
Network

public class FernMLNetwork
extends AbstractNetworkImpl

A FernMLNetwork is usually loaded from a file. For specifications see the included FernMLSchema.xsd or the examples. Additionally, a FernMLNetwork can be created out of an arbitrary Network. By using the saveToFile method, every Network can be saved as a fernml-File.

Author:
Florian Erhard

Constructor Summary
FernMLNetwork(File file)
          Creates a FernMLNetwork from a file.
FernMLNetwork(Network net)
          Create a FernMLNetwork from an existing Network.
FernMLNetwork(Network net, double[] kineticConstants)
          Creates a FernMLNetwork out of an existing network (e.g. to save it to a fernml file) using explicitly given kineticConstants (when net doesn't use KineticConstantPropensityCalculator If kineticConstants is null or to short, a default value of 1 is taken.
 
Method Summary
 long getInitialAmount(int species)
          Gets the initial amount of the specified molecule species.
 int getNumReactions()
          Gets the number of reaction within the network.
 int getNumSpecies()
          Gets the number of species within the network.
 ArrayKineticConstantPropensityCalculator getPropensityCalculator()
          Gets the PropensityCalculator for this network.
 void saveToFile(File file)
          Saves the actual FernMLNetwork to a file.
 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, getProducts, getReactants, getReactionName, getSpeciesByName, getSpeciesMapping, getSpeciesName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FernMLNetwork

public FernMLNetwork(File file)
              throws IOException,
                     org.jdom.JDOMException
Creates a FernMLNetwork from a file.

Parameters:
file - file containing the network
Throws:
IOException - if the file cannot be read
org.jdom.JDOMException - if the file is malformed

FernMLNetwork

public FernMLNetwork(Network net)
Create a FernMLNetwork from an existing Network. If the network's PropensityCalculator is not an AbstractKineticConstantPropensityCalculator, the constant for the rate reaction is obtained by the propensity calculator by setting each reactant species' amount to 1. If the stoichiometry of some reactant is greater than 1 the value is set accordingly.

Parameters:
net - the network to create a FernMLNetwork from

FernMLNetwork

public FernMLNetwork(Network net,
                     double[] kineticConstants)
Creates a FernMLNetwork out of an existing network (e.g. to save it to a fernml file) using explicitly given kineticConstants (when net doesn't use KineticConstantPropensityCalculator If kineticConstants is null or to short, a default value of 1 is taken.

Parameters:
net - An existing network
kineticConstants - kinetic constants for each reaction in net
Method Detail

getPropensityCalculator

public ArrayKineticConstantPropensityCalculator getPropensityCalculator()
Description copied from interface: Network
Gets the PropensityCalculator for this network.

Specified by:
getPropensityCalculator in interface Network
Overrides:
getPropensityCalculator in class AbstractNetworkImpl
Returns:
the PropensityCalculator

getNumReactions

public int getNumReactions()
Description copied from interface: Network
Gets the number of reaction within the network.

Specified by:
getNumReactions in interface Network
Overrides:
getNumReactions in class AbstractNetworkImpl
Returns:
number of reactions

getNumSpecies

public int getNumSpecies()
Description copied from interface: Network
Gets the number of species within the network.

Specified by:
getNumSpecies in interface Network
Overrides:
getNumSpecies in class AbstractNetworkImpl
Returns:
number of 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

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

saveToFile

public void saveToFile(File file)
                throws IOException
Saves the actual FernMLNetwork to a file.

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