Search in sources :

Example 1 with MiriamRefGroup

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);
            }
        }
    }
}
Also used : IdentifiableNode(cbit.vcell.xml.gui.MiriamTreeModel.IdentifiableNode) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) URNParseFailureException(org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup) Identifiable(org.vcell.util.document.Identifiable)

Example 2 with MiriamRefGroup

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);
    }
}
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 MiriamRefGroup

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);
        }
    }
}
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 MiriamRefGroup

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);
    }
}
Also used : MiriamManager(cbit.vcell.biomodel.meta.MiriamManager) Color(java.awt.Color) Rectangle(java.awt.Rectangle) SpeciesContext(cbit.vcell.model.SpeciesContext) RadialGradientPaint(java.awt.RadialGradientPaint) Point(java.awt.Point) RadialGradientPaint(java.awt.RadialGradientPaint) Graphics2D(java.awt.Graphics2D) Area(java.awt.geom.Area) Point2D(java.awt.geom.Point2D) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup)

Example 5 with MiriamRefGroup

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);
            }
        }
    }
}
Also used : Map(java.util.Map) IdentityHashMap(java.util.IdentityHashMap) TreeMap(java.util.TreeMap) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) AnnotationMapping(org.vcell.relationship.AnnotationMapping) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup) Identifiable(org.vcell.util.document.Identifiable)

Aggregations

MiriamRefGroup (cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup)10 MIRIAMQualifier (org.vcell.sybil.models.miriam.MIRIAMQualifier)7 MiriamResource (cbit.vcell.biomodel.meta.MiriamManager.MiriamResource)6 Identifiable (org.vcell.util.document.Identifiable)5 MiriamManager (cbit.vcell.biomodel.meta.MiriamManager)4 Map (java.util.Map)4 TreeMap (java.util.TreeMap)4 URNParseFailureException (org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException)3 BioModelNode (cbit.vcell.desktop.BioModelNode)2 SimulationContext (cbit.vcell.mapping.SimulationContext)2 MiriamTreeModel (cbit.vcell.xml.gui.MiriamTreeModel)2 IdentityHashMap (java.util.IdentityHashMap)2 IdentifiableComparator (cbit.vcell.biomodel.meta.IdentifiableComparator)1 VCID (cbit.vcell.biomodel.meta.VCID)1 VCMetaData (cbit.vcell.biomodel.meta.VCMetaData)1 Registry (cbit.vcell.biomodel.meta.registry.Registry)1 Entry (cbit.vcell.biomodel.meta.registry.Registry.Entry)1 Annotation (cbit.vcell.desktop.Annotation)1 Geometry (cbit.vcell.geometry.Geometry)1 SpeciesContext (cbit.vcell.model.SpeciesContext)1