use of cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup in project vcell by virtualcell.
the class MIRIAMAnnotationEditor method removeSelectedRefGroups.
public void removeSelectedRefGroups() {
Object treeNode = jTreeMIRIAM.getLastSelectedPathComponent();
if (treeNode instanceof IdentifiableNode) {
Identifiable identifiable = ((IdentifiableNode) treeNode).getIdentifiable();
Map<MiriamRefGroup, MIRIAMQualifier> refGroupsToRemove = vcMetaData.getMiriamManager().getAllMiriamRefGroups(identifiable);
for (MiriamRefGroup refGroup : refGroupsToRemove.keySet()) {
MIRIAMQualifier qualifier = refGroupsToRemove.get(refGroup);
try {
vcMetaData.getMiriamManager().remove(identifiable, qualifier, refGroup);
} catch (URNParseFailureException e) {
e.printStackTrace(System.out);
}
}
}
}
use of cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup 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.MiriamRefGroup 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.MiriamRefGroup in project vcell by virtualcell.
the class SpeciesContextShape method paintSelf.
@Override
public void paintSelf(Graphics2D g, int absPosX, int absPosY) {
boolean isBound = false;
SpeciesContext sc = (SpeciesContext) getModelObject();
boolean bHasPCLink = false;
if (graphModel instanceof ModelCartoon) {
ModelCartoon mc = (ModelCartoon) graphModel;
// check if species has Pathway Commons link by querying VCMetadata : if it does, need to change color of speciesContext.
try {
MiriamManager miriamManager = mc.getModel().getVcMetaData().getMiriamManager();
Map<MiriamRefGroup, MIRIAMQualifier> miriamRefGroups = miriamManager.getAllMiriamRefGroups(sc.getSpecies());
if (miriamRefGroups != null && miriamRefGroups.size() > 0) {
bHasPCLink = true;
}
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
if (sc.getSpecies().getDBSpecies() != null || bHasPCLink) {
isBound = true;
}
int shapeHeight = getSpaceManager().getSize().height;
int shapeWidth = getSpaceManager().getSize().width;
int offsetX = (shapeWidth - circleDiameter) / 2;
int offsetY = (shapeHeight - circleDiameter) / 2;
Graphics2D g2D = g;
// if (icon == null) {
icon = new Area();
icon.add(new Area(new Ellipse2D.Double(offsetX, offsetY, circleDiameter, circleDiameter)));
// icon.add(new Area(new RoundRectangle2D.Double(offsetX, offsetY,circleDiameter,circleDiameter,circleDiameter/2,circleDiameter/2)));
// }
Area movedIcon = icon.createTransformedArea(AffineTransform.getTranslateInstance(absPosX, absPosY));
if (sc.getSpeciesPattern() == null) {
defaultBG = java.awt.Color.green;
} else {
defaultBG = java.awt.Color.blue;
}
if (isCatalyst == true) {
defaultBG = java.awt.Color.magenta;
}
backgroundColor = defaultBG;
darkerBackground = backgroundColor.darker().darker();
// g.setColor((!isBound && !isSelected()?darkerBackground:backgroundColor));
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color exterior = !isBound && !isSelected() ? darkerBackground : backgroundColor;
// Color interior = exterior.brighter().brighter();
Point2D center = new Point2D.Float(absPosX + circleDiameter * 0.5f, absPosY + circleDiameter * 0.5f);
float radius = circleDiameter * 0.5f;
Point2D focus = new Point2D.Float(absPosX + circleDiameter * 0.4f, absPosY + circleDiameter * 0.4f);
float[] dist = { 0.1f, 1.0f };
Color[] colors = { Color.white, exterior };
// Color[] colors = {interior, exterior};
RadialGradientPaint p = new RadialGradientPaint(center, radius, focus, dist, colors, CycleMethod.NO_CYCLE);
g2D.setPaint(p);
g2D.fill(movedIcon);
g.setColor(forgroundColor);
g2D.draw(movedIcon);
// draw label
if (getLabel() != null && getLabel().length() > 0) {
if (isSelected()) {
// clear background and outline to make selected label stand out
Rectangle outlineRectangle = getLabelOutline(absPosX, absPosY);
drawRaisedOutline(outlineRectangle.x, outlineRectangle.y, outlineRectangle.width, outlineRectangle.height, g, Color.white, forgroundColor, Color.gray);
}
g.setColor(forgroundColor);
g.drawString((isSelected() || smallLabel == null ? getLabel() : smallLabel), (isSelected() || smallLabel == null ? getLabelPos().x : smallLabelPos.x) + absPosX, getLabelPos().y + absPosY);
}
if (linkText != null && linkText != "") {
ShapePaintUtil.paintLinkMark(g2D, this, Color.BLACK);
}
}
use of cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup in project vcell by virtualcell.
the class VCMetaData method createBioPaxObjects.
public void createBioPaxObjects(BioModel bioModel) {
AnnotationMapping annoMapping = new AnnotationMapping();
VCMetaData vcMetaData = bioModel.getVCMetaData();
Set<Identifiable> identifiables = vcMetaData.getIdentifiableProvider().getAllIdentifiables();
TreeMap<Identifiable, Map<MiriamRefGroup, MIRIAMQualifier>> miriamDescrHeir = miriamManager.getMiriamTreeMap();
for (Identifiable identifiable : identifiables) {
Map<MiriamRefGroup, MIRIAMQualifier> refGroupMap = miriamDescrHeir.get(identifiable);
if (refGroupMap != null) {
String info = annoMapping.annotation2BioPaxObject(bioModel, identifiable);
boolean printInfo = false;
if (printInfo) {
System.out.println(info);
}
}
}
}
Aggregations