|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjigcell.xpp.SBMLToXPPTranslator
public class SBMLToXPPTranslator
Translates an SBML model to ODEs. This code is licensed under the DARPA BioCOMP Open Source License. See LICENSE for more details.
| Field Summary | |
|---|---|
private static java.util.regex.Pattern |
checkIfExpression
|
private static java.util.regex.Pattern |
checkNumber
|
private static java.util.regex.Pattern |
cleanName
|
private java.util.Set |
compartmentIDs
|
private java.util.List |
differentialIDs
|
private jigcell.sbml2.jep.JEP |
expressionParser
|
private static java.util.regex.Pattern |
getBvarsFromFunction
|
private static java.util.regex.Pattern |
getMassActionParams
|
private static java.util.regex.Pattern |
getMichaelieMentenParams
|
private static java.util.regex.Pattern |
getSpeciesFromFunction
|
private static java.util.regex.Pattern |
getStochMassActionParams
|
private static java.util.regex.Pattern |
getStochMichaelieMentenParams
|
private java.util.Set |
hasNoDifferentialEquationSet
|
private java.util.Map |
idToOriginalValue
|
private java.util.Map |
idToXPPID
|
private int |
maximumIdentifierLength
|
private jigcell.sbml2.Model |
model
|
private java.util.List |
nonDifferentialIDs
|
private java.lang.String |
odeData
|
private static boolean |
orderAlphbeticalSettingsList
|
private java.util.Set |
parameterIDs
|
private static java.util.regex.Pattern |
removeSpaces
|
private java.util.Set |
speciesIDs
|
private java.util.Map |
speciesIDToCompartment
|
private java.util.Map |
speciesIDToEquation
|
private java.util.Map |
speciesToCompartmentMap
|
private java.util.Set |
speciesWithInitialAmountIDs
|
private jigcell.sbml2.math.SymbolTable |
symbolTable
|
private java.io.File |
targetFile
|
private java.util.Set |
usedFunctionNames
|
private java.util.Map |
variableToEquationMap
|
private static int |
XPP_LINELENGTH
|
| Constructor Summary | |
|---|---|
SBMLToXPPTranslator(jigcell.simulation.Simulator simulator,
jigcell.sbml2.Model model,
java.io.File targetFile,
int maximumIdentifierLength)
Creates a new translator for SBML files. |
|
| Method Summary | |
|---|---|
private void |
applyVelocityTerm(java.lang.String velocity,
boolean positive,
jigcell.sbml2.SpeciesReference reference)
Adds a single velocity term to an equation. |
private static java.lang.String |
breakEquation(java.lang.String text)
Breaks an equation along '+', '-', '*', '/', ',', or ' ' in order to fit on an XPP line. |
private void |
buildSymbolTable(jigcell.sbml2.Model model)
Adds the name and id of all tracked SBML elements in a model to a symbol table. |
private static void |
buildSymbolTablePump(jigcell.sbml2.math.SymbolTable table,
java.util.Collection collection)
Takes SBML elements from a collection and adds their name and id to a symbol table. |
private void |
calculateAllEquationsInternal()
|
void |
calculateEquationsFromReactions()
|
protected java.util.List |
computeSelectionList(java.util.List returnData)
Computes the list of species to return from simulation. |
private void |
computeVelocities()
Computes the velocity terms that make up the species equations. |
private java.lang.String |
convertCapabilitiesToXPP(jigcell.simulation.Capabilities capabilities)
Constructs a simulator setting string that can be passed to XPP. |
private java.lang.String |
convertIDToXPPID(java.lang.String id,
int unique)
Converts an SBML id to an XPP id. |
protected java.lang.String |
convertMathToInfix(java.lang.String math,
boolean rateLaw)
|
private java.lang.String |
fixFunctionNames(java.lang.String text)
Replaces function calls that use different builtin names between SBML and XPP. |
private java.lang.String |
fixIDs(java.lang.String text)
Replaces ids that differ between SBML and XPP. |
static void |
generateODEFromModelBuilder(jigcell.sbml2.Model model,
java.io.File odeFile,
boolean sortAlphabetically)
Converts an SBML file to an ODE file from the ModelBuilder |
private java.lang.String |
generateVelocityFromMath(java.lang.String math)
Generates the XPP velocity from a MathML string. |
java.util.List |
getAvailableSelections()
A List[String] of tokens for each measurable element in the model. |
java.lang.String |
getConcentration(jigcell.sbml2.Species species)
|
java.lang.String |
getEquation(java.lang.String math,
java.lang.String equation)
|
double |
getOriginalValue(java.lang.String id)
The current value of a modifiable element in the model. |
protected java.lang.String |
getProgramDirectory()
The location where XPP is installed. |
java.util.List |
getSettableNames()
The name or id of every settable quantity. |
static void |
main(java.lang.String[] args)
Converts an SBML file to an ODE file. |
java.lang.String |
printParseTreeMassAction(jigcell.sbml2.math.Node curr)
|
java.lang.String |
printParseTreeMichaelisMenten(jigcell.sbml2.math.Node curr)
|
java.lang.String |
printParseTreeStochMassAction(jigcell.sbml2.math.Node curr,
java.lang.String equation)
|
java.lang.String |
printParseTreeStochMichaelisMenten(jigcell.sbml2.math.Node curr)
|
private void |
registerIDs()
Identifies all of the SBML ids used in a model and constructs acceptable XPP ids for each. |
private static java.lang.String |
replaceFunctionName(java.lang.String text,
java.lang.String oldName,
java.lang.String newName)
Replaces a function call with a function of another name. |
protected java.lang.String |
replaceIdWithName(java.lang.String equation)
|
double |
setValue(jigcell.simulation.Simulator simulator,
java.lang.String id,
double value)
Sets the value of a modifiable element in the model. |
jigcell.compare.IDataElement |
simulate(jigcell.simulation.Simulator simulator)
Performs a simulation using the current model and settings. |
protected jigcell.compare.IDataElement |
simulate(jigcell.simulation.Simulator simulator,
java.io.File targetFile,
java.io.File outputFile)
Performs a simulation using the current model and settings. |
private java.lang.String |
translate()
Writes the model as an ODE file. |
private void |
translateCompartments(java.io.Writer writer)
Writes equations for compartments controlled by rules to an ODE file. |
private void |
translateFunctions(java.io.Writer writer)
Writes the function definitions in the model to an ODE file. |
private void |
translateGlobals(java.io.Writer writer)
Writes the events in the model to an ODE file. |
private void |
translateParameters(java.io.Writer writer)
Writes parameters that have been converted to equations in the model to an ODE file. |
private void |
translateSpecies(java.io.Writer writer)
Writes the species defined by equations in the model to an ODE file. |
private void |
translateVariables(java.io.Writer writer)
Writes the variables defined by rules in the model to an ODE file. |
private void |
writeSettingsAndValues(jigcell.simulation.Simulator simulator)
Writes the parameter and initial condition settings to the ODE file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int XPP_LINELENGTH
private static final java.util.regex.Pattern getSpeciesFromFunction
private static final java.util.regex.Pattern getMassActionParams
private static final java.util.regex.Pattern getStochMassActionParams
private static final java.util.regex.Pattern getMichaelieMentenParams
private static final java.util.regex.Pattern getStochMichaelieMentenParams
private static final java.util.regex.Pattern getBvarsFromFunction
private static final java.util.regex.Pattern checkIfExpression
private static final java.util.regex.Pattern checkNumber
private static final java.util.regex.Pattern cleanName
private static final java.util.regex.Pattern removeSpaces
private static boolean orderAlphbeticalSettingsList
private final int maximumIdentifierLength
private java.io.File targetFile
private java.util.List differentialIDs
private java.util.List nonDifferentialIDs
private java.util.Map idToOriginalValue
private java.util.Map idToXPPID
private java.util.Map speciesIDToCompartment
private java.util.Map speciesIDToEquation
private jigcell.sbml2.Model model
private java.util.Set compartmentIDs
private java.util.Set parameterIDs
private java.util.Set speciesIDs
private java.util.Set speciesWithInitialAmountIDs
private java.util.Set usedFunctionNames
private final java.lang.String odeData
private jigcell.sbml2.math.SymbolTable symbolTable
private jigcell.sbml2.jep.JEP expressionParser
private java.util.Map variableToEquationMap
private java.util.Map speciesToCompartmentMap
private java.util.Set hasNoDifferentialEquationSet
| Constructor Detail |
|---|
public SBMLToXPPTranslator(jigcell.simulation.Simulator simulator,
jigcell.sbml2.Model model,
java.io.File targetFile,
int maximumIdentifierLength)
throws java.lang.Exception
simulator - SimulatortargetFile - File to use for the ODEs. If this is null a temporary file is created.model - SBML modelmaximumIdentifierLength - Longest permitted length for an identifier
java.lang.Exception| Method Detail |
|---|
public static void main(java.lang.String[] args)
throws java.lang.Exception
args - Name of SBML and ODE files
java.lang.Exceptionprivate static java.lang.String breakEquation(java.lang.String text)
private static void buildSymbolTablePump(jigcell.sbml2.math.SymbolTable table,
java.util.Collection collection)
throws java.lang.Exception
java.lang.Exception
private static java.lang.String replaceFunctionName(java.lang.String text,
java.lang.String oldName,
java.lang.String newName)
public java.util.List getAvailableSelections()
public java.util.List getSettableNames()
public double getOriginalValue(java.lang.String id)
id - SBML id
public double setValue(jigcell.simulation.Simulator simulator,
java.lang.String id,
double value)
id - SBML idvalue - New element value
public jigcell.compare.IDataElement simulate(jigcell.simulation.Simulator simulator)
throws java.lang.Exception
simulator - Simulator
java.lang.Exceptionprotected java.util.List computeSelectionList(java.util.List returnData)
returnData - List[String] of columns to return when simulating
protected jigcell.compare.IDataElement simulate(jigcell.simulation.Simulator simulator,
java.io.File targetFile,
java.io.File outputFile)
throws java.lang.Exception
simulator - SimulatortargetFile - ODE fileoutputFile - File that will contain the simulator output
java.lang.Exception
private void applyVelocityTerm(java.lang.String velocity,
boolean positive,
jigcell.sbml2.SpeciesReference reference)
throws java.lang.Exception
java.lang.Exception
private void buildSymbolTable(jigcell.sbml2.Model model)
throws java.lang.Exception
java.lang.Exception
private void computeVelocities()
throws java.lang.Exception
java.lang.Exceptionprivate java.lang.String convertCapabilitiesToXPP(jigcell.simulation.Capabilities capabilities)
capabilities - Simulator capabilities
private java.lang.String convertIDToXPPID(java.lang.String id,
int unique)
private java.lang.String fixFunctionNames(java.lang.String text)
private java.lang.String fixIDs(java.lang.String text)
private java.lang.String generateVelocityFromMath(java.lang.String math)
throws java.lang.Exception
java.lang.Exception
protected java.lang.String getProgramDirectory()
throws java.lang.Exception
java.lang.Exception
private void registerIDs()
throws java.lang.Exception
java.lang.Exception
private java.lang.String translate()
throws java.lang.Exception
java.lang.Exception
private void translateCompartments(java.io.Writer writer)
throws java.lang.Exception
java.lang.Exception
private void translateFunctions(java.io.Writer writer)
throws java.lang.Exception
java.lang.Exception
private void translateGlobals(java.io.Writer writer)
throws java.lang.Exception
java.lang.Exception
private void translateParameters(java.io.Writer writer)
throws java.lang.Exception
java.lang.Exception
private void translateSpecies(java.io.Writer writer)
throws java.lang.Exception
java.lang.Exception
private void translateVariables(java.io.Writer writer)
throws java.lang.Exception
java.lang.Exception
private void writeSettingsAndValues(jigcell.simulation.Simulator simulator)
throws java.io.IOException
simulator - Simulator
java.io.IOException
public static void generateODEFromModelBuilder(jigcell.sbml2.Model model,
java.io.File odeFile,
boolean sortAlphabetically)
throws java.lang.Exception
odeFile - ODE File to save tomodel - SBML model
java.lang.Exceptionprivate void calculateAllEquationsInternal()
public java.lang.String getConcentration(jigcell.sbml2.Species species)
public void calculateEquationsFromReactions()
protected java.lang.String convertMathToInfix(java.lang.String math,
boolean rateLaw)
public java.lang.String getEquation(java.lang.String math,
java.lang.String equation)
public java.lang.String printParseTreeMassAction(jigcell.sbml2.math.Node curr)
public java.lang.String printParseTreeStochMassAction(jigcell.sbml2.math.Node curr,
java.lang.String equation)
public java.lang.String printParseTreeMichaelisMenten(jigcell.sbml2.math.Node curr)
public java.lang.String printParseTreeStochMichaelisMenten(jigcell.sbml2.math.Node curr)
protected java.lang.String replaceIdWithName(java.lang.String equation)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||