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);
}
}
}
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);
}
}
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);
}
}
}
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("• " + prettyResourceName + " <b>" + preferredName + "</b><br>");
List<URL> linkURLs = miriamManager.getStoredCrossReferencedLinks(resource);
for (URL url : linkURLs) {
buffer.append(" - <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());
}
}
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());
}
}
Aggregations