Search in sources :

Example 21 with MathModelInfo

use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.

the class MathModelMetaDataPanel method setMathModelInfo.

/**
 * Sets the mathModelInfo property (cbit.vcell.mathmodel.MathModelInfo) value.
 * @param mathModelInfo The new value for the property.
 * @see #getMathModelInfo
 */
public void setMathModelInfo(MathModelInfo mathModelInfo) {
    MathModelInfo oldValue = fieldMathModelInfo;
    fieldMathModelInfo = mathModelInfo;
    firePropertyChange("mathModelInfo", oldValue, mathModelInfo);
}
Also used : MathModelInfo(org.vcell.util.document.MathModelInfo)

Example 22 with MathModelInfo

use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.

the class MathModelMetaDataTreeModel method setMathModelInfo.

/**
 * Sets the mathModelInfo property (cbit.vcell.mathmodel.MathModelInfo) value.
 * @param mathModelInfo The new value for the property.
 * @see #getMathModelInfo
 */
public void setMathModelInfo(MathModelInfo mathModelInfo) {
    if (mathModelInfo == fieldMathModelInfo) {
        return;
    }
    MathModelInfo oldValue = fieldMathModelInfo;
    fieldMathModelInfo = mathModelInfo;
    firePropertyChange("mathModelInfo", oldValue, mathModelInfo);
    refreshTree();
}
Also used : MathModelInfo(org.vcell.util.document.MathModelInfo)

Example 23 with MathModelInfo

use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.

the class VCDocumentDbTreeModel method initOwners.

protected static synchronized TreeMap<String, BioModelNode> initOwners(VCDocumentInfo[] vcDocumentInfos, User loginUser, VCDocumentDbTreeModel subTreeParent, Method subTreeMethod) {
    // 
    // get list of users (owners)
    // 
    Vector<User> userList = new Vector<User>();
    userList.addElement(loginUser);
    for (int i = 0; i < vcDocumentInfos.length; i++) {
        VCDocumentInfo vcDocumentInfo = vcDocumentInfos[i];
        if (!userList.contains(vcDocumentInfo.getVersion().getOwner())) {
            userList.addElement(vcDocumentInfo.getVersion().getOwner());
        }
    }
    // 
    // for each user
    // 
    TreeMap<String, BioModelNode> treeMap = new TreeMap<String, BioModelNode>(new Comparator<String>() {

        public int compare(String o1, String o2) {
            return o1.compareToIgnoreCase(o2);
        }
    });
    for (int ownerIndex = 0; ownerIndex < userList.size(); ownerIndex++) {
        User owner = (User) userList.elementAt(ownerIndex);
        BioModelNode ownerNode = null;
        try {
            if (vcDocumentInfos instanceof BioModelInfo[]) {
                ownerNode = (BioModelNode) subTreeMethod.invoke(subTreeParent, new Object[] { owner, (BioModelInfo[]) vcDocumentInfos });
            } else if (vcDocumentInfos instanceof MathModelInfo[]) {
                ownerNode = (BioModelNode) subTreeMethod.invoke(subTreeParent, new Object[] { owner, (MathModelInfo[]) vcDocumentInfos });
            } else if (vcDocumentInfos instanceof GeometryInfo[]) {
                ownerNode = (BioModelNode) subTreeMethod.invoke(subTreeParent, new Object[] { owner, (GeometryInfo[]) vcDocumentInfos });
            } else {
                throw new Exception("Unimplemented VCDocumentInfo type=" + vcDocumentInfos.getClass().getName());
            }
        } catch (Exception e) {
            ownerNode = new BioModelNode("Error" + e.getMessage());
        }
        if (owner.equals(loginUser) || ownerNode.getChildCount() > 0) {
            treeMap.put(owner.getName(), ownerNode);
        }
    }
    return treeMap;
}
Also used : User(org.vcell.util.document.User) BioModelInfo(org.vcell.util.document.BioModelInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) TreeMap(java.util.TreeMap) DataAccessException(org.vcell.util.DataAccessException) VCDocumentInfo(org.vcell.util.document.VCDocumentInfo) GeometryInfo(cbit.vcell.geometry.GeometryInfo) Vector(java.util.Vector)

Example 24 with MathModelInfo

use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.

the class EditTestCriteriaPanel method resetTextFields.

/**
 * Sets the testSuiteInfo property (cbit.vcell.numericstest.TestSuiteInfo) value.
 * @param testSuiteInfo The new value for the property.
 * @see #getTestSuiteInfo
 */
public void resetTextFields() {
    // If the chosen simInfo already has test criteria defined, set the fields with the appropriate values
    // Else set them to blank.
    getRelErrTextField().setText("");
    getAbsErrTextField().setText("");
    if (getExistingTestCriteria() != null) {
        Double relErr = getExistingTestCriteria().getMaxRelError();
        Double absErr = getExistingTestCriteria().getMaxAbsError();
        getRelErrTextField().setText((relErr != null ? relErr.toString() : null));
        getAbsErrTextField().setText((absErr != null ? absErr.toString() : null));
    }
    // Depending on test case soultion type (which is set by testingFrameworkWindowManager based on the test case
    // the simulation belongs to), enable apprpriate (ref MathModel, ref simInfo buttons) fields.
    // if (!getSolutionType().equals(TestCaseNew.REGRESSION)) {
    getRefMathModelLabel().setText(null);
    getRefSimLabel().setText(null);
    getBioModelAppLabel().setText(null);
    getBmAppSimLabel().setText(null);
    getRefMathModelButton().setEnabled(false);
    getRefMathModelLabel().setEnabled(false);
    getRefSimButton().setEnabled(false);
    getRefSimLabel().setEnabled(false);
    getSelectRefBMAppJButton().setEnabled(false);
    getBioModelAppLabel().setEnabled(false);
    getSelectRefSimJButton().setEnabled(false);
    getBmAppSimLabel().setEnabled(false);
    // } else {
    if (getExistingTestCriteria() instanceof TestCriteriaNewMathModel && getSolutionType().equals(TestCaseNew.REGRESSION)) {
        getRefMathModelButton().setEnabled(true);
        getRefMathModelLabel().setEnabled(true);
        getRefSimButton().setEnabled(true);
        getRefSimLabel().setEnabled(true);
    } else if (getExistingTestCriteria() instanceof TestCriteriaNewBioModel && getSolutionType().equals(TestCaseNew.REGRESSION)) {
        getSelectRefBMAppJButton().setEnabled(true);
        getBioModelAppLabel().setEnabled(true);
        getSelectRefSimJButton().setEnabled(true);
        getBmAppSimLabel().setEnabled(true);
    }
    if (getExistingTestCriteria() != null && getExistingTestCriteria().getRegressionSimInfo() != null) {
        if (getExistingTestCriteria() instanceof TestCriteriaNewMathModel) {
            MathModelInfo refMMInfo = ((TestCriteriaNewMathModel) getExistingTestCriteria()).getRegressionMathModelInfo();
            if (refMMInfo == null) {
                PopupGenerator.showErrorDialog(this, "No MathModelInfo found for SimInfo Key " + getExistingTestCriteria().getRegressionSimInfo().getVersion().getVersionKey());
            }
            SimulationInfo refSimInfo = null;
            refSimInfo = getExistingTestCriteria().getRegressionSimInfo();
            if (refSimInfo == null) {
                PopupGenerator.showErrorDialog(this, "No SimulationInfo found for simInfo Key " + getExistingTestCriteria().getRegressionSimInfo().getVersion().getVersionKey());
            }
            setReferenceMathModelInfo(refMMInfo);
            setReferenceSimInfo(refSimInfo);
            getRefMathModelLabel().setText("<html>" + refMMInfo.getVersion().getName() + "<br>(MathModelKey=" + refMMInfo.getVersion().getVersionKey() + ")<br>" + refMMInfo.getVersion().getDate() + "<html>");
            getRefSimLabel().setText("<html>" + refSimInfo.getVersion().getName() + "<br>(SimulationKey:" + refSimInfo.getVersion().getVersionKey() + ")</html>");
        } else if (getExistingTestCriteria() instanceof TestCriteriaNewBioModel) {
            BioModelInfo refBMInfo = ((TestCriteriaNewBioModel) getExistingTestCriteria()).getRegressionBioModelInfo();
            if (refBMInfo == null) {
                PopupGenerator.showErrorDialog(this, "No bioModelInfo found for SimInfo Key " + getExistingTestCriteria().getRegressionSimInfo().getVersion().getVersionKey());
            }
            SimulationInfo refSimInfo = null;
            refSimInfo = getExistingTestCriteria().getRegressionSimInfo();
            if (refSimInfo == null) {
                PopupGenerator.showErrorDialog(this, "No SimulationInfo found for simInfo Key " + getExistingTestCriteria().getRegressionSimInfo().getVersion().getVersionKey());
            }
            setbioModelInfo(refBMInfo);
            setbmAppSimInfo(refSimInfo);
            setappName(((TestCriteriaNewBioModel) getExistingTestCriteria()).getRegressionApplicationName());
            getBioModelAppLabel().setText("<html>" + refBMInfo.getVersion().getName() + "/" + getappName() + "<br>(BioModelKey=" + refBMInfo.getVersion().getVersionKey() + ")<br>" + refBMInfo.getVersion().getDate() + "</html>");
            getBmAppSimLabel().setText("<html>" + refSimInfo.getVersion().getName() + "<br>(SimulationKey:" + refSimInfo.getVersion().getVersionKey() + ")</html>");
        }
    } else {
        setReferenceMathModelInfo(null);
        setReferenceSimInfo(null);
        getRefMathModelLabel().setText("");
        getRefSimLabel().setText("");
        setbioModelInfo(null);
        setbmAppSimInfo(null);
        setappName(null);
        getBioModelAppLabel().setText(null);
        getBmAppSimLabel().setText(null);
    }
// }
}
Also used : TestCriteriaNewMathModel(cbit.vcell.numericstest.TestCriteriaNewMathModel) TestCriteriaNewBioModel(cbit.vcell.numericstest.TestCriteriaNewBioModel) BioModelInfo(org.vcell.util.document.BioModelInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) SimulationInfo(cbit.vcell.solver.SimulationInfo)

Example 25 with MathModelInfo

use of org.vcell.util.document.MathModelInfo 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)

Aggregations

MathModelInfo (org.vcell.util.document.MathModelInfo)67 BioModelInfo (org.vcell.util.document.BioModelInfo)37 DataAccessException (org.vcell.util.DataAccessException)32 GeometryInfo (cbit.vcell.geometry.GeometryInfo)22 VCDocumentInfo (org.vcell.util.document.VCDocumentInfo)14 MathModel (cbit.vcell.mathmodel.MathModel)12 Vector (java.util.Vector)11 BioModel (cbit.vcell.biomodel.BioModel)10 KeyValue (org.vcell.util.document.KeyValue)10 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)8 Hashtable (java.util.Hashtable)8 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)8 User (org.vcell.util.document.User)8 Simulation (cbit.vcell.solver.Simulation)7 UserCancelException (org.vcell.util.UserCancelException)7 Geometry (cbit.vcell.geometry.Geometry)6 SimulationContext (cbit.vcell.mapping.SimulationContext)6 TestCriteriaNewBioModel (cbit.vcell.numericstest.TestCriteriaNewBioModel)6 TestCriteriaNewMathModel (cbit.vcell.numericstest.TestCriteriaNewMathModel)6 SimulationInfo (cbit.vcell.solver.SimulationInfo)6