Search in sources :

Example 1 with Entity

use of org.vcell.pathway.Entity in project vcell by virtualcell.

the class PathwayProducerBiopax3 method addContentEntity.

// dataSource		Provenance	multiple
// availability	String		multiple
// name			String		multiple
// xref			Xref		multiple
// evidence		Evidence	multiple
private Element addContentEntity(BioPaxObject bpObject, Element element) {
    element = addContentBioPaxObject(bpObject, element);
    Entity ob = (Entity) bpObject;
    Element tmpElement = null;
    if (ob.getDataSource() != null && ob.getDataSource().size() > 0) {
        ArrayList<Provenance> list = ob.getDataSource();
        for (Provenance item : list) {
            tmpElement = new Element("dataSource", bp);
            addIDToProperty(tmpElement, item);
            mustPrintObject(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getAvailability() != null && ob.getAvailability().size() > 0) {
        ArrayList<String> list = ob.getAvailability();
        for (String item : list) {
            tmpElement = new Element("availability", bp);
            tmpElement.setAttribute("datatype", schemaString, rdf);
            tmpElement.setText(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getName() != null && ob.getName().size() > 0) {
        ArrayList<String> list = ob.getName();
        for (String item : list) {
            tmpElement = new Element("name", bp);
            tmpElement.setAttribute("datatype", schemaString, rdf);
            tmpElement.setText(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getxRef() != null && ob.getxRef().size() > 0) {
        ArrayList<Xref> list = ob.getxRef();
        for (Xref item : list) {
            String elementName = "xref";
            tmpElement = new Element(elementName, bp);
            addIDToProperty(tmpElement, item);
            mustPrintObject(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getEvidence() != null && ob.getEvidence().size() > 0) {
        ArrayList<Evidence> list = ob.getEvidence();
        for (Evidence item : list) {
            tmpElement = new Element("evidence", bp);
            addIDToProperty(tmpElement, item);
            mustPrintObject(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getSBSubEntity() != null && ob.getSBSubEntity().size() > 0) {
        ArrayList<SBEntity> list = ob.getSBSubEntity();
        for (SBEntity item : list) {
            tmpElement = new Element("sbSubEntity", bp);
            addIDToProperty(tmpElement, item);
            mustPrintObject(item);
            element.addContent(tmpElement);
        }
    }
    return element;
}
Also used : SBEntity(org.vcell.pathway.sbpax.SBEntity) PhysicalEntity(org.vcell.pathway.PhysicalEntity) Entity(org.vcell.pathway.Entity) Provenance(org.vcell.pathway.Provenance) Xref(org.vcell.pathway.Xref) RelationshipXref(org.vcell.pathway.RelationshipXref) PublicationXref(org.vcell.pathway.PublicationXref) Element(org.jdom.Element) Evidence(org.vcell.pathway.Evidence) PathwayXMLHelper.schemaString(org.vcell.pathway.PathwayXMLHelper.schemaString) SBEntity(org.vcell.pathway.sbpax.SBEntity)

Example 2 with Entity

use of org.vcell.pathway.Entity in project vcell by virtualcell.

the class BioModelEditorPathwayDiagramPanel method collapse2Complex.

private GroupObject collapse2Complex(BioPaxObject bpObject) {
    PathwayGrouping pathwayGrouping = new PathwayGrouping();
    GroupObject groupObject = null;
    HashSet<BioPaxObject> hiddenobjects = new HashSet<BioPaxObject>();
    if (bpObject instanceof Complex) {
        // collapse components
        Complex complex = (Complex) bpObject;
        Set<BioPaxObject> bioPaxObjects = new HashSet<BioPaxObject>(bioModel.getPathwayModel().getBiopaxObjects());
        for (PhysicalEntity pe : complex.getComponents()) {
            if (bioPaxObjects.contains(pe)) {
                hiddenobjects.add(pe);
            }
        }
        if (hiddenobjects.size() > 0) {
            hiddenobjects.add(bpObject);
            String id = pathwayGrouping.groupIdGenerator(bioModel.getPathwayModel());
            groupObject = pathwayGrouping.createGroupObject(bioModel.getPathwayModel(), ((Entity) bpObject).getName(), id, hiddenobjects, GroupObject.Type.GROUPEDCOMPLEX);
        } else {
            // error message
            DialogUtils.showErrorDialog(this, "No Collapse action happened because the components of the complex, " + getEntityName(complex) + ", haven't been imported to pathway model.");
        }
    } else if (bpObject instanceof Protein || bpObject instanceof SmallMolecule) {
        Set<BioPaxObject> bioPaxObjects = new HashSet<BioPaxObject>(bioModel.getPathwayModel().getBiopaxObjects());
        ArrayList<String> name = new ArrayList<String>();
        List<BioPaxObject> parents = bioModel.getPathwayModel().getParents(bpObject);
        if (parents.isEmpty()) {
            DialogUtils.showErrorDialog(this, "No Collapse action happened because protein, " + getEntityName((Entity) bpObject) + ", doesn't involve in any complexes in the pathway data.");
            return null;
        }
        for (BioPaxObject bpo : bioModel.getPathwayModel().getParents(bpObject)) {
            if (bpo instanceof Complex && bioPaxObjects.contains(bpo)) {
                hiddenobjects.add(bpo);
                name.addAll(((Complex) bpo).getName());
                for (PhysicalEntity pe : ((Complex) bpo).getComponents()) {
                    if (bioPaxObjects.contains(pe)) {
                        hiddenobjects.add(pe);
                    }
                }
            }
        }
        if (hiddenobjects.size() > 0) {
            hiddenobjects.add(bpObject);
            String id = pathwayGrouping.groupIdGenerator(bioModel.getPathwayModel());
            if (name.size() == 0) {
                name.add(id);
            }
            groupObject = pathwayGrouping.createGroupObject(bioModel.getPathwayModel(), name, id, hiddenobjects, GroupObject.Type.GROUPEDCOMPLEX);
        } else {
            // error message
            DialogUtils.showErrorDialog(this, "No Collapse action happened because complexes that relate to protein, " + getEntityName((Entity) bpObject) + ", haven't been imported to pathway model.");
        }
    }
    return groupObject;
}
Also used : PhysicalEntity(org.vcell.pathway.PhysicalEntity) Entity(org.vcell.pathway.Entity) Set(java.util.Set) HashSet(java.util.HashSet) PathwayGrouping(org.vcell.pathway.group.PathwayGrouping) BioPaxObject(org.vcell.pathway.BioPaxObject) ArrayList(java.util.ArrayList) GroupObject(org.vcell.pathway.GroupObject) Protein(org.vcell.pathway.Protein) Complex(org.vcell.pathway.Complex) PhysicalEntity(org.vcell.pathway.PhysicalEntity) SmallMolecule(org.vcell.pathway.SmallMolecule) ArrayList(java.util.ArrayList) List(java.util.List) HashSet(java.util.HashSet)

Example 3 with Entity

use of org.vcell.pathway.Entity in project vcell by virtualcell.

the class BioPaxObjectPropertiesPanel method lookupFormalName.

private void lookupFormalName(final int tableRow) {
    final String FORMAL_NAMES_KEY = "FORMAL_NAMES_KEY";
    final Entity entity = (Entity) BioPaxObjectPropertiesPanel.this.bioPaxObject;
    AsynchClientTask initLookupTask = new AsynchClientTask("init lookup...", AsynchClientTask.TASKTYPE_SWING_BLOCKING, false) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            if (!lookupContains(entity)) {
                lookupAdd(entity);
            }
            refreshInterface();
        }
    };
    AsynchClientTask lookupTask = new AsynchClientTask("looking...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING, false) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            ArrayList<Xref> xrefArrList = entity.getxRef();
            ArrayList<String> formalNames = AnnotationMapping.getNameRef(xrefArrList, null);
            if (formalNames != null && formalNames.size() > 0) {
                hashTable.put(FORMAL_NAMES_KEY, formalNames);
            }
        }
    };
    AsynchClientTask finishLookupTask = new AsynchClientTask("init lookup...", AsynchClientTask.TASKTYPE_SWING_NONBLOCKING, false) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            try {
                ArrayList<String> formalNames = (ArrayList<String>) hashTable.get(FORMAL_NAMES_KEY);
                if (formalNames != null) {
                    entity.setFormalNames(formalNames);
                } else if (entity.getxRef() != null && entity.getxRef().size() > 0) {
                    String str = "";
                    for (int i = 0; i < ((Entity) BioPaxObjectPropertiesPanel.this.bioPaxObject).getxRef().size(); i++) {
                        str += (i > 0 ? "\n" : "") + entity.getxRef().get(i).getDb() + ":" + entity.getxRef().get(i).getId();
                    }
                    throw new Exception("Formal name lookup not yet implemented using:\n" + str);
                } else {
                    throw new Exception("No cross-references available to lookup formal name for " + entity.getName().get(0));
                }
            } finally {
                lookupRemove(entity);
                refreshInterface();
                table.setRowSelectionInterval(tableRow, tableRow);
            }
        }
    };
    ClientTaskDispatcher.dispatch(null, new Hashtable<String, Object>(), new AsynchClientTask[] { initLookupTask, lookupTask, finishLookupTask }, null, false, false, false, null, false);
}
Also used : SBEntity(org.vcell.pathway.sbpax.SBEntity) PhysicalEntity(org.vcell.pathway.PhysicalEntity) Entity(org.vcell.pathway.Entity) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Xref(org.vcell.pathway.Xref) UnificationXref(org.vcell.pathway.UnificationXref) RelationshipXref(org.vcell.pathway.RelationshipXref) PublicationXref(org.vcell.pathway.PublicationXref) Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList) GroupObject(org.vcell.pathway.GroupObject) BioPaxObject(org.vcell.pathway.BioPaxObject) RelationshipObject(org.vcell.relationship.RelationshipObject) BioModelEntityObject(cbit.vcell.model.BioModelEntityObject)

Example 4 with Entity

use of org.vcell.pathway.Entity in project vcell by virtualcell.

the class BioPaxObjectPropertiesPanel method refreshInterface.

protected void refreshInterface() {
    if (bioPaxObject == null) {
        // sanity check
        return;
    }
    ArrayList<BioPaxObjectProperty> propertyList = new ArrayList<BioPaxObjectProperty>();
    if (!(bioPaxObject instanceof SBEntity)) {
        tableModel.setData(propertyList);
        return;
    }
    SBEntity sbEntity = (SBEntity) bioPaxObject;
    if (!(sbEntity instanceof Entity)) {
        tableModel.setData(propertyList);
        return;
    }
    Entity entity = (Entity) sbEntity;
    // entity::type
    propertyList.add(new BioPaxObjectProperty("Type", bioPaxObject.getTypeLabel()));
    if (lookupContains(entity)) {
        propertyList.add(new BioPaxObjectProperty("Name", entity.getName().get(0) + " (looking...)"));
    } else if (entity.getFormalNames() != null && entity.getFormalNames().size() != 0) {
        propertyList.add(new BioPaxObjectProperty("Name", entity.getName().get(0) + " (" + entity.getFormalNames().get(0) + ")"));
    } else if (entity.getName() != null && entity.getName().size() > 0) {
        String displayName = entity.getName().get(0);
        if (entity.getxRef() != null && entity.getxRef().size() > 0) {
            displayName = displayName + " (double-click lookup)";
        }
        // entity::name
        propertyList.add(new BioPaxObjectProperty("Name", displayName));
    }
    // entity::Link
    for (RelationshipObject rObject : bioModel.getRelationshipModel().getRelationshipObjects(bioPaxObject)) {
        BioModelEntityObject beObject = rObject.getBioModelEntityObject();
        propertyList.add(new BioPaxObjectProperty("Linked physiology object", beObject.getName(), beObject));
    }
    if (entity instanceof PhysicalEntity) {
        // ------------------------ PHYSICAL ENTITY -----------------------
        PhysicalEntity physicalEntity = (PhysicalEntity) entity;
        // physicalEntity::feature (***ignored***)
        // physicalEntity::memberPhysicalEntity (***ignored***)
        // physicalEntity::notFeature (***ignored***)
        // TODO:  extract the kinetic law, then the SBEntities, then the measurables, units, aso
        boolean isReactionParticipant = BioPAXUtil.isReactionParticipant(physicalEntity, bioModel.getPathwayModel());
        String role = "";
        if (BioPAXUtil.isController(physicalEntity, bioModel.getPathwayModel())) {
            role += "Controller";
            if (isReactionParticipant) {
                role += ", Participant";
            }
        } else if (isReactionParticipant) {
            role += "Participant";
        }
        if (!role.isEmpty()) {
            propertyList.add(new BioPaxObjectProperty("Role(s)", role));
        }
        if (!(physicalEntity instanceof SmallMolecule)) {
            // physicalEntity::cellular location
            CellularLocationVocabulary cellularLocation = physicalEntity.getCellularLocation();
            if (cellularLocation != null && cellularLocation.getTerm() != null && cellularLocation.getTerm().size() > 0) {
                propertyList.add(new BioPaxObjectProperty("Cellular Location", cellularLocation.getTerm().get(0), cellularLocation));
            } else if (entity.getName() != null && entity.getName().size() > 1) {
                String location = entity.getName().get(1);
                if (location.contains("[") && location.contains("]")) {
                    location = location.substring(location.indexOf("[") + 1, location.indexOf("]"));
                    propertyList.add(new BioPaxObjectProperty("Cellular Location", location));
                }
            }
        }
        if (physicalEntity instanceof Complex) {
            Complex complex = (Complex) physicalEntity;
            // complex::components
            for (PhysicalEntity pe : complex.getComponents()) {
                propertyList.add(new BioPaxObjectProperty("Component", getEntityName(pe), pe));
            }
        } else if (physicalEntity instanceof Protein) {
        // Protein protein = (Protein)entity;
        // protein::entity reference (***ignored***)
        } else if (physicalEntity instanceof SmallMolecule) {
            SmallMolecule sm = (SmallMolecule) physicalEntity;
            EntityReference er = sm.getEntityReference();
            if (er != null && !er.getName().isEmpty() && er.getName().get(0) != null && !er.getName().get(0).isEmpty()) {
                propertyList.add(new BioPaxObjectProperty("Entity Reference", er.getName().get(0)));
                ArrayList<Xref> xrefList = er.getxRef();
                for (Xref xref : xrefList) {
                    propertyList.add(new BioPaxObjectProperty("   Xref", xref.getDb() + ":" + xref.getId(), xref));
                }
            }
        } else if (physicalEntity instanceof Dna) {
        // dna::entityReference (***ignored***)
        } else if (physicalEntity instanceof DnaRegion) {
        // dnaRegion::entityReference (***ignored***)
        } else if (physicalEntity instanceof Rna) {
        // rna::entityReference (***ignored***)
        } else if (physicalEntity instanceof RnaRegion) {
        // rnaRegion::entityReference (***ignored***)
        }
    } else if (entity instanceof Interaction) {
        // --------------------------- INTERACTION -------------------
        Interaction interaction = (Interaction) entity;
        // interaction::interactionType
        for (InteractionVocabulary interactionVocabulary : interaction.getInteractionTypes()) {
            if (interactionVocabulary.getTerm().size() > 0) {
                propertyList.add(new BioPaxObjectProperty("Interaction Type", interactionVocabulary.getTerm().get(0), interactionVocabulary));
            }
        }
        // interaction::participants
        for (InteractionParticipant interactionParticipant : interaction.getParticipants()) {
            PhysicalEntity physicalEntity = interactionParticipant.getPhysicalEntity();
            String physicalEntityName = physicalEntity.getName().size() > 0 ? physicalEntity.getName().get(0) : physicalEntity.getIDShort();
            String cellularLocation = "";
            if (physicalEntity.getCellularLocation() != null) {
                cellularLocation = physicalEntity.getCellularLocation().getTerm().size() > 0 ? " [" + physicalEntity.getCellularLocation().getTerm().get(0) + "]" : "";
            }
            propertyList.add(new BioPaxObjectProperty(interactionParticipant.getLevel3PropertyName(), physicalEntityName + cellularLocation, physicalEntity));
        }
        // get the controllers for interactions
        // we always need this because there's no guarantee we'll have kinetic laws
        // for instance pathway commons doesn't have quantitative information
        Set<String> controllersNames = getControllersNames(interaction);
        if (controllersNames.size() > 0) {
            for (String str : controllersNames) {
                // String tooltip = "<html>how many of these 12 M <br>average size  1.12345*E12 nm <br>temperature 37 degrees Celsius</html>";
                String tooltip = "";
                propertyList.add(new BioPaxObjectProperty("Controlled by", str, interaction, tooltip));
            }
        }
        // get the kinetic laws (if any)
        Set<Control> controls = BioPAXUtil.getControlsOfInteraction(interaction, bioModel.getPathwayModel());
        for (Control control : controls) {
            ArrayList<SBEntity> sbEntities = control.getSBSubEntity();
            for (SBEntity sbE : sbEntities) {
                // the only SBSubEntities allowed in a control are kinetic laws
                if (sbE.getID().contains("kineticLaw")) {
                    String str = new String();
                    if (control.getPhysicalControllers() != null) {
                        str += " for Controller(s): ";
                        for (PhysicalEntity ep : control.getPhysicalControllers()) {
                            if (ep.getName().size() > 0) {
                                str += ep.getName().get(0);
                            } else {
                                str += ep.getIDShort();
                            }
                            str += " ";
                        }
                    }
                    String sDetails = "";
                    ArrayList<SBVocabulary> sbTerms = sbE.getSBTerm();
                    for (SBVocabulary sbv : sbTerms) {
                        // type of kinetic law
                        String str1 = sbv.getID();
                        str1 = str1.substring(str1.lastIndexOf('#') + 1);
                        System.out.println(str1);
                        SBOTerm sboT = SBOListEx.sboMap.get(str1);
                        sDetails += "<font color=\"#660000\"><b>" + sboT.getName() + "</b></font>" + "  " + "<font color=\"#006600\">" + sboT.getDescription() + "</font>";
                        sDetails += "<br>";
                    }
                    ArrayList<SBEntity> klProperties = sbE.getSBSubEntity();
                    for (SBEntity klProperty : klProperties) {
                        if (klProperty instanceof SBMeasurable) {
                            SBMeasurable m = (SBMeasurable) klProperty;
                            String str1 = "";
                            String str2 = "";
                            String str3 = "";
                            if (m.hasTerm()) {
                                str1 += m.extractSBOTermAsString();
                            }
                            if (m.hasNumber()) {
                                str2 += m.getNumber().get(0);
                            }
                            if (m.hasUnit()) {
                                str3 += m.extractSBOUnitAsString();
                            }
                            // str1 is an SBO id, for example "SBO:0000064"
                            SBOTerm sboT = SBOListEx.sboMap.get(str1);
                            sDetails += sboT.getSymbol() + "   (" + sboT.getName() + ")" + "<font color=\"#660000\"><b>" + str2 + str3 + "</b></font>" + "  " + "<font color=\"#006600\">" + sboT.getDescription() + "</font>";
                        } else {
                            sDetails = klProperty.getIDShort() + "  " + klProperty.getTypeLabel();
                        }
                        sDetails += "<br>";
                    }
                    // String tooltip = "<html>how many of these 12 M <br>average size  1.12345*E12 nm <br>temperature 37 degrees Celsius</html>";
                    String tooltip = "";
                    BioPaxObjectProperty bpop = new BioPaxObjectProperty("Kinetic Law" + str, sbE.getID(), sbE, tooltip);
                    bpop.setDetails(sDetails);
                    propertyList.add(bpop);
                }
            }
        }
        if (interaction instanceof Control) {
            // TODO: is this ever being called?
            Control c = (Control) interaction;
            // catalysis::controlled
            Interaction controlledInteraction = c.getControlledInteraction();
            if (controlledInteraction != null) {
                String controlledName = controlledInteraction.getIDShort();
                if (controlledInteraction.getName().size() > 0) {
                    controlledName = controlledInteraction.getName().get(0);
                }
                propertyList.add(new BioPaxObjectProperty("Controlled Interaction", controlledName, controlledInteraction));
            }
        }
    } else if (entity instanceof GroupObject) {
        // ---------------------- GROUP OBJECT ------------------
        GroupObject groupObject = (GroupObject) entity;
        for (BioPaxObject bpo : groupObject.getGroupedObjects()) {
            propertyList.add(new BioPaxObjectProperty("Element::" + bpo.getTypeLabel(), getEntityName((Entity) bpo), bpo));
        }
    }
    // entity::comments
    for (String comment : entity.getComments()) {
        propertyList.add(new BioPaxObjectProperty("Comment", comment));
    }
    // entity::xRef
    ArrayList<Xref> xrefList = ((Entity) bioPaxObject).getxRef();
    for (Xref xref : xrefList) {
        if (xref instanceof UnificationXref) {
            propertyList.add(new BioPaxObjectProperty("Xref", xref.getDb() + ":" + xref.getId(), xref));
        }
    }
    for (Xref xref : xrefList) {
        if (xref instanceof RelationshipXref) {
            propertyList.add(new BioPaxObjectProperty("Xref (related)", xref.getDb() + ":" + xref.getId(), xref));
        }
    }
    for (Xref xref : xrefList) {
        if (xref instanceof PublicationXref) {
            propertyList.add(new BioPaxObjectProperty("Publication", xref.getDb() + ":" + xref.getId(), xref));
        }
    }
    // for(SBVocabulary sbVocab : sbEntity.getSBTerm()) {
    // propertyList.add(new BioPaxObjectProperty("SBO Term", SBPAXLabelUtil.makeLabel(sbVocab)));
    // }
    // if(sbEntity instanceof Interaction) {
    // // TODO: this goes away
    // Interaction interaction = (Interaction) sbEntity;
    // Set<SBEntity> subEntities = new HashSet<SBEntity>();
    // subEntities.add(interaction);
    // Set<Control> controls = BioPAXUtil.findAllControls(interaction, bioModel.getPathwayModel());
    // subEntities.addAll(controls);
    // subEntities = SBPAX3Util.extractAllEntities(subEntities);
    // for(SBEntity subEntity : subEntities) {
    // if(subEntity instanceof SBMeasurable) {
    // propertyList.add(new BioPaxObjectProperty("Measured quantity", SBPAXLabelUtil.makeLabel(subEntity)));
    // }
    // }
    // }
    tableModel.setData(propertyList);
}
Also used : SBVocabulary(org.vcell.pathway.sbpax.SBVocabulary) SBEntity(org.vcell.pathway.sbpax.SBEntity) PhysicalEntity(org.vcell.pathway.PhysicalEntity) Entity(org.vcell.pathway.Entity) Set(java.util.Set) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Rna(org.vcell.pathway.Rna) PublicationXref(org.vcell.pathway.PublicationXref) InteractionVocabulary(org.vcell.pathway.InteractionVocabulary) BioPaxObject(org.vcell.pathway.BioPaxObject) ArrayList(java.util.ArrayList) CellularLocationVocabulary(org.vcell.pathway.CellularLocationVocabulary) SBEntity(org.vcell.pathway.sbpax.SBEntity) RelationshipObject(org.vcell.relationship.RelationshipObject) Complex(org.vcell.pathway.Complex) RnaRegion(org.vcell.pathway.RnaRegion) SBMeasurable(org.vcell.pathway.sbpax.SBMeasurable) Xref(org.vcell.pathway.Xref) UnificationXref(org.vcell.pathway.UnificationXref) RelationshipXref(org.vcell.pathway.RelationshipXref) PublicationXref(org.vcell.pathway.PublicationXref) Control(org.vcell.pathway.Control) DnaRegion(org.vcell.pathway.DnaRegion) EntityReference(org.vcell.pathway.EntityReference) Interaction(org.vcell.pathway.Interaction) UnificationXref(org.vcell.pathway.UnificationXref) GroupObject(org.vcell.pathway.GroupObject) SBOTerm(org.vcell.pathway.sbo.SBOTerm) BioModelEntityObject(cbit.vcell.model.BioModelEntityObject) Protein(org.vcell.pathway.Protein) RelationshipXref(org.vcell.pathway.RelationshipXref) PhysicalEntity(org.vcell.pathway.PhysicalEntity) SmallMolecule(org.vcell.pathway.SmallMolecule) Dna(org.vcell.pathway.Dna) InteractionParticipant(org.vcell.pathway.InteractionParticipant)

Example 5 with Entity

use of org.vcell.pathway.Entity in project vcell by virtualcell.

the class ReactionRuleKineticsPropertiesPanel method listLinkedPathwayObjects.

private String listLinkedPathwayObjects() {
    if (reactionRule == null) {
        return "no selected rule";
    }
    if (bioModel == null || bioModel.getModel() == null) {
        return "no biomodel";
    }
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    String linkedPOlist = "";
    for (RelationshipObject relObject : bioModel.getRelationshipModel().getRelationshipObjects(reactionRule)) {
        if (relObject == null) {
            continue;
        }
        final BioPaxObject bpObject = relObject.getBioPaxObject();
        if (bpObject == null) {
            continue;
        }
        if (bpObject instanceof Entity) {
            String name = new String();
            if (((Entity) bpObject).getName().isEmpty()) {
                name = ((Entity) bpObject).getID();
            } else {
                name = ((Entity) bpObject).getName().get(0);
            }
            if (name.contains("#")) {
                name = name.substring(name.indexOf("#") + 1);
            }
            JLabel label = new JLabel("<html><u>" + name + "</u></html>");
            label.setForeground(Color.blue);
            label.addMouseListener(new MouseAdapter() {

                public void mouseClicked(MouseEvent e) {
                    if (e.getClickCount() == 2) {
                        selectionManager.followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.PATHWAY_DIAGRAM_NODE, ActiveViewID.pathway_diagram), new Object[] { bpObject });
                    }
                }
            });
            panel.add(label);
        }
    }
    Dimension dim = new Dimension(200, 20);
    panel.setMinimumSize(dim);
    panel.setPreferredSize(dim);
    linkedPOScrollPane.setViewportView(panel);
    return linkedPOlist;
}
Also used : JPanel(javax.swing.JPanel) Entity(org.vcell.pathway.Entity) MouseEvent(java.awt.event.MouseEvent) BioPaxObject(org.vcell.pathway.BioPaxObject) BoxLayout(javax.swing.BoxLayout) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) BioPaxObject(org.vcell.pathway.BioPaxObject) RelationshipObject(org.vcell.relationship.RelationshipObject) Dimension(java.awt.Dimension) ActiveView(cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView) RelationshipObject(org.vcell.relationship.RelationshipObject)

Aggregations

Entity (org.vcell.pathway.Entity)15 RelationshipObject (org.vcell.relationship.RelationshipObject)12 BioPaxObject (org.vcell.pathway.BioPaxObject)8 PhysicalEntity (org.vcell.pathway.PhysicalEntity)7 ArrayList (java.util.ArrayList)6 ActiveView (cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView)5 MouseAdapter (java.awt.event.MouseAdapter)5 MouseEvent (java.awt.event.MouseEvent)5 Dimension (java.awt.Dimension)4 BoxLayout (javax.swing.BoxLayout)4 JLabel (javax.swing.JLabel)4 JPanel (javax.swing.JPanel)4 GroupObject (org.vcell.pathway.GroupObject)4 PublicationXref (org.vcell.pathway.PublicationXref)4 RelationshipXref (org.vcell.pathway.RelationshipXref)4 Xref (org.vcell.pathway.Xref)4 SBEntity (org.vcell.pathway.sbpax.SBEntity)4 BioModelEntityObject (cbit.vcell.model.BioModelEntityObject)3 MolecularType (org.vcell.model.rbm.MolecularType)3 UnificationXref (org.vcell.pathway.UnificationXref)3