use of cbit.vcell.biomodel.meta.MiriamManager.MiriamResource in project vcell by virtualcell.
the class BioModelPropertiesPanel method updateInterface.
/**
* Comment
*/
private void updateInterface() {
if (bioModel == null || bioModelWindowManager == null) {
return;
}
nameLabel.setText(bioModel.getName());
Version version = bioModel.getVersion();
if (version != null) {
ownerLabel.setText(version.getOwner().getName());
lastModifiedLabel.setText(version.getDate().toString());
try {
BioModelInfo bioModelInfo = bioModelWindowManager.getRequestManager().getDocumentManager().getBioModelInfo(version.getVersionKey());
permissionLabel.setText(bioModelInfo.getVersion().getGroupAccess().getDescription());
} catch (DataAccessException e) {
e.printStackTrace();
}
changePermissionButton.setEnabled(true);
}
webLinksPanel.removeAll();
webLinksPanel.setLayout(new GridLayout(0, 1));
Set<MiriamRefGroup> resources = new HashSet<MiriamRefGroup>();
Set<MiriamRefGroup> isDescribedByAnnotation = bioModel.getVCMetaData().getMiriamManager().getMiriamRefGroups(bioModel, MIRIAMQualifier.MODEL_isDescribedBy);
Set<MiriamRefGroup> isAnnotation = bioModel.getVCMetaData().getMiriamManager().getMiriamRefGroups(bioModel, MIRIAMQualifier.MODEL_is);
resources.addAll(isDescribedByAnnotation);
resources.addAll(isAnnotation);
for (MiriamRefGroup refGroup : resources) {
for (MiriamResource miriamResources : refGroup.getMiriamRefs()) {
LinkNode linkNode = new MiriamTreeModel.LinkNode(MIRIAMQualifier.MODEL_isDescribedBy, miriamResources);
final String link = linkNode.getLink();
String labelText = miriamResources.getDataType() == null ? "" : miriamResources.getDataType().getDataTypeName();
String toolTip = null;
if (link != null) {
toolTip = "double-click to open link " + link;
labelText = "<html><b>" + labelText + "</b> " + "<font color=blue><a href=" + link + ">" + link + "</a></font></html>";
}
JLabel label = new JLabel(labelText);
label.addMouseListener(new MouseListener() {
public void mouseReleased(MouseEvent e) {
}
public void mousePressed(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
public void mouseEntered(MouseEvent e) {
}
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
DialogUtils.browserLauncher(BioModelPropertiesPanel.this, link, "failed to open " + link);
}
}
});
label.setToolTipText(toolTip);
webLinksPanel.add(label);
}
}
applicationsPanel.removeAll();
int gridy = 0;
SimulationContext[] simulationContexts = bioModel.getSimulationContexts();
if (simulationContexts != null) {
for (int i = 0; i < simulationContexts.length; i++) {
SimulationContext simContext = simulationContexts[i];
JLabel label = new JLabel(simContext.getName());
label.setFont(label.getFont().deriveFont(Font.BOLD));
if (simContext.isRuleBased()) {
if (simContext.getGeometry().getDimension() == 0) {
label.setIcon(VCellIcons.appRbmNonspIcon);
}
} else if (simContext.isStoch()) {
if (simContext.getGeometry().getDimension() == 0) {
label.setIcon(VCellIcons.appStoNonspIcon);
} else {
label.setIcon(VCellIcons.appStoSpatialIcon);
}
} else {
// deterministic
if (simContext.getGeometry().getDimension() == 0) {
label.setIcon(VCellIcons.appDetNonspIcon);
} else {
label.setIcon(VCellIcons.appDetSpatialIcon);
}
}
GridBagConstraints gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy++;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.FIRST_LINE_START;
if (i > 0) {
gbc.insets = new Insets(4, 0, 0, 0);
}
applicationsPanel.add(label, gbc);
Geometry geometry = simContext.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();
}
}
}
JLabel geometryLabel = new JLabel(geometryText);
geometryLabel.setIcon(VCellIcons.geometryIcon);
JLabel detStochLabel = new JLabel(simContext.getMathType().getDescription());
detStochLabel.setIcon(VCellIcons.mathTypeIcon);
gbc.insets = new Insets(2, 20, 2, 2);
gbc.gridy = gridy++;
applicationsPanel.add(detStochLabel, gbc);
gbc.gridy = gridy++;
if (i == simulationContexts.length - 1) {
gbc.weighty = 1.0;
}
applicationsPanel.add(geometryLabel, gbc);
}
}
}
use of cbit.vcell.biomodel.meta.MiriamManager.MiriamResource in project vcell by virtualcell.
the class SpeciesPropertiesPanel method saveSelectedXRef.
public void saveSelectedXRef(final XRef selectedXRef, final MIRIAMQualifier miriamQualifier) {
AsynchClientTask task1 = new AsynchClientTask("retrieving metadata", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
String urn = XRefToURN.createURN(selectedXRef.db(), selectedXRef.id());
try {
MiriamManager miriamManager = bioModel.getModel().getVcMetaData().getMiriamManager();
MiriamResource resource = miriamManager.createMiriamResource(urn);
String urnstr = resource.getMiriamURN();
if (urnstr != null && urnstr.toLowerCase().contains("uniprot")) {
String prettyName = UniProtConstants.getNameFromID(urnstr);
if (prettyName != null) {
miriamManager.setPrettyName(resource, prettyName);
}
}
Set<MiriamResource> miriamResources = new HashSet<MiriamResource>();
miriamResources.add(resource);
miriamManager.addMiriamRefGroup(getSpeciesContext().getSpecies(), miriamQualifier, miriamResources);
MiriamProviderServiceLocator providerLocator = new MiriamProviderServiceLocator();
MiriamProvider provider = providerLocator.getMiriamWebServices();
String pcLink = resource.getMiriamURN();
if (pcLink != null && pcLink.length() > 0) {
String[] locations = provider.getLocations(pcLink);
if (locations != null) {
for (String url : locations) {
try {
miriamManager.addStoredCrossReferencedLink(resource, new URL(url));
} catch (MalformedURLException e) {
e.printStackTrace(System.out);
}
}
}
}
} catch (URNParseFailureException e) {
e.printStackTrace();
DialogUtils.showErrorDialog(SpeciesPropertiesPanel.this, e.getMessage());
}
}
};
AsynchClientTask task2 = new AsynchClientTask("displaying metadata", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
updatePCLink();
}
};
ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 });
}
use of cbit.vcell.biomodel.meta.MiriamManager.MiriamResource in project vcell by virtualcell.
the class BioModelTreeModel method addBioModelContents.
/**
* Insert the method's description here.
* Creation date: (11/28/00 2:41:43 PM)
* @param bioModelNode cbit.vcell.desktop.BioModelNode
* @param bioModelInfo cbit.vcell.biomodel.BioModelInfo
*/
private void addBioModelContents(BioModelNode bioModelNode, BioModel bioModel) {
//
if (bioModel == null) {
return;
}
// bioModelNode.add(new BioModelNode(bioModel.getModel(),false));
// if (bioModel.getDescription() != null && !bioModel.getDescription().equals("")){
bioModelNode.add(new BioModelNode(new Annotation(bioModel.getVCMetaData().getFreeTextAnnotation(bioModel)), false));
// }
Set<MiriamRefGroup> isDescribedByAnnotation = bioModel.getVCMetaData().getMiriamManager().getMiriamRefGroups(bioModel, MIRIAMQualifier.MODEL_isDescribedBy);
for (MiriamRefGroup refGroup : isDescribedByAnnotation) {
for (MiriamResource miriamResources : refGroup.getMiriamRefs()) {
bioModelNode.add(new MiriamTreeModel.LinkNode(MIRIAMQualifier.MODEL_isDescribedBy, miriamResources));
}
}
Set<MiriamRefGroup> isAnnotation = bioModel.getVCMetaData().getMiriamManager().getMiriamRefGroups(bioModel, MIRIAMQualifier.MODEL_is);
for (MiriamRefGroup refGroup : isAnnotation) {
for (MiriamResource miriamResources : refGroup.getMiriamRefs()) {
bioModelNode.add(new MiriamTreeModel.LinkNode(MIRIAMQualifier.MODEL_is, miriamResources));
}
}
SimulationContext[] scArray = bioModel.getSimulationContexts();
if (scArray != null) {
for (int i = 0; i < scArray.length; i++) {
BioModelNode scNode = new BioModelNode(scArray[i], true);
bioModelNode.add(scNode);
// scNode.add(new BioModelNode(scArray[i].getModel(),false));
// add application type node
MathType typeInfo = scArray[i].getMathType();
BioModelNode appTypeNode = new BioModelNode(typeInfo, false);
appTypeNode.setRenderHint("type", "AppType");
scNode.add(appTypeNode);
//
// Display Annotation on tree
//
scNode.add(new BioModelNode(new Annotation(scArray[i].getDescription()), false));
scNode.add(new BioModelNode(scArray[i].getGeometry(), false));
if (scArray[i].getMathDescription() != null) {
scNode.add(new BioModelNode(scArray[i].getMathDescription(), false));
} else {
scNode.add(new BioModelNode("math not generated", false));
}
//
// add simulations to simulationContext
//
Simulation[] simArray = bioModel.getSimulations();
if (simArray != null) {
for (int j = 0; j < simArray.length; j++) {
if (simArray[j].getMathDescription() == scArray[i].getMathDescription()) {
BioModelNode simNode = new BioModelNode(simArray[j], true);
scNode.add(simNode);
//
// add simulation children (simulation annotations)
//
// if (simArray[j].getDescription() != null && simArray[j].getDescription().length() > 0){
simNode.add(new BioModelNode(new Annotation(simArray[j].getDescription()), false));
// }
// simNode.add(new BioModelNode(simArray[i].getMathDescription(),false));
// simNode.add(new BioModelNode(simArray[i].getMathOverrides(),false));
// simNode.add(new BioModelNode(simArray[i].getMeshSpecification(),false));
// simNode.add(new BioModelNode(simArray[i].getSolverTaskDescription(),false));
}
}
}
}
}
}
use of cbit.vcell.biomodel.meta.MiriamManager.MiriamResource in project vcell by virtualcell.
the class Model method populateVCMetadata.
public void populateVCMetadata(boolean bMetadataPopulated) {
// populate free text for identifiables (species, reactionSteps, structures)
if (!bMetadataPopulated) {
for (int i = 0; i < fieldSpecies.length; i++) {
vcMetaData.setFreeTextAnnotation(fieldSpecies[i], fieldSpecies[i].getAnnotation());
if (fieldSpecies[i].getDBSpecies() != null) {
DBSpecies dbSpecies = fieldSpecies[i].getDBSpecies();
try {
if (dbSpecies.getFormalSpeciesInfo().getFormalSpeciesType().equals(FormalSpeciesType.compound)) {
// urn:miriam:kegg.compound
MiriamResource resource = vcMetaData.getMiriamManager().createMiriamResource("urn:miriam:kegg.compound:" + dbSpecies.getFormalSpeciesInfo().getFormalID());
Set<MiriamResource> miriamResources = new HashSet<MiriamResource>();
miriamResources.add(resource);
vcMetaData.getMiriamManager().addMiriamRefGroup(fieldSpecies[i], MIRIAMQualifier.BIO_isVersionOf, miriamResources);
} else if (dbSpecies.getFormalSpeciesInfo().getFormalSpeciesType().equals(FormalSpeciesType.enzyme)) {
// urn:miriam:ec-code
MiriamResource resource = vcMetaData.getMiriamManager().createMiriamResource("urn:miriam:ec-code:" + dbSpecies.getFormalSpeciesInfo().getFormalID());
Set<MiriamResource> miriamResources = new HashSet<MiriamResource>();
miriamResources.add(resource);
vcMetaData.getMiriamManager().addMiriamRefGroup(fieldSpecies[i], MIRIAMQualifier.BIO_isVersionOf, miriamResources);
} else if (dbSpecies.getFormalSpeciesInfo().getFormalSpeciesType().equals(FormalSpeciesType.protein)) {
MiriamResource resource = vcMetaData.getMiriamManager().createMiriamResource("urn:miriam:uniprot:" + dbSpecies.getFormalSpeciesInfo().getFormalID());
Set<MiriamResource> miriamResources = new HashSet<MiriamResource>();
miriamResources.add(resource);
vcMetaData.getMiriamManager().addMiriamRefGroup(fieldSpecies[i], MIRIAMQualifier.BIO_isVersionOf, miriamResources);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
for (int i = 0; i < fieldReactionSteps.length; i++) {
vcMetaData.setFreeTextAnnotation(fieldReactionSteps[i], fieldReactionSteps[i].getAnnotation());
}
// // No annotation in structures for the moment.
// for (int i = 0; i < fieldStructures.length; i++) {
// vcMetaData.setFreeTextAnnotation(fieldStructures[i], fieldStructures[i].getAnnotation());
// }
}
}
use of cbit.vcell.biomodel.meta.MiriamManager.MiriamResource in project vcell by virtualcell.
the class AnnotationMapping method getRefInfo.
private HashMap<String, String> getRefInfo(BioModel bioModel, Identifiable identifiable) {
HashMap<String, String> info = new HashMap<String, String>();
VCMetaData vcMetaData = bioModel.getVCMetaData();
MiriamManager miriamManager = vcMetaData.getMiriamManager();
TreeMap<Identifiable, Map<MiriamRefGroup, MIRIAMQualifier>> miriamDescrHeir = miriamManager.getMiriamTreeMap();
Map<MiriamRefGroup, MIRIAMQualifier> refGroupMap = miriamDescrHeir.get(identifiable);
if (refGroupMap != null) {
for (MiriamRefGroup refGroup : refGroupMap.keySet()) {
MIRIAMQualifier qualifier = refGroupMap.get(refGroup);
String[] quaTemp = qualifier.toString().split("/");
String bioQualifier = quaTemp[quaTemp.length - 1];
bioQualifier = bioQualifier.substring(0, bioQualifier.length() - 1);
for (MiriamResource miriamResource : refGroup.getMiriamRefs()) {
String refSource = miriamResource.getMiriamURN();
String[] temp = refSource.split(":");
String sourceInfo = temp[2] + ":" + bioQualifier;
String refId = miriamResource.getIdentifier();
info.put(refId, sourceInfo);
// System.out.println(refId + "*********" + sourceInfo);
}
}
}
return info;
}
Aggregations