Search in sources :

Example 26 with MathModelInfo

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

the class BioModelEditor method setRightBottomPanelOnSelection.

@Override
protected void setRightBottomPanelOnSelection(Object[] selections) {
    if (selections == null) {
        return;
    }
    JComponent bottomComponent = rightBottomEmptyPanel;
    int destComponentIndex = DocumentEditorTabID.object_properties.ordinal();
    boolean bShowInDatabaseProperties = false;
    boolean bShowPathway = false;
    if (selections.length == 1) {
        Object singleSelection = selections[0];
        if (singleSelection instanceof ReactionStep) {
            bottomComponent = getReactionPropertiesPanel();
        } else if (singleSelection instanceof ReactionRule) {
            bottomComponent = getReactionRulePropertiesPanel();
        } else if (singleSelection instanceof SpeciesContext) {
            bottomComponent = getSpeciesPropertiesPanel();
        } else if (singleSelection instanceof MolecularType) {
            bottomComponent = getMolecularTypePropertiesPanel();
        } else if (singleSelection instanceof RbmObservable) {
            bottomComponent = getObservablePropertiesPanel();
        } else if (singleSelection instanceof Structure) {
            bottomComponent = getStructurePropertiesPanel();
            getStructurePropertiesPanel().setModel(bioModel.getModel());
        } else if (singleSelection instanceof Parameter) {
            bottomComponent = getParameterPropertiesPanel();
        } else if (singleSelection instanceof SimulationContext) {
            bottomComponent = getApplicationPropertiesPanel();
        } else if (singleSelection instanceof ParameterEstimationTask) {
            bottomComponent = parameterEstimationTaskPropertiesPanel;
        } else if (singleSelection instanceof Product || singleSelection instanceof Reactant) {
            bottomComponent = getReactionParticipantPropertiesPanel();
        } else if (singleSelection instanceof BioModelInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = bioModelMetaDataPanel;
        } else if (singleSelection instanceof MathModelInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = mathModelMetaDataPanel;
        } else if (singleSelection instanceof GeometryInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = geometryMetaDataPanel;
        } else if (singleSelection instanceof SpeciesContextSpec) {
            bottomComponent = getSpeciesContextSpecPanel();
        } else if (singleSelection instanceof ReactionSpec) {
            bottomComponent = getKineticsTypeTemplatePanel();
        } else if (singleSelection instanceof ReactionRuleSpec) {
            // 
            bottomComponent = getReactionRuleSpecPropertiesPanel();
        } else if (singleSelection instanceof BioModelsNetModelInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = getBioModelsNetPropertiesPanel();
        } else if (singleSelection instanceof Simulation) {
            bottomComponent = getSimulationSummaryPanel();
        } else if (singleSelection instanceof DataSymbol) {
            bottomComponent = getDataSymbolsSpecPanel();
        } else if (singleSelection instanceof BioEvent) {
            bottomComponent = getEventPanel();
        } else if (singleSelection instanceof SpatialObject) {
            bottomComponent = getSpatialObjectPropertyPanel();
        } else if (singleSelection instanceof SpatialProcess) {
            bottomComponent = getSpatialProcessPropertyPanel();
        } else if (singleSelection instanceof BioPaxObject) {
            bottomComponent = bioPaxObjectPropertiesPanel;
        } else if (singleSelection instanceof BioModel || singleSelection instanceof VCMetaData) {
            bottomComponent = bioModelEditorAnnotationPanel;
        } else if (singleSelection instanceof PathwayData) {
            bShowPathway = true;
            bottomComponent = getBioModelEditorPathwayPanel();
        } else if (singleSelection instanceof Model) {
        } else if (singleSelection instanceof RuleParticipantSignature) {
            bottomComponent = getReactionRuleParticipantSignaturePropertiesPanel();
        } else if (singleSelection instanceof CSGObject) {
            bottomComponent = csgObjectPropertiesPanel;
            csgObjectPropertiesPanel.setSimulationContext(getSelectedSimulationContext());
        } else if (singleSelection instanceof DocumentEditorTreeFolderNode) {
            DocumentEditorTreeFolderClass folderClass = ((DocumentEditorTreeFolderNode) singleSelection).getFolderClass();
            if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && !(singleSelection instanceof ReactionRule)) {
                bottomComponent = getReactionPropertiesPanel();
            } else if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && (singleSelection instanceof ReactionRule)) {
                bottomComponent = getReactionRulePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.STRUCTURES_NODE) {
                bottomComponent = getStructurePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.SPECIES_NODE) {
                bottomComponent = getSpeciesPropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE) {
                bottomComponent = getMolecularTypePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.OBSERVABLES_NODE) {
                bottomComponent = getObservablePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.APPLICATIONS_NODE) {
                bottomComponent = getApplicationsPropertiesPanel();
                getApplicationsPropertiesPanel().setBioModel(bioModel);
            } else if (folderClass == DocumentEditorTreeFolderClass.PARAMETER_ESTIMATION_NODE) {
                bottomComponent = parameterEstimationTaskPropertiesPanel;
            }
        }
    }
    if (bShowPathway) {
        for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
            if (rightBottomTabbedPane.getComponentAt(destComponentIndex) == bottomComponent) {
                break;
            }
        }
        String tabTitle = "Pathway Preview";
        if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
            rightBottomTabbedPane.addTab(tabTitle, new TabCloseIcon(), bottomComponent);
        }
    } else if (bShowInDatabaseProperties) {
        for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
            Component c = rightBottomTabbedPane.getComponentAt(destComponentIndex);
            if (c == bioModelMetaDataPanel || c == mathModelMetaDataPanel || c == geometryMetaDataPanel || c == getBioModelsNetPropertiesPanel()) {
                break;
            }
        }
        if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
            rightBottomTabbedPane.addTab(DATABASE_PROPERTIES_TAB_TITLE, new TabCloseIcon(), bottomComponent);
        }
    }
    if (rightBottomTabbedPane.getComponentAt(destComponentIndex) != bottomComponent) {
        bottomComponent.setBorder(GuiConstants.TAB_PANEL_BORDER);
        rightBottomTabbedPane.setComponentAt(destComponentIndex, bottomComponent);
        rightSplitPane.repaint();
    }
    if (rightBottomTabbedPane.getSelectedComponent() != bottomComponent) {
        rightBottomTabbedPane.setSelectedComponent(bottomComponent);
    }
}
Also used : RuleParticipantSignature(cbit.vcell.model.RuleParticipantSignature) BioPaxObject(org.vcell.pathway.BioPaxObject) Product(cbit.vcell.model.Product) PathwayData(cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData) SpeciesContext(cbit.vcell.model.SpeciesContext) SpeciesContextSpec(cbit.vcell.mapping.SpeciesContextSpec) Reactant(cbit.vcell.model.Reactant) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) VCMetaData(cbit.vcell.biomodel.meta.VCMetaData) SpatialProcess(cbit.vcell.mapping.spatial.processes.SpatialProcess) GeometryInfo(cbit.vcell.geometry.GeometryInfo) Structure(cbit.vcell.model.Structure) CSGObject(cbit.vcell.geometry.CSGObject) Component(java.awt.Component) JComponent(javax.swing.JComponent) ReactionRule(cbit.vcell.model.ReactionRule) ReactionSpec(cbit.vcell.mapping.ReactionSpec) ReactionRuleSpec(cbit.vcell.mapping.ReactionRuleSpec) RbmObservable(cbit.vcell.model.RbmObservable) JComponent(javax.swing.JComponent) BioModelInfo(org.vcell.util.document.BioModelInfo) DocumentEditorTreeFolderNode(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode) MathModelInfo(org.vcell.util.document.MathModelInfo) SimulationContext(cbit.vcell.mapping.SimulationContext) DocumentEditorTreeFolderClass(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass) MolecularType(org.vcell.model.rbm.MolecularType) ParameterEstimationTask(cbit.vcell.modelopt.ParameterEstimationTask) DataSymbol(cbit.vcell.data.DataSymbol) Simulation(cbit.vcell.solver.Simulation) ReactionStep(cbit.vcell.model.ReactionStep) BioModel(cbit.vcell.biomodel.BioModel) Model(cbit.vcell.model.Model) ListSelectionModel(javax.swing.ListSelectionModel) BioModel(cbit.vcell.biomodel.BioModel) Parameter(cbit.vcell.model.Parameter) BioPaxObject(org.vcell.pathway.BioPaxObject) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) CSGObject(cbit.vcell.geometry.CSGObject) BioEvent(cbit.vcell.mapping.BioEvent)

Example 27 with MathModelInfo

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

the class MathModelPropertiesPanel method updateInterface.

/**
 * Comment
 */
private void updateInterface() {
    if (mathModel == null || mathModelWindowManager == null) {
        return;
    }
    nameLabel.setText(mathModel.getName());
    Version version = mathModel.getVersion();
    try {
        if (version != null) {
            ownerLabel.setText(version.getOwner().getName());
            lastModifiedLabel.setText(version.getDate().toString());
            MathModelInfo mathModelInfo = mathModelWindowManager.getRequestManager().getDocumentManager().getMathModelInfo(version.getVersionKey());
            permissionLabel.setText(mathModelInfo.getVersion().getGroupAccess().getDescription());
            changePermissionButton.setEnabled(true);
        }
        Geometry geometry = mathModel.getGeometry();
        String geometryText = "Compartmental geometry";
        if (geometry != null) {
            Version geometryVersion = geometry.getVersion();
            int dimension = geometry.getDimension();
            if (dimension > 0) {
                String description = geometry.getDimension() + "D " + (geometry.getGeometrySpec().hasImage() ? "image" : "analytic") + " geometry";
                geometryText = description;
                if (geometryVersion != null) {
                    geometryText += " - " + geometryVersion.getName() + " (" + geometryVersion.getDate() + ")";
                }
            }
        }
        geometryLabel.setText(geometryText);
        detStochLabel.setText(mathModel.getMathDescription().getMathType().getDescription());
    } catch (DataAccessException e) {
        e.printStackTrace();
    }
}
Also used : Geometry(cbit.vcell.geometry.Geometry) Version(org.vcell.util.document.Version) MathModelInfo(org.vcell.util.document.MathModelInfo) DataAccessException(org.vcell.util.DataAccessException)

Example 28 with MathModelInfo

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

the class DatabaseWindowPanel method currentDocumentInfo.

/**
 * Comment
 */
private void currentDocumentInfo() {
    VCDocumentInfo selectedDocInfo = null;
    switch(getJTabbedPane1().getSelectedIndex()) {
        case 0:
            {
                // VCDocumentType.BIOMODEL_DOC
                selectedDocInfo = (BioModelInfo) getBioModelDbTreePanel1().getSelectedVersionInfo();
                break;
            }
        case 1:
            {
                // VCDocumentType.MATHMODEL_DOC
                selectedDocInfo = (MathModelInfo) getMathModelDbTreePanel1().getSelectedVersionInfo();
                break;
            }
        case 2:
            {
                // VCDocumentType.GEOMETRY_DOC
                selectedDocInfo = (GeometryInfo) getGeometryTreePanel1().getSelectedVersionInfo();
                break;
            }
    }
    setSelectedDocumentInfo(selectedDocInfo);
}
Also used : VCDocumentInfo(org.vcell.util.document.VCDocumentInfo) BioModelInfo(org.vcell.util.document.BioModelInfo) GeometryInfo(cbit.vcell.geometry.GeometryInfo) MathModelInfo(org.vcell.util.document.MathModelInfo)

Example 29 with MathModelInfo

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

the class MathModelTable method getInfo.

/**
 * This method was created in VisualAge.
 * @return cbit.vcell.geometry.GeometryInfo
 * @param rset java.sql.ResultSet
 * @param log cbit.vcell.server.SessionLog
 */
public VersionInfo getInfo(ResultSet rset, Connection con, DatabaseSyntax dbSyntax) throws SQLException, org.vcell.util.DataAccessException {
    KeyValue mathRef = new KeyValue(rset.getBigDecimal(table.mathRef.toString()));
    java.math.BigDecimal groupid = rset.getBigDecimal(VersionTable.privacy_ColumnName);
    Version version = getVersion(rset, DbDriver.getGroupAccessFromGroupID(con, groupid));
    String serialDbChildSummary = DbDriver.varchar2_CLOB_get(rset, MathModelTable.table.childSummarySmall, MathModelTable.table.childSummaryLarge, dbSyntax);
    String softwareVersion = rset.getString(SoftwareVersionTable.table.softwareVersion.toString());
    return new MathModelInfo(version, mathRef, serialDbChildSummary, VCellSoftwareVersion.fromString(softwareVersion));
}
Also used : KeyValue(org.vcell.util.document.KeyValue) VCellSoftwareVersion(org.vcell.util.document.VCellSoftwareVersion) Version(org.vcell.util.document.Version) MathModelInfo(org.vcell.util.document.MathModelInfo)

Example 30 with MathModelInfo

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

the class MathVerifier method scan.

/**
 * Insert the method's description here.
 * Creation date: (2/2/01 3:40:29 PM)
 */
public void scan(User[] users, boolean bUpdateDatabase, KeyValue[] bioAndMathModelKeys) throws MathException, MappingException, SQLException, DataAccessException, ModelException, ExpressionException {
    // java.util.Calendar calendar = java.util.GregorianCalendar.getInstance();
    // //	calendar.set(2002,java.util.Calendar.MAY,7+1);
    // calendar.set(2002,java.util.Calendar.JULY,1);
    // final java.util.Date fluxCorrectionOrDisablingBugFixDate = calendar.getTime();
    // //	calendar.set(2001,java.util.Calendar.JUNE,13+1);
    // calendar.set(2002,java.util.Calendar.JANUARY,1);
    // final java.util.Date totalVolumeCorrectionFixDate = calendar.getTime();
    KeyValue[] sortedBioAndMathModelKeys = null;
    if (bioAndMathModelKeys != null) {
        sortedBioAndMathModelKeys = bioAndMathModelKeys.clone();
        Arrays.sort(sortedBioAndMathModelKeys, keyValueCpmparator);
    }
    for (int i = 0; i < users.length; i++) {
        User user = users[i];
        BioModelInfo[] bioModelInfos0 = dbServerImpl.getBioModelInfos(user, false);
        MathModelInfo[] mathModelInfos0 = dbServerImpl.getMathModelInfos(user, false);
        if (lg.isTraceEnabled())
            lg.trace("Testing user '" + user + "'");
        Vector<VCDocumentInfo> userBioAndMathModelInfoV = new Vector<VCDocumentInfo>();
        userBioAndMathModelInfoV.addAll(Arrays.asList(bioModelInfos0));
        userBioAndMathModelInfoV.addAll(Arrays.asList(mathModelInfos0));
        // 
        for (int j = 0; j < userBioAndMathModelInfoV.size(); j++) {
            // 
            // if certain Bio or Math models are requested, then filter all else out
            // 
            VCDocumentInfo documentInfo = userBioAndMathModelInfoV.elementAt(j);
            KeyValue versionKey = documentInfo.getVersion().getVersionKey();
            if (sortedBioAndMathModelKeys != null) {
                int srch = Arrays.binarySearch(sortedBioAndMathModelKeys, versionKey, keyValueCpmparator);
                if (srch < 0) {
                    continue;
                }
            }
            if (!(documentInfo instanceof BioModelInfo)) {
                continue;
            }
            // 
            if (skipHash.contains(versionKey)) {
                System.out.println("skipping " + (documentInfo instanceof BioModelInfo ? "BioModel" : "MathModel") + " with key '" + versionKey + "'");
                continue;
            }
            try {
                // 
                // read in the BioModel and MathModel from the database
                // 
                VCDocument vcDocumentFromDBCache = null;
                BigString vcDocumentXMLFromDBCache = null;
                try {
                    long startTime = System.currentTimeMillis();
                    if (documentInfo instanceof BioModelInfo) {
                        vcDocumentXMLFromDBCache = new BigString(dbServerImpl.getServerDocumentManager().getBioModelXML(new QueryHashtable(), user, versionKey, false));
                        vcDocumentFromDBCache = XmlHelper.XMLToBioModel(new XMLSource(vcDocumentXMLFromDBCache.toString()));
                    } else {
                        vcDocumentXMLFromDBCache = new BigString(dbServerImpl.getServerDocumentManager().getMathModelXML(new QueryHashtable(), user, versionKey, false));
                        vcDocumentFromDBCache = XmlHelper.XMLToMathModel(new XMLSource(vcDocumentXMLFromDBCache.toString()));
                    }
                    if (bUpdateDatabase && testFlag.equals(MathVerifier.MV_LOAD_XML)) {
                        updateLoadModelsStatTable_LoadTest(System.currentTimeMillis() - startTime, versionKey, null);
                    }
                } catch (Exception e) {
                    lg.error(e.getMessage(), e);
                    if (bUpdateDatabase && testFlag.equals(MathVerifier.MV_LOAD_XML)) {
                        updateLoadModelsStatTable_LoadTest(0, versionKey, e);
                    }
                }
                if (testFlag.equals(MathVerifier.MV_LOAD_XML)) {
                    // 
                    if (vcDocumentXMLFromDBCache != null) {
                        testDocumentLoad(bUpdateDatabase, user, documentInfo, vcDocumentFromDBCache);
                    }
                } else if (testFlag.equals(MathVerifier.MV_DEFAULT)) {
                    // 
                    if (vcDocumentFromDBCache instanceof BioModel) {
                        BioModel bioModel = (BioModel) vcDocumentFromDBCache;
                        checkMathForBioModel(vcDocumentXMLFromDBCache, bioModel, user, bUpdateDatabase);
                    }
                }
            } catch (Throwable e) {
                // exception in whole BioModel
                lg.error(e.getMessage(), e);
            // can't update anything in database, since we don't know what simcontexts are involved
            }
        }
    }
}
Also used : QueryHashtable(cbit.sql.QueryHashtable) KeyValue(org.vcell.util.document.KeyValue) User(org.vcell.util.document.User) VCDocument(org.vcell.util.document.VCDocument) BioModelInfo(org.vcell.util.document.BioModelInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) BigString(org.vcell.util.BigString) PropertyVetoException(java.beans.PropertyVetoException) MatrixException(cbit.vcell.matrix.MatrixException) ModelException(cbit.vcell.model.ModelException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) SQLException(java.sql.SQLException) XmlParseException(cbit.vcell.xml.XmlParseException) DataAccessException(org.vcell.util.DataAccessException) ExpressionException(cbit.vcell.parser.ExpressionException) MappingException(cbit.vcell.mapping.MappingException) MathException(cbit.vcell.math.MathException) VCDocumentInfo(org.vcell.util.document.VCDocumentInfo) BioModel(cbit.vcell.biomodel.BioModel) Vector(java.util.Vector) XMLSource(cbit.vcell.xml.XMLSource)

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