fern.network.creation
Class AutocatalyticNetwork

java.lang.Object
  extended by fern.network.AbstractNetworkImpl
      extended by fern.network.creation.AutocatalyticNetwork
All Implemented Interfaces:
CatalystIterator, Network

public class AutocatalyticNetwork
extends AbstractNetworkImpl
implements CatalystIterator

Evolve an autocatalytic network. The evolution starts at some monomers, let them aggregate (e.g. A+B -> AB) by a given probability and up to a given length. Then, each reaction is catalyzed by a given probability by some molecule species (the catalysts are stored as fields in the net's annotation). Since the reactions are only unidirectional you have to create a ReversibleNetwork out of it. Because of this, also catalysts for the reverse reactions are stored in the corresponding fields.

The advantage of the unidirectional reactions is space efficiency since the ReversibleNetwork does not copy the reactions but redirects the indices.

This network can of course be used for stochastic simulations. If it is just converted into a ReversibleNetwork, there are just different kinetic constants used for catalyzed and not catalyzed reactions (getCatalyzedKineticConstant() and getUncatalyzedKineticConstant()).

Author:
Florian Erhard

Field Summary
static String CATALYSTS_FIELD
          Name of the field where catalysts are stored.
static String CATALYSTS_FIELD_REVERSIBLE
          Name of the field where catalysts for the reverse reactions are stored.
 
Constructor Summary
AutocatalyticNetwork(char[] monomers, Probability createProb, Probability catProb, int maxLength)
          Creates the autocatalytic network from given monomers, reaction probability, catalysis probability up to a given polymer length.
AutocatalyticNetwork(char[] monomers, Probability createProb, Probability catProb, int maxLength, boolean useFastMethod)
          Creates the autocatalytic network from given monomers, reaction probability, catalysis probability up to a given polymer length. useDefault should usually set to true unless you want to evolve really huge networks.
 
Method Summary
 Iterable<Integer> getCatalysts(int reaction)
          Implementation for the CatalystIterator.
 double getCatalyzedKineticConstant()
          Gets the kinetic constant for catalyzed reactions.
 long getInitialAmount(int species)
          Gets the initial amount of the specified molecule species.
 long getMonomerAmount()
          Gets the initial amount of the monomers for a simulation algorithm.
 int getNumMonomers()
          Gets if the number of monomers
 long getOtherAmount()
          Gets the initial amount of the not-monomers for a simulation algorithm.
 PropensityCalculator getReversePropensityCalculator()
          Gets the PropensityCalculator which has to be used for instantiation of the ReversibleNetwork.
 double getUncatalyzedKineticConstant()
          Gets the kinetic constant for not catalyzed reactions.
 void setCatalyzedKineticConstant(double catalyzedKineticConstant)
          Sets the kinetic constant for catalyzed reactions.
 void setInitialAmount(int species, long value)
          Sets the initial amount of the specified molecule species.
 void setMonomerAmount(long monomerAmount)
          Sets the initial amount of the monomers for a simulation algorithm.
 void setOtherAmount(long otherAmount)
          Sets the initial amount of the not-monomers for a simulation algorithm.
 void setUncatalyzedKineticConstant(double uncatalyzedKineticConstant)
          Sets the kinetic constant for not catalyzed reactions.
 
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
 

Field Detail

CATALYSTS_FIELD

public static final String CATALYSTS_FIELD
Name of the field where catalysts are stored.

See Also:
Constant Field Values

CATALYSTS_FIELD_REVERSIBLE

public static final String CATALYSTS_FIELD_REVERSIBLE
Name of the field where catalysts for the reverse reactions are stored.

See Also:
Constant Field Values
Constructor Detail

AutocatalyticNetwork

public AutocatalyticNetwork(char[] monomers,
                            Probability createProb,
                            Probability catProb,
                            int maxLength)
Creates the autocatalytic network from given monomers, reaction probability, catalysis probability up to a given polymer length. By default, the fast (but memory consuming) method of creating / catalyzing is beeing used.

Parameters:
monomers - the monomers to start the network evolution with
createProb - the reaction probability
catProb - the catalyzation probability
maxLength - the maximal polymer length
See Also:
Probability

AutocatalyticNetwork

public AutocatalyticNetwork(char[] monomers,
                            Probability createProb,
                            Probability catProb,
                            int maxLength,
                            boolean useFastMethod)
Creates the autocatalytic network from given monomers, reaction probability, catalysis probability up to a given polymer length. useDefault should usually set to true unless you want to evolve really huge networks. The slower method only needs O(log(V)) extra space where the faster method needs O(V).

Parameters:
monomers - the monomers to start the network evolution with
createProb - the reaction probability
catProb - the catalysis probability
maxLength - the maximal polymer length
useFastMethod - what method is going to be used for creating / catalyzing
See Also:
Probability
Method Detail

getReversePropensityCalculator

public PropensityCalculator getReversePropensityCalculator()
Gets the PropensityCalculator which has to be used for instantiation of the ReversibleNetwork.

Returns:
the PropensityCalculator for the ReversibleNetwork

getCatalysts

public Iterable<Integer> getCatalysts(int reaction)
Implementation for the CatalystIterator. Returns the indices of catalysts for the given reaction. By using getAnnotationManager it returns the correct catalysts even if a ReversibleNetwork is used.

Specified by:
getCatalysts in interface CatalystIterator
Parameters:
reaction - index of the reaction for which the catalysts have to be returned
Returns:
the catalysts of the reaction

getInitialAmount

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

Specified by:
getInitialAmount in interface Network
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.

Specified by:
setInitialAmount in interface Network
Parameters:
species - index of the species
value - initial amount of the species

getNumMonomers

public int getNumMonomers()
Gets if the number of monomers

Returns:
number of monomers

getMonomerAmount

public long getMonomerAmount()
Gets the initial amount of the monomers for a simulation algorithm. The default is 1000.

Returns:
initial amount of the monomers

setMonomerAmount

public void setMonomerAmount(long monomerAmount)
Sets the initial amount of the monomers for a simulation algorithm. The default is 1000.

Parameters:
monomerAmount - initial amount of the monomers

getOtherAmount

public long getOtherAmount()
Gets the initial amount of the not-monomers for a simulation algorithm. The default is 1.

Returns:
initial amount of the not-monomers

setOtherAmount

public void setOtherAmount(long otherAmount)
Sets the initial amount of the not-monomers for a simulation algorithm. The default is 1.

Parameters:
otherAmount - initial amount of the not-monomers

getCatalyzedKineticConstant

public double getCatalyzedKineticConstant()
Gets the kinetic constant for catalyzed reactions. The default is 1.

Returns:
the catalyzedKineticConstant

setCatalyzedKineticConstant

public void setCatalyzedKineticConstant(double catalyzedKineticConstant)
Sets the kinetic constant for catalyzed reactions. The default is 1.

Parameters:
catalyzedKineticConstant - the catalyzedKineticConstant to set

getUncatalyzedKineticConstant

public double getUncatalyzedKineticConstant()
Gets the kinetic constant for not catalyzed reactions. The default is 0.001.

Returns:
the uncatalyzedKineticConstant

setUncatalyzedKineticConstant

public void setUncatalyzedKineticConstant(double uncatalyzedKineticConstant)
Sets the kinetic constant for not catalyzed reactions. The default is 0.001.

Parameters:
uncatalyzedKineticConstant - the uncatalyzedKineticConstant to set