Search in sources :

Example 1 with MiriamResource

use of cbit.vcell.biomodel.meta.MiriamManager.MiriamResource in project vcell by virtualcell.

the class MIRIAMAnnotationEditor method addIdentifierDialog.

public void addIdentifierDialog() {
    if (PopupGenerator.showComponentOKCancelDialog(MIRIAMAnnotationEditor.this, getJPanelNewIdentifier(), "Define New Formal Identifier") == JOptionPane.OK_OPTION) {
        MIRIAMQualifier qualifier = (MIRIAMQualifier) jComboBoxQualifier.getSelectedItem();
        MiriamManager.DataType objectNamespace = (MiriamManager.DataType) jComboBoxURI.getSelectedItem();
        String objectID = jTextFieldFormalID.getText();
        MiriamManager miriamManager = vcMetaData.getMiriamManager();
        HashSet<MiriamResource> miriamResources = new HashSet<MiriamResource>();
        try {
            miriamResources.add(miriamManager.createMiriamResource(objectNamespace.getBaseURN() + ":" + objectID));
            miriamManager.addMiriamRefGroup(getSelectedIdentifiable(), qualifier, miriamResources);
        } catch (Exception e) {
            e.printStackTrace();
            DialogUtils.showErrorDialog(this, "Add Identifier failed:\n" + e.getMessage(), e);
        }
    }
}
Also used : MiriamManager(cbit.vcell.biomodel.meta.MiriamManager) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) DataType(cbit.vcell.biomodel.meta.MiriamManager.DataType) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) DataType(cbit.vcell.biomodel.meta.MiriamManager.DataType) UtilCancelException(org.vcell.util.UtilCancelException) URNParseFailureException(org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException) HashSet(java.util.HashSet)

Example 2 with MiriamResource

use of cbit.vcell.biomodel.meta.MiriamManager.MiriamResource in project vcell by virtualcell.

the class MiriamTreeModel method createTree.

private void createTree() {
    MiriamManager miriamManager = vcMetaData.getMiriamManager();
    TreeMap<Identifiable, Map<MiriamRefGroup, MIRIAMQualifier>> miriamDescrHeir = miriamManager.getMiriamTreeMap();
    Map<Identifiable, Map<DateQualifier, Set<DublinCoreDate>>> dateMapMap = miriamManager.getDublinCoreDateMap();
    Set<Identifiable> identifiables = vcMetaData.getIdentifiableProvider().getAllIdentifiables();
    TreeSet<Identifiable> sortedIdentifiables = new TreeSet<Identifiable>(new IdentifiableComparator(vcMetaData.getIdentifiableProvider()));
    sortedIdentifiables.addAll(identifiables);
    ((DefaultMutableTreeNode) getRoot()).removeAllChildren();
    for (Identifiable identifiable : sortedIdentifiables) {
        Map<MiriamRefGroup, MIRIAMQualifier> refGroupMap = miriamDescrHeir.get(identifiable);
        Map<DateQualifier, Set<DublinCoreDate>> dateMap = dateMapMap.get(identifiable);
        VCID vcid = vcMetaData.getIdentifiableProvider().getVCID(identifiable);
        String modelComponentType = vcid.getClassName();
        String modelComponentName = vcid.getLocalName();
        IdentifiableNode modelComponentNode = new IdentifiableNode(identifiable, modelComponentType + " : " + modelComponentName);
        String freeTextAnnotation = vcMetaData.getFreeTextAnnotation(identifiable);
        if (freeTextAnnotation != null) {
            modelComponentNode.add(new BioModelNode(new Annotation(freeTextAnnotation), false));
        } else {
            modelComponentNode.add(new BioModelNode(new Annotation(""), false));
        }
        if (refGroupMap != null) {
            for (MiriamRefGroup refGroup : refGroupMap.keySet()) {
                MIRIAMQualifier qualifier = refGroupMap.get(refGroup);
                for (MiriamResource miriamResource : refGroup.getMiriamRefs()) {
                    LinkNode linkNode = new LinkNode(qualifier, miriamResource);
                    modelComponentNode.add(linkNode);
                }
            }
        }
        if (dateMap != null) {
            for (DublinCoreQualifier.DateQualifier qualifier : dateMap.keySet()) {
                Set<DublinCoreDate> dates = dateMap.get(qualifier);
                for (DublinCoreDate date : dates) {
                    modelComponentNode.add(new DateNode(qualifier, date));
                }
            }
        }
        ((DefaultMutableTreeNode) getRoot()).add(modelComponentNode);
    }
}
Also used : IdentifiableComparator(cbit.vcell.biomodel.meta.IdentifiableComparator) MiriamManager(cbit.vcell.biomodel.meta.MiriamManager) Set(java.util.Set) TreeSet(java.util.TreeSet) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) BioModelNode(cbit.vcell.desktop.BioModelNode) DateQualifier(org.vcell.sybil.models.dublincore.DublinCoreQualifier.DateQualifier) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) TreeSet(java.util.TreeSet) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup) VCID(cbit.vcell.biomodel.meta.VCID) DublinCoreDate(org.vcell.sybil.models.dublincore.DublinCoreDate) Annotation(cbit.vcell.desktop.Annotation) Identifiable(org.vcell.util.document.Identifiable) DateQualifier(org.vcell.sybil.models.dublincore.DublinCoreQualifier.DateQualifier) DublinCoreQualifier(org.vcell.sybil.models.dublincore.DublinCoreQualifier) TreeMap(java.util.TreeMap) Map(java.util.Map) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier)

Example 3 with MiriamResource

use of cbit.vcell.biomodel.meta.MiriamManager.MiriamResource in project vcell by virtualcell.

the class BioModelEditorTreeModel method populateAnnotationNode.

private void populateAnnotationNode() {
    for (BioModelNode node : annotationNodes) {
        if (node.isNodeDescendant(selectedBioModelNode)) {
            selectedBioModelNode = rootNode;
        }
        rootNode.remove(node);
    }
    annotationNodes.clear();
    int childIndex = 0;
    BioModelNode newChild = null;
    Set<MiriamRefGroup> isDescribedByAnnotation = bioModel.getVCMetaData().getMiriamManager().getMiriamRefGroups(bioModel, MIRIAMQualifier.MODEL_isDescribedBy);
    for (MiriamRefGroup refGroup : isDescribedByAnnotation) {
        for (MiriamResource miriamResources : refGroup.getMiriamRefs()) {
            newChild = new MiriamTreeModel.LinkNode(MIRIAMQualifier.MODEL_isDescribedBy, miriamResources);
            rootNode.insert(newChild, childIndex++);
            annotationNodes.add(newChild);
        }
    }
    Set<MiriamRefGroup> isAnnotation = bioModel.getVCMetaData().getMiriamManager().getMiriamRefGroups(bioModel, MIRIAMQualifier.MODEL_is);
    for (MiriamRefGroup refGroup : isAnnotation) {
        for (MiriamResource miriamResources : refGroup.getMiriamRefs()) {
            newChild = new MiriamTreeModel.LinkNode(MIRIAMQualifier.MODEL_is, miriamResources);
            rootNode.insert(newChild, childIndex++);
            annotationNodes.add(newChild);
        }
    }
}
Also used : MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) BioModelNode(cbit.vcell.desktop.BioModelNode) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup) MiriamTreeModel(cbit.vcell.xml.gui.MiriamTreeModel)

Example 4 with MiriamResource

use of cbit.vcell.biomodel.meta.MiriamManager.MiriamResource in project vcell by virtualcell.

the class SpeciesPropertiesPanel method updatePCLink.

private void updatePCLink() {
    try {
        StringBuffer buffer = new StringBuffer("<html>");
        MiriamManager miriamManager = bioModel.getModel().getVcMetaData().getMiriamManager();
        Map<MiriamRefGroup, MIRIAMQualifier> refGroups = miriamManager.getAllMiriamRefGroups(getSpeciesContext().getSpecies());
        if (refGroups != null && refGroups.size() > 0) {
            for (MiriamRefGroup refGroup : refGroups.keySet()) {
                Set<MiriamResource> miriamResources = refGroup.getMiriamRefs();
                for (MiriamResource resource : miriamResources) {
                    String urn = resource.getMiriamURN();
                    String preferredName = "";
                    if (urn != null && urn.length() > 0) {
                        String prettyName = miriamManager.getPrettyName(resource);
                        if (prettyName != null) {
                            preferredName = "[" + prettyName + "]";
                        }
                        String prettyResourceName = urn.replaceFirst("urn:miriam:", "");
                        buffer.append("&#x95;&nbsp;" + prettyResourceName + "&nbsp;<b>" + preferredName + "</b><br>");
                        List<URL> linkURLs = miriamManager.getStoredCrossReferencedLinks(resource);
                        for (URL url : linkURLs) {
                            buffer.append("&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<a href=\"" + url.toString() + "\">" + url.toString() + "</a><br>");
                        }
                    }
                }
            }
        }
        buffer.append("</html>");
        getPCLinkValueEditorPane().setText(buffer.toString());
        getPCLinkValueEditorPane().setCaretPosition(0);
    } catch (Exception ex) {
        ex.printStackTrace(System.out);
        DialogUtils.showErrorDialog(this, ex.getMessage());
    }
}
Also used : MiriamManager(cbit.vcell.biomodel.meta.MiriamManager) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup) URL(java.net.URL) URNParseFailureException(org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException) PropertyVetoException(java.beans.PropertyVetoException) ExpandVetoException(javax.swing.tree.ExpandVetoException) MalformedURLException(java.net.MalformedURLException)

Example 5 with MiriamResource

use of cbit.vcell.biomodel.meta.MiriamManager.MiriamResource in project vcell by virtualcell.

the class BioModelEditor method setRightTopPanel.

private void setRightTopPanel(Object selectedObject, SimulationContext simulationContext) {
    JComponent newTopPanel = emptyPanel;
    // DEFAULT_DIVIDER_LOCATION;
    int dividerLocation = rightSplitPane.getDividerLocation();
    if (selectedObject instanceof Model) {
        newTopPanel = bioModelEditorModelPanel;
    } else if (selectedObject instanceof BioModel || selectedObject instanceof VCMetaData || selectedObject instanceof MiriamResource) {
        newTopPanel = bioModelPropertiesPanel;
        bioModelPropertiesPanel.setBioModel(bioModel);
    } else if (selectedObject instanceof SimulationContext) {
        newTopPanel = bioModelEditorApplicationPanel;
        bioModelEditorApplicationPanel.setSimulationContext(simulationContext);
    } else if (selectedObject instanceof DocumentEditorTreeFolderNode) {
        DocumentEditorTreeFolderNode folderNode = (DocumentEditorTreeFolderNode) selectedObject;
        DocumentEditorTreeFolderClass folderClass = folderNode.getFolderClass();
        if (folderClass == DocumentEditorTreeFolderClass.MODEL_NODE) {
            newTopPanel = bioModelEditorModelPanel;
        } else if (folderClass == DocumentEditorTreeFolderClass.STRUCTURES_NODE || folderClass == DocumentEditorTreeFolderClass.SPECIES_NODE || folderClass == DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE || folderClass == DocumentEditorTreeFolderClass.OBSERVABLES_NODE || folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE || folderClass == DocumentEditorTreeFolderClass.REACTION_DIAGRAM_NODE) // || folderClass == DocumentEditorTreeFolderClass.STRUCTURE_DIAGRAM_NODE
        {
            newTopPanel = bioModelEditorModelPanel;
        } else if (folderClass == DocumentEditorTreeFolderClass.PATHWAY_DIAGRAM_NODE || folderClass == DocumentEditorTreeFolderClass.PATHWAY_OBJECTS_NODE || folderClass == DocumentEditorTreeFolderClass.BIOPAX_SUMMARY_NODE || folderClass == DocumentEditorTreeFolderClass.BIOPAX_TREE_NODE) {
            newTopPanel = bioModelEditorPathwayDiagramPanel;
        } else if (folderClass == DocumentEditorTreeFolderClass.PATHWAY_NODE) {
            newTopPanel = getBioModelEditorPathwayDiagramPanel();
            getBioModelEditorPathwayDiagramPanel().setBioModel(bioModel);
        } else if (folderClass == DocumentEditorTreeFolderClass.BIOMODEL_PARAMETERS_NODE) {
            newTopPanel = bioModelParametersPanel;
        } else if (folderClass == DocumentEditorTreeFolderClass.APPLICATIONS_NODE) {
            newTopPanel = bioModelEditorApplicationsPanel;
        // } else if (folderClass == DocumentEditorTreeFolderClass.DATA_NODE) {
        // newTopPanel = dataSymbolsPanel;
        } else if (folderClass == DocumentEditorTreeFolderClass.SCRIPTING_NODE) {
            newTopPanel = getScriptingPanel();
        } else if (folderClass == DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE || folderClass == DocumentEditorTreeFolderClass.PROTOCOLS_NODE || folderClass == DocumentEditorTreeFolderClass.SIMULATIONS_NODE || folderClass == DocumentEditorTreeFolderClass.GEOMETRY_NODE || folderClass == DocumentEditorTreeFolderClass.PARAMETER_ESTIMATION_NODE) {
            newTopPanel = bioModelEditorApplicationPanel;
            bioModelEditorApplicationPanel.setSimulationContext(simulationContext);
        }
    }
    Component rightTopComponent = rightSplitPane.getTopComponent();
    if (rightTopComponent != newTopPanel) {
        rightSplitPane.setTopComponent(newTopPanel);
    }
    rightSplitPane.setDividerLocation(dividerLocation);
    getSimulationConsolePanel().setSimulationContext(simulationContext);
    if (simulationContext == null) {
        rightBottomTabbedPane.remove(getSimulationConsolePanel());
    } else {
        // show the console only for bionetgen deterministic applications (flattened network)
        if (simulationContext.getApplicationType() == Application.RULE_BASED_STOCHASTIC) {
            // if(simulationContext.isRuleBased() || simulationContext.isStoch()) {
            // if(simulationContext.isStoch()) {
            rightBottomTabbedPane.remove(getSimulationConsolePanel());
            return;
        }
        boolean bHasRules = simulationContext.getModel().getRbmModelContainer().hasRules();
        if (!bHasRules) {
            rightBottomTabbedPane.remove(getSimulationConsolePanel());
            return;
        }
        // rightBottomTabbedPane.addTab("Network Console", new TabCloseIcon(), getSimulationConsolePanel());
        rightBottomTabbedPane.addTab("Network Generation Status", getSimulationConsolePanel());
    }
}
Also used : VCMetaData(cbit.vcell.biomodel.meta.VCMetaData) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) BioModel(cbit.vcell.biomodel.BioModel) JComponent(javax.swing.JComponent) Model(cbit.vcell.model.Model) ListSelectionModel(javax.swing.ListSelectionModel) BioModel(cbit.vcell.biomodel.BioModel) DocumentEditorTreeFolderNode(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode) SimulationContext(cbit.vcell.mapping.SimulationContext) DocumentEditorTreeFolderClass(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass) Component(java.awt.Component) JComponent(javax.swing.JComponent)

Aggregations

MiriamResource (cbit.vcell.biomodel.meta.MiriamManager.MiriamResource)10 MiriamRefGroup (cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup)6 MiriamManager (cbit.vcell.biomodel.meta.MiriamManager)5 HashSet (java.util.HashSet)4 MIRIAMQualifier (org.vcell.sybil.models.miriam.MIRIAMQualifier)4 SimulationContext (cbit.vcell.mapping.SimulationContext)3 URNParseFailureException (org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException)3 VCMetaData (cbit.vcell.biomodel.meta.VCMetaData)2 BioModelNode (cbit.vcell.desktop.BioModelNode)2 MiriamTreeModel (cbit.vcell.xml.gui.MiriamTreeModel)2 PropertyVetoException (java.beans.PropertyVetoException)2 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 Map (java.util.Map)2 Set (java.util.Set)2 TreeMap (java.util.TreeMap)2 Identifiable (org.vcell.util.document.Identifiable)2 BioModel (cbit.vcell.biomodel.BioModel)1 IdentifiableComparator (cbit.vcell.biomodel.meta.IdentifiableComparator)1 DataType (cbit.vcell.biomodel.meta.MiriamManager.DataType)1