Search in sources :

Example 1 with VCDatabaseVisitor

use of cbit.vcell.modeldb.VCDatabaseVisitor in project vcell by virtualcell.

the class RuleBasedTest method main.

public static void main(String[] args) {
    try {
        PropertyLoader.loadProperties();
    } catch (Exception e) {
        e.printStackTrace();
    }
    final int numTrials = 40;
    VCDatabaseVisitor vcDatabaseVisitor = new VCDatabaseVisitor() {

        @Override
        public void visitMathModel(MathModel mathModel, PrintStream logFilePrintStream) {
            throw new IllegalArgumentException("Not Implemented");
        }

        @Override
        public void visitGeometry(Geometry geometry, PrintStream logFilePrintStream) {
            throw new IllegalArgumentException("Not Implemented");
        }

        @Override
        public void visitBioModel(BioModel bioModel, PrintStream logFilePrintStream) {
            SimulationContext[] simulationContexts = bioModel.getSimulationContexts();
            for (SimulationContext simContext : simulationContexts) {
                if ((simContext.getApplicationType() == Application.NETWORK_STOCHASTIC) && simContext.getGeometry().getDimension() == 0) {
                    File baseDirectory = createDirFile(simContext);
                    try {
                        checkNonspatialStochasticSimContext(simContext, baseDirectory, numTrials);
                    } catch (Exception e) {
                        e.printStackTrace();
                        if (!e.getMessage().contains("Only Mass Action Kinetics supported ")) {
                            writeMessageTofile(baseDirectory, e.getMessage());
                        }
                    }
                }
            }
        }

        @Override
        public boolean filterMathModel(MathModelInfo mathModelInfo) {
            return false;
        }

        @Override
        public boolean filterGeometry(GeometryInfo geometryInfo) {
            return false;
        }

        @Override
        public boolean filterBioModel(BioModelInfo bioModelInfo) {
            return // bioModelInfo.getVersion().getName().equals("model");
            bioModelInfo.getVersion().getName().equals("simpleModel_Network_orig");
        }
    };
    String currentUserID = "schaff";
    String[] allUsers = new String[] { /*-all*/
    currentUserID, "-" };
    VCDatabaseScanner.scanBioModels(allUsers, vcDatabaseVisitor, false);
}
Also used : PrintStream(java.io.PrintStream) MathModel(cbit.vcell.mathmodel.MathModel) BioModelInfo(org.vcell.util.document.BioModelInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) SimulationContext(cbit.vcell.mapping.SimulationContext) Geometry(cbit.vcell.geometry.Geometry) BioModel(cbit.vcell.biomodel.BioModel) GeometryInfo(cbit.vcell.geometry.GeometryInfo) VCDatabaseVisitor(cbit.vcell.modeldb.VCDatabaseVisitor) File(java.io.File)

Example 2 with VCDatabaseVisitor

use of cbit.vcell.modeldb.VCDatabaseVisitor in project vcell by virtualcell.

the class StandaloneRuleBasedTest method main.

public static void main(String[] args) {
    try {
        PropertyLoader.loadProperties();
    } catch (Exception e) {
        e.printStackTrace();
    }
    final int numTrials = 40;
    // 30 seconds
    final long bngTimeoutDurationMS = 30000;
    VCDatabaseVisitor vcDatabaseVisitor = new VCDatabaseVisitor() {

        @Override
        public void visitMathModel(MathModel mathModel, PrintStream logFilePrintStream) {
            throw new IllegalArgumentException("Not Implemented");
        }

        @Override
        public void visitGeometry(Geometry geometry, PrintStream logFilePrintStream) {
            throw new IllegalArgumentException("Not Implemented");
        }

        @Override
        public void visitBioModel(BioModel bioModel, PrintStream logFilePrintStream) {
            SimulationContext[] simulationContexts = bioModel.getSimulationContexts();
            for (SimulationContext simContext : simulationContexts) {
                if ((simContext.getApplicationType() == Application.NETWORK_STOCHASTIC) && simContext.getGeometry().getDimension() == 0) {
                    File baseDirectory = createDirFile(simContext);
                    try {
                        checkNonspatialStochasticSimContext(simContext, baseDirectory, numTrials, bngTimeoutDurationMS);
                    } catch (Exception e) {
                        e.printStackTrace();
                        if (!e.getMessage().contains("Only Mass Action Kinetics supported ")) {
                            StochtestFileUtils.writeMessageTofile(baseDirectory, e.getMessage());
                        }
                    }
                }
            }
        }

        @Override
        public boolean filterMathModel(MathModelInfo mathModelInfo) {
            return false;
        }

        @Override
        public boolean filterGeometry(GeometryInfo geometryInfo) {
            return false;
        }

        @Override
        public boolean filterBioModel(BioModelInfo bioModelInfo) {
            return // bioModelInfo.getVersion().getName().equals("model");
            bioModelInfo.getVersion().getName().equals("simpleModel_Network_orig");
        }
    };
    String currentUserID = "schaff";
    String[] allUsers = new String[] { /*-all*/
    currentUserID, "-" };
    VCDatabaseScanner.scanBioModels(allUsers, vcDatabaseVisitor, false);
}
Also used : PrintStream(java.io.PrintStream) MathModel(cbit.vcell.mathmodel.MathModel) BioModelInfo(org.vcell.util.document.BioModelInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) SimulationContext(cbit.vcell.mapping.SimulationContext) Geometry(cbit.vcell.geometry.Geometry) BioModel(cbit.vcell.biomodel.BioModel) GeometryInfo(cbit.vcell.geometry.GeometryInfo) VCDatabaseVisitor(cbit.vcell.modeldb.VCDatabaseVisitor) File(java.io.File)

Aggregations

BioModel (cbit.vcell.biomodel.BioModel)2 Geometry (cbit.vcell.geometry.Geometry)2 GeometryInfo (cbit.vcell.geometry.GeometryInfo)2 SimulationContext (cbit.vcell.mapping.SimulationContext)2 MathModel (cbit.vcell.mathmodel.MathModel)2 VCDatabaseVisitor (cbit.vcell.modeldb.VCDatabaseVisitor)2 File (java.io.File)2 PrintStream (java.io.PrintStream)2 BioModelInfo (org.vcell.util.document.BioModelInfo)2 MathModelInfo (org.vcell.util.document.MathModelInfo)2