Some cleanup and starting test file.
This commit is contained in:
parent
8553a3dcef
commit
e493cfc7bb
20 changed files with 402 additions and 223 deletions
|
|
@ -13,7 +13,12 @@
|
|||
*******************************************************************************/
|
||||
package edu.utah.ece.async.ibiosim.analysis.simulation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import edu.utah.ece.async.ibiosim.dataModels.util.Message;
|
||||
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException;
|
||||
import edu.utah.ece.async.ibiosim.dataModels.util.observe.CoreObservable;
|
||||
|
||||
/**
|
||||
|
|
@ -24,11 +29,30 @@ import edu.utah.ece.async.ibiosim.dataModels.util.observe.CoreObservable;
|
|||
* @version $Rev$
|
||||
* @version %I%
|
||||
*/
|
||||
public abstract class AbstractSimulator extends CoreObservable implements ParentSimulator
|
||||
public abstract class AbstractSimulator extends CoreObservable
|
||||
{
|
||||
protected final Message message = new Message();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public abstract void simulate() throws IOException, XMLStreamException, BioSimException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public abstract void cancel();
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param newRun
|
||||
*/
|
||||
public abstract void setupForNewRun(int newRun) throws IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public abstract void printStatisticsTSD();
|
||||
|
||||
protected final Message message = new Message();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
* This file is part of iBioSim. Please visit <http://www.async.ece.utah.edu/ibiosim>
|
||||
* for the latest version of iBioSim.
|
||||
*
|
||||
* Copyright (C) 2017 University of Utah
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the Apache License. A copy of the license agreement is provided
|
||||
* in the file named "LICENSE.txt" included with this software distribution
|
||||
* and also available online at <http://www.async.ece.utah.edu/ibiosim/License>.
|
||||
*
|
||||
*******************************************************************************/
|
||||
package edu.utah.ece.async.ibiosim.analysis.simulation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Leandro Watanabe
|
||||
* @author Chris Myers
|
||||
* @author <a href="http://www.async.ece.utah.edu/ibiosim#Credits"> iBioSim Contributors </a>
|
||||
* @version %I%
|
||||
*/
|
||||
public interface ParentSimulator
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public abstract void simulate() throws IOException, XMLStreamException, BioSimException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public abstract void cancel();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public abstract void clear();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param newRun
|
||||
*/
|
||||
public abstract void setupForNewRun(int newRun) throws IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public abstract void printStatisticsTSD();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param randomSeed
|
||||
* @param runNumber
|
||||
* @throws IOException
|
||||
* @throws XMLStreamException
|
||||
*/
|
||||
public abstract void initialize(long randomSeed, int runNumber) throws IOException, XMLStreamException, BioSimException;
|
||||
}
|
||||
|
|
@ -525,7 +525,6 @@ public abstract class Simulator extends AbstractSimulator
|
|||
/**
|
||||
* clears data structures for new run
|
||||
*/
|
||||
@Override
|
||||
public abstract void clear();
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ public class SimulatorODERK extends Simulator
|
|||
initialize(randomSeed, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(long randomSeed, int runNumber) throws IOException
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -452,7 +452,6 @@ public class SimulatorSSACR extends Simulator
|
|||
* @throws IOException
|
||||
* @throws XMLStreamException
|
||||
*/
|
||||
@Override
|
||||
public void initialize(long randomSeed, int runNumber) throws IOException
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -225,7 +225,6 @@ public class SimulatorSSADirect extends Simulator
|
|||
* @throws IOException
|
||||
* @throws XMLStreamException
|
||||
*/
|
||||
@Override
|
||||
public void initialize(long randomSeed, int runNumber) throws IOException
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -17,18 +17,12 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import org.sbml.jsbml.SBMLDocument;
|
||||
import org.sbml.jsbml.SBMLErrorLog;
|
||||
import org.sbml.jsbml.SBMLReader;
|
||||
|
||||
import edu.utah.ece.async.ibiosim.analysis.properties.AnalysisProperties;
|
||||
import edu.utah.ece.async.ibiosim.analysis.properties.SimulationProperties;
|
||||
import edu.utah.ece.async.ibiosim.analysis.simulation.AbstractSimulator;
|
||||
|
|
@ -69,15 +63,11 @@ public abstract class HierarchicalSimulation extends AbstractSimulator
|
|||
|
||||
private boolean cancelFlag;
|
||||
private int currentRun;
|
||||
private boolean printConcentrations;
|
||||
private boolean sbmlHasErrorsFlag;
|
||||
private String abstraction;
|
||||
protected PriorityQueue<TriggeredEventNode> triggeredEventList;
|
||||
protected boolean isInitialized;
|
||||
|
||||
protected boolean hasEvents;
|
||||
|
||||
private boolean isGrid;
|
||||
private Random randomNumberGenerator;
|
||||
private HierarchicalModel topmodel;
|
||||
|
||||
|
|
@ -126,9 +116,7 @@ public abstract class HierarchicalSimulation extends AbstractSimulator
|
|||
{
|
||||
this.properties = copy.properties;
|
||||
this.printTime = copy.printTime;
|
||||
this.abstraction = copy.abstraction;
|
||||
this.type = copy.type;
|
||||
this.isGrid = copy.isGrid;
|
||||
this.topmodel = copy.topmodel;
|
||||
this.currentTime = copy.currentTime;
|
||||
this.randomNumberGenerator = copy.randomNumberGenerator;
|
||||
|
|
@ -177,7 +165,7 @@ public abstract class HierarchicalSimulation extends AbstractSimulator
|
|||
/**
|
||||
* @return the cancelFlag
|
||||
*/
|
||||
public boolean isCancelFlag()
|
||||
protected boolean isCancelFlag()
|
||||
{
|
||||
return cancelFlag;
|
||||
}
|
||||
|
|
@ -199,23 +187,6 @@ public abstract class HierarchicalSimulation extends AbstractSimulator
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the printConcentrations
|
||||
*/
|
||||
public boolean isPrintConcentrations()
|
||||
{
|
||||
return printConcentrations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sbmlHasErrorsFlag
|
||||
*/
|
||||
public boolean isSbmlHasErrorsFlag()
|
||||
{
|
||||
return sbmlHasErrorsFlag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param cancelFlag
|
||||
* the cancelFlag to set
|
||||
|
|
@ -244,52 +215,12 @@ public abstract class HierarchicalSimulation extends AbstractSimulator
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param printConcentrations
|
||||
* the printConcentrations to set
|
||||
*/
|
||||
public void setPrintConcentrations(boolean printConcentrations)
|
||||
{
|
||||
this.printConcentrations = printConcentrations;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param sbmlHasErrorsFlag
|
||||
* the sbmlHasErrorsFlag to set
|
||||
*/
|
||||
public void setSbmlHasErrorsFlag(boolean sbmlHasErrorsFlag)
|
||||
{
|
||||
this.sbmlHasErrorsFlag = sbmlHasErrorsFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getAbstraction()
|
||||
{
|
||||
return abstraction;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param abstraction
|
||||
*/
|
||||
public void setAbstraction(String abstraction)
|
||||
{
|
||||
this.abstraction = abstraction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the randomNumberGenerator
|
||||
*/
|
||||
public Random getRandomNumberGenerator()
|
||||
protected double getRandom()
|
||||
{
|
||||
return randomNumberGenerator;
|
||||
return randomNumberGenerator.nextDouble();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -302,22 +233,6 @@ public abstract class HierarchicalSimulation extends AbstractSimulator
|
|||
return topmodel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isGrid
|
||||
*/
|
||||
public boolean isGrid()
|
||||
{
|
||||
return isGrid;
|
||||
}
|
||||
/**
|
||||
* @param isGrid
|
||||
* the isGrid to set
|
||||
*/
|
||||
public void setGrid(boolean isGrid)
|
||||
{
|
||||
this.isGrid = isGrid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param topmodel
|
||||
* the topmodel to set
|
||||
|
|
|
|||
|
|
@ -86,13 +86,6 @@ class HierarchicalFBASimulator extends HierarchicalSimulation
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupForNewRun(int newRun)
|
||||
{
|
||||
|
|
@ -107,12 +100,6 @@ class HierarchicalFBASimulator extends HierarchicalSimulation
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(long randomSeed, int runNumber) throws IOException, XMLStreamException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void getState()
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ public final class HierarchicalMixedSimulator extends HierarchicalSimulation
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(long randomSeed, int runNumber) throws IOException, XMLStreamException, BioSimException
|
||||
{
|
||||
if (!isInitialized)
|
||||
|
|
@ -136,11 +135,6 @@ public final class HierarchicalMixedSimulator extends HierarchicalSimulation
|
|||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupForNewRun(int newRun)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -81,14 +81,7 @@ public final class HierarchicalODERKSimulator extends HierarchicalSimulation {
|
|||
public void cancel() {
|
||||
setCancelFlag(true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public void initialize(long randomSeed, int runNumber)
|
||||
throws IOException, XMLStreamException, BioSimException {
|
||||
if (!isInitialized) {
|
||||
|
|
|
|||
|
|
@ -62,8 +62,6 @@ public class HierarchicalSSADirectSimulator extends HierarchicalSimulation
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(long randomSeed, int runNumber) throws IOException, XMLStreamException, BioSimException
|
||||
{
|
||||
if (!isInitialized)
|
||||
|
|
@ -102,15 +100,6 @@ public class HierarchicalSSADirectSimulator extends HierarchicalSimulation
|
|||
setCancelFlag(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* clears data structures for new run
|
||||
*/
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupForNewRun(int newRun) throws IOException
|
||||
{
|
||||
|
|
@ -129,10 +118,6 @@ public class HierarchicalSSADirectSimulator extends HierarchicalSimulation
|
|||
double r1 = 0, r2 = 0, totalPropensity = 0, delta_t = 0, nextReactionTime = 0, previousTime = 0, nextEventTime = 0, nextMaxTime = 0;
|
||||
double timeLimit = simProperties.getTimeLimit();
|
||||
double maxTimeStep = simProperties.getMaxTimeStep();
|
||||
if (isSbmlHasErrorsFlag())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isInitialized)
|
||||
{
|
||||
|
|
@ -149,8 +134,8 @@ public class HierarchicalSSADirectSimulator extends HierarchicalSimulation
|
|||
// return;
|
||||
// }
|
||||
double currentTime = this.currentTime.getState().getStateValue();
|
||||
r1 = getRandomNumberGenerator().nextDouble();
|
||||
r2 = getRandomNumberGenerator().nextDouble();
|
||||
r1 = getRandom();
|
||||
r2 = getRandom();
|
||||
computePropensities();
|
||||
totalPropensity = getTotalPropensity();
|
||||
delta_t = Math.log(1 / r1) / totalPropensity;
|
||||
|
|
|
|||
|
|
@ -2,19 +2,46 @@ package edu.utah.ece.async.ibiosim.analysis.simulation.hierarchical;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import edu.utah.ece.async.ibiosim.analysis.properties.AnalysisProperties;
|
||||
import edu.utah.ece.async.ibiosim.analysis.simulation.hierarchical.methods.HierarchicalSSADirectSimulator;
|
||||
import edu.utah.ece.async.ibiosim.analysis.simulation.hierarchical.model.HierarchicalModel;
|
||||
import edu.utah.ece.async.ibiosim.analysis.simulation.hierarchical.model.HierarchicalModel.ModelType;
|
||||
import edu.utah.ece.async.ibiosim.analysis.simulation.hierarchical.util.setup.ModelSetup;
|
||||
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException;
|
||||
|
||||
|
||||
public class HierarchyTest {
|
||||
|
||||
private AnalysisProperties properties;
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
String root = HierarchyTest.class.getResource(".").getPath();
|
||||
properties = new AnalysisProperties("", "", root, false);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
fail("Not yet implemented");
|
||||
public void test_basic_setup() {
|
||||
try {
|
||||
properties.setModelFile("00001-sbml-l3v2.xml");
|
||||
HierarchicalSimulation simulator = new HierarchicalSSADirectSimulator(properties);
|
||||
ModelSetup.setupModels(simulator, ModelType.NONE);
|
||||
assertEquals(simulator.getListOfHierarchicalModels().size(), 1);
|
||||
|
||||
HierarchicalModel model = simulator.getListOfHierarchicalModels().get(0);
|
||||
assertEquals(model.getReactions().size(), 1);
|
||||
assertEquals(model.getNode("S1").getState().getState(0).getStateValue(), 0.00015, 1e-9);
|
||||
assertEquals(model.getNode("S2").getState().getState(0).getStateValue(), 0, 0);
|
||||
assertEquals(model.getNode("compartment").getState().getState(0).getStateValue(), 1, 0);
|
||||
assertEquals(model.getNode("k1").getState().getState(0).getStateValue(), 1, 0);
|
||||
} catch (IOException | XMLStreamException | BioSimException e) {
|
||||
fail("Could not initialize");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" version="2">
|
||||
<model metaid="_case00001" id="case00001" name="case00001" timeUnits="time">
|
||||
<listOfUnitDefinitions>
|
||||
<unitDefinition id="volume">
|
||||
<listOfUnits>
|
||||
<unit kind="litre" exponent="1" scale="0" multiplier="1"/>
|
||||
</listOfUnits>
|
||||
</unitDefinition>
|
||||
<unitDefinition id="substance">
|
||||
<listOfUnits>
|
||||
<unit kind="mole" exponent="1" scale="0" multiplier="1"/>
|
||||
</listOfUnits>
|
||||
</unitDefinition>
|
||||
<unitDefinition id="time">
|
||||
<listOfUnits>
|
||||
<unit kind="second" exponent="1" scale="0" multiplier="1"/>
|
||||
</listOfUnits>
|
||||
</unitDefinition>
|
||||
</listOfUnitDefinitions>
|
||||
<listOfCompartments>
|
||||
<compartment id="compartment" name="compartment" spatialDimensions="3" size="1" units="volume" constant="true"/>
|
||||
</listOfCompartments>
|
||||
<listOfSpecies>
|
||||
<species id="S1" name="S1" compartment="compartment" initialAmount="0.00015" substanceUnits="substance" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
|
||||
<species id="S2" name="S2" compartment="compartment" initialAmount="0" substanceUnits="substance" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
|
||||
</listOfSpecies>
|
||||
<listOfParameters>
|
||||
<parameter id="k1" name="k1" value="1" constant="true"/>
|
||||
</listOfParameters>
|
||||
<listOfReactions>
|
||||
<reaction id="reaction1" name="reaction1" reversible="false">
|
||||
<listOfReactants>
|
||||
<speciesReference species="S1" stoichiometry="1" constant="true"/>
|
||||
</listOfReactants>
|
||||
<listOfProducts>
|
||||
<speciesReference species="S2" stoichiometry="1" constant="true"/>
|
||||
</listOfProducts>
|
||||
<kineticLaw>
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<apply>
|
||||
<times/>
|
||||
<ci> compartment </ci>
|
||||
<ci> k1 </ci>
|
||||
<ci> S1 </ci>
|
||||
</apply>
|
||||
</math>
|
||||
</kineticLaw>
|
||||
</reaction>
|
||||
</listOfReactions>
|
||||
</model>
|
||||
</sbml>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" version="2">
|
||||
<model metaid="_case00029" id="case00029" name="case00029" timeUnits="time">
|
||||
<listOfUnitDefinitions>
|
||||
<unitDefinition id="volume">
|
||||
<listOfUnits>
|
||||
<unit kind="litre" exponent="1" scale="0" multiplier="1"/>
|
||||
</listOfUnits>
|
||||
</unitDefinition>
|
||||
<unitDefinition id="substance">
|
||||
<listOfUnits>
|
||||
<unit kind="mole" exponent="1" scale="0" multiplier="1"/>
|
||||
</listOfUnits>
|
||||
</unitDefinition>
|
||||
<unitDefinition id="time">
|
||||
<listOfUnits>
|
||||
<unit kind="second" exponent="1" scale="0" multiplier="1"/>
|
||||
</listOfUnits>
|
||||
</unitDefinition>
|
||||
</listOfUnitDefinitions>
|
||||
<listOfCompartments>
|
||||
<compartment id="compartment" name="compartment" spatialDimensions="3" size="1" units="volume" constant="true"/>
|
||||
</listOfCompartments>
|
||||
<listOfSpecies>
|
||||
<species id="S1" name="S1" compartment="compartment" initialAmount="7" substanceUnits="substance" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
|
||||
</listOfSpecies>
|
||||
<listOfRules>
|
||||
<assignmentRule metaid="rule1" variable="S1">
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<cn type="integer"> 7 </cn>
|
||||
</math>
|
||||
</assignmentRule>
|
||||
</listOfRules>
|
||||
</model>
|
||||
</sbml>
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" version="2">
|
||||
<model metaid="_case00119" id="case00119" name="case00119" timeUnits="time">
|
||||
<listOfFunctionDefinitions>
|
||||
<functionDefinition id="multiply" name="multiply">
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<lambda>
|
||||
<bvar>
|
||||
<ci> x </ci>
|
||||
</bvar>
|
||||
<bvar>
|
||||
<ci> y </ci>
|
||||
</bvar>
|
||||
<apply>
|
||||
<times/>
|
||||
<ci> x </ci>
|
||||
<ci> y </ci>
|
||||
</apply>
|
||||
</lambda>
|
||||
</math>
|
||||
</functionDefinition>
|
||||
</listOfFunctionDefinitions>
|
||||
<listOfUnitDefinitions>
|
||||
<unitDefinition id="volume">
|
||||
<listOfUnits>
|
||||
<unit kind="litre" exponent="1" scale="0" multiplier="1"/>
|
||||
</listOfUnits>
|
||||
</unitDefinition>
|
||||
<unitDefinition id="substance">
|
||||
<listOfUnits>
|
||||
<unit kind="mole" exponent="1" scale="0" multiplier="1"/>
|
||||
</listOfUnits>
|
||||
</unitDefinition>
|
||||
<unitDefinition id="time">
|
||||
<listOfUnits>
|
||||
<unit kind="second" exponent="1" scale="0" multiplier="1"/>
|
||||
</listOfUnits>
|
||||
</unitDefinition>
|
||||
</listOfUnitDefinitions>
|
||||
<listOfCompartments>
|
||||
<compartment id="compartment" name="compartment" spatialDimensions="3" size="1" units="volume" constant="true"/>
|
||||
</listOfCompartments>
|
||||
<listOfSpecies>
|
||||
<species id="S1" name="S1" compartment="compartment" initialAmount="1.5" substanceUnits="substance" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
|
||||
<species id="S2" name="S2" compartment="compartment" initialAmount="0" substanceUnits="substance" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
|
||||
<species id="S3" name="S3" compartment="compartment" initialAmount="2" substanceUnits="substance" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="true"/>
|
||||
</listOfSpecies>
|
||||
<listOfParameters>
|
||||
<parameter id="k1" name="k1" value="1.5" constant="true"/>
|
||||
</listOfParameters>
|
||||
<listOfReactions>
|
||||
<reaction id="reaction1" name="reaction1" reversible="false">
|
||||
<listOfReactants>
|
||||
<speciesReference species="S1" stoichiometry="1" constant="true"/>
|
||||
</listOfReactants>
|
||||
<listOfProducts>
|
||||
<speciesReference species="S2" stoichiometry="1" constant="true"/>
|
||||
</listOfProducts>
|
||||
<listOfModifiers>
|
||||
<modifierSpeciesReference species="S3"/>
|
||||
</listOfModifiers>
|
||||
<kineticLaw>
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<apply>
|
||||
<times/>
|
||||
<ci> compartment </ci>
|
||||
<ci> k1 </ci>
|
||||
<apply>
|
||||
<ci> multiply </ci>
|
||||
<ci> S1 </ci>
|
||||
<ci> S3 </ci>
|
||||
</apply>
|
||||
</apply>
|
||||
</math>
|
||||
</kineticLaw>
|
||||
</reaction>
|
||||
</listOfReactions>
|
||||
</model>
|
||||
</sbml>
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" version="2">
|
||||
<model metaid="_case00163" id="case00163" name="case00163" timeUnits="time">
|
||||
<listOfUnitDefinitions>
|
||||
<unitDefinition id="time">
|
||||
<listOfUnits>
|
||||
<unit kind="second" exponent="1" scale="0" multiplier="1"/>
|
||||
</listOfUnits>
|
||||
</unitDefinition>
|
||||
</listOfUnitDefinitions>
|
||||
<listOfParameters>
|
||||
<parameter id="S1" name="S1" value="0.015" constant="false"/>
|
||||
<parameter id="S2" name="S2" value="0" constant="false"/>
|
||||
<parameter id="k1" name="k1" value="0.5" constant="true"/>
|
||||
<parameter id="k2" name="k2" value="0.5" constant="true"/>
|
||||
</listOfParameters>
|
||||
<listOfRules>
|
||||
<rateRule metaid="rule1" variable="S1">
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<apply>
|
||||
<plus/>
|
||||
<apply>
|
||||
<times/>
|
||||
<ci> k2 </ci>
|
||||
<ci> S2 </ci>
|
||||
</apply>
|
||||
<apply>
|
||||
<times/>
|
||||
<cn type="integer"> -1 </cn>
|
||||
<ci> k1 </ci>
|
||||
<ci> S1 </ci>
|
||||
</apply>
|
||||
</apply>
|
||||
</math>
|
||||
</rateRule>
|
||||
<rateRule metaid="rule2" variable="S2">
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<apply>
|
||||
<plus/>
|
||||
<apply>
|
||||
<times/>
|
||||
<ci> k1 </ci>
|
||||
<ci> S1 </ci>
|
||||
</apply>
|
||||
<apply>
|
||||
<times/>
|
||||
<cn type="integer"> -1 </cn>
|
||||
<ci> k2 </ci>
|
||||
<ci> S2 </ci>
|
||||
</apply>
|
||||
</apply>
|
||||
</math>
|
||||
</rateRule>
|
||||
</listOfRules>
|
||||
</model>
|
||||
</sbml>
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" version="2">
|
||||
<model metaid="_case00171" id="case00171" name="case00171" timeUnits="time">
|
||||
<listOfFunctionDefinitions>
|
||||
<functionDefinition id="multiply" name="multiply">
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<lambda>
|
||||
<bvar>
|
||||
<ci> x </ci>
|
||||
</bvar>
|
||||
<bvar>
|
||||
<ci> y </ci>
|
||||
</bvar>
|
||||
<apply>
|
||||
<times/>
|
||||
<ci> x </ci>
|
||||
<ci> y </ci>
|
||||
</apply>
|
||||
</lambda>
|
||||
</math>
|
||||
</functionDefinition>
|
||||
</listOfFunctionDefinitions>
|
||||
<listOfUnitDefinitions>
|
||||
<unitDefinition id="time">
|
||||
<listOfUnits>
|
||||
<unit kind="second" exponent="1" scale="0" multiplier="1"/>
|
||||
</listOfUnits>
|
||||
</unitDefinition>
|
||||
</listOfUnitDefinitions>
|
||||
<listOfParameters>
|
||||
<parameter id="S1" name="S1" value="0.015" constant="false"/>
|
||||
<parameter id="S2" name="S2" value="0.015" constant="false"/>
|
||||
<parameter id="k1" name="k1" value="1" constant="true"/>
|
||||
</listOfParameters>
|
||||
<listOfRules>
|
||||
<rateRule metaid="rule1" variable="S1">
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<apply>
|
||||
<times/>
|
||||
<cn type="integer"> -1 </cn>
|
||||
<apply>
|
||||
<ci> multiply </ci>
|
||||
<ci> k1 </ci>
|
||||
<ci> S1 </ci>
|
||||
</apply>
|
||||
</apply>
|
||||
</math>
|
||||
</rateRule>
|
||||
<rateRule metaid="rule2" variable="S2">
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<apply>
|
||||
<ci> multiply </ci>
|
||||
<ci> k1 </ci>
|
||||
<ci> S1 </ci>
|
||||
</apply>
|
||||
</math>
|
||||
</rateRule>
|
||||
</listOfRules>
|
||||
</model>
|
||||
</sbml>
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Created by libAntimony version v2.9.0 with libSBML version 5.14.1. -->
|
||||
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" version="2">
|
||||
<model id="case01311" name="case01311">
|
||||
<listOfFunctionDefinitions>
|
||||
<functionDefinition id="three">
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<lambda>
|
||||
<cn type="integer"> 3 </cn>
|
||||
</lambda>
|
||||
</math>
|
||||
</functionDefinition>
|
||||
<functionDefinition id="getthree">
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<lambda>
|
||||
<apply>
|
||||
<ci> three </ci>
|
||||
</apply>
|
||||
</lambda>
|
||||
</math>
|
||||
</functionDefinition>
|
||||
<functionDefinition id="getgetthree">
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<lambda>
|
||||
<apply>
|
||||
<ci> getthree </ci>
|
||||
</apply>
|
||||
</lambda>
|
||||
</math>
|
||||
</functionDefinition>
|
||||
</listOfFunctionDefinitions>
|
||||
<listOfParameters>
|
||||
<parameter id="p1" constant="true"/>
|
||||
</listOfParameters>
|
||||
<listOfInitialAssignments>
|
||||
<initialAssignment symbol="p1">
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<apply>
|
||||
<ci> getgetthree </ci>
|
||||
</apply>
|
||||
</math>
|
||||
</initialAssignment>
|
||||
</listOfInitialAssignments>
|
||||
</model>
|
||||
</sbml>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
# Test cases for the hierarchical simulator
|
||||
|
||||
## From the SBML Test Suite
|
||||
|
||||
- 00001-sbml-l3v2.xml
|
||||
- 00029-sbml-l3v2.xml
|
||||
- 00119-sbml-l3v2.xml
|
||||
- 00163-sbml-l3v2.xml
|
||||
- 00171-sbml-l3v2.xml
|
||||
- 01311-sbml-l3v2.xml
|
||||
|
|
@ -44,18 +44,6 @@ import edu.utah.ece.async.ibiosim.learn.parameterestimator.methods.sres.SRES;
|
|||
*/
|
||||
public class ParameterEstimator
|
||||
{
|
||||
static double relativeError = 1e-6;
|
||||
static double absoluteError = 1e-9;
|
||||
static int numSteps;
|
||||
static double maxTimeStep = Double.POSITIVE_INFINITY;
|
||||
static double minTimeStep = 0.0;
|
||||
static long randomSeed = 0;
|
||||
static int runs = 1;
|
||||
static double stoichAmpValue = 1.0;
|
||||
static boolean genStats = false;
|
||||
static String selectedSimulator = "";
|
||||
static ArrayList<String> interestingSpecies = new ArrayList<String>();
|
||||
static String quantityType = "amount";
|
||||
|
||||
/**
|
||||
* This function is used to execute parameter estimation from a given SBML file. The input model serves
|
||||
|
|
@ -83,7 +71,6 @@ public class ParameterEstimator
|
|||
double[] lowerbounds = new double[numberofparameters];
|
||||
double[] upperbounds = new double[numberofparameters];
|
||||
HierarchicalSimulation sim = new HierarchicalODERKSimulator(properties, false);
|
||||
sim.initialize(randomSeed, 0);
|
||||
|
||||
for (int i = 0; i < numberofparameters; i++)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue