Search in sources :

Example 6 with SBEntity

use of org.vcell.pathway.sbpax.SBEntity in project vcell by virtualcell.

the class PathwayTableModel method hasMeasuredData.

private boolean hasMeasuredData(Interaction interaction) {
    Set<SBEntity> subEntities = new HashSet<SBEntity>();
    subEntities.add(interaction);
    Set<Control> controls = BioPAXUtil.findAllControls(interaction, pathwayModel);
    subEntities.addAll(controls);
    subEntities = SBPAX3Util.extractAllEntities(subEntities);
    for (SBEntity subEntity : subEntities) {
        if (subEntity instanceof SBMeasurable) {
            return true;
        }
    }
    return false;
}
Also used : Control(org.vcell.pathway.Control) SBEntity(org.vcell.pathway.sbpax.SBEntity) HashSet(java.util.HashSet) SBMeasurable(org.vcell.pathway.sbpax.SBMeasurable)

Example 7 with SBEntity

use of org.vcell.pathway.sbpax.SBEntity in project vcell by virtualcell.

the class BioModelEditorSabioPanel method computeSelectedKineticLaw.

public SBEntity computeSelectedKineticLaw() {
    Object object = responseTree.getLastSelectedPathComponent();
    if (object == null || !(object instanceof BioModelNode)) {
        return null;
    }
    Object userObject = ((BioModelNode) object).getUserObject();
    if (userObject instanceof SBEntity) {
        return (SBEntity) userObject;
    }
    return null;
}
Also used : PathwayStringObject(cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayStringObject) BioModelNode(cbit.vcell.desktop.BioModelNode) SBEntity(org.vcell.pathway.sbpax.SBEntity)

Example 8 with SBEntity

use of org.vcell.pathway.sbpax.SBEntity in project vcell by virtualcell.

the class BioPaxObjectPropertiesPanel method initialize.

private void initialize() {
    try {
        table = new ScrollTable();
        tableModel = new BioPaxObjectPropertiesTableModel(table);
        table.setModel(tableModel);
        details = new JTextPane();
        details.setContentType("text/html");
        details.setEditable(false);
        JScrollPane scrl = new JScrollPane(details);
        table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

            @Override
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    BioPaxObjectProperty property = tableModel.getValueAt(table.getSelectedRow());
                    if (property != null) {
                        final String htmlStart = "<html><font face = \"Arial\"><font size =\"-2\">";
                        final String htmlEnd = "</font></font></html>";
                        if (!property.getDetails().isEmpty()) {
                            details.setText(htmlStart + property.getDetails() + htmlEnd);
                        } else if ((property.value != null) && !property.value.isEmpty()) {
                            String text = FormatDetails(property);
                            details.setText(htmlStart + text + htmlEnd);
                        } else {
                            details.setText(htmlStart + "row: " + table.getSelectedRow() + ", col: " + table.getSelectedColumn() + htmlEnd);
                        }
                    }
                }
            }
        });
        splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, table.getEnclosingScrollPane(), scrl);
        splitPane.setOneTouchExpandable(true);
        splitPane.setDividerLocation(150);
        // provide minimum sizes for the two components in the split pane
        Dimension minimumSize = new Dimension(100, 50);
        table.getEnclosingScrollPane().setMinimumSize(minimumSize);
        scrl.setMinimumSize(minimumSize);
        setLayout(new BorderLayout());
        // add(table.getEnclosingScrollPane(), BorderLayout.CENTER);
        // add(details, BorderLayout.CENTER);
        add(splitPane, BorderLayout.CENTER);
        setBackground(Color.white);
        table.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    // launch the browser when double click on hyperlinks
                    Point pt = e.getPoint();
                    int crow = table.rowAtPoint(pt);
                    int ccol = table.columnAtPoint(pt);
                    if (table.convertColumnIndexToModel(ccol) == BioPaxObjectPropertiesTableModel.Column_Value) {
                        BioPaxObjectProperty property = tableModel.getValueAt(crow);
                        BioPaxObject bioPaxObject = property.bioPaxObject;
                        if (bioPaxObject == null) {
                            BioModelEntityObject bioModelEntityObject = property.bioModelEntityObject;
                            if (bioModelEntityObject != null) {
                                if (bioModelEntityObject instanceof SpeciesContext) {
                                    selectionManager.followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.REACTION_DIAGRAM_NODE, ActiveViewID.reaction_diagram), new Object[] { bioModelEntityObject });
                                } else if (bioModelEntityObject instanceof MolecularType) {
                                    selectionManager.followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE, ActiveViewID.species_definitions), new Object[] { bioModelEntityObject });
                                }
                            } else if (((Entity) BioPaxObjectPropertiesPanel.this.bioPaxObject).getFormalNames() == null || ((Entity) BioPaxObjectPropertiesPanel.this.bioPaxObject).getFormalNames().size() == 0) {
                                lookupFormalName(crow);
                            }
                        } else if (bioPaxObject instanceof Xref) {
                            // if xRef, get url
                            String url = ((Xref) bioPaxObject).getURL();
                            DialogUtils.browserLauncher(BioPaxObjectPropertiesPanel.this, url, "Wrong URL.");
                        } else if (bioPaxObject instanceof SBEntity) {
                            // TODO: kineticLaw
                            SBEntity sbE = (SBEntity) bioPaxObject;
                            if (sbE.getID().contains("kineticLaw")) {
                                // String url = "http://sabio.h-its.org/sabioRestWebServices/kineticLaws/" + sbE.getID().substring(sbE.getID().indexOf("kineticLaw") + 10);
                                String url = "http://sabiork.h-its.org/kindatadirectiframe.jsp?kinlawid=" + sbE.getID().substring(sbE.getID().indexOf("kineticLaw") + 10);
                                DialogUtils.browserLauncher(BioPaxObjectPropertiesPanel.this, url, "Wrong URL.");
                            }
                        }
                    }
                }
            }
        });
        // --- end of addMouseListener()
        table.getColumnModel().getColumn(BioPaxObjectPropertiesTableModel.Column_Value).setCellRenderer(new DefaultScrollTableCellRenderer() {

            @Override
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                if (column == BioPaxObjectPropertiesTableModel.Column_Value) {
                    BioPaxObjectProperty property = tableModel.getValueAt(row);
                    BioPaxObject bpObject = property.bioPaxObject;
                    String text = property.value;
                    // colorize BLUE and add surround text with <html></html> tags
                    if (bpObject == null) {
                        BioModelEntityObject bioModelEntityObject = property.bioModelEntityObject;
                        if (bioModelEntityObject != null) {
                            if (!isSelected) {
                                setForeground(Color.blue);
                            }
                            setText("<html><u>" + text + "</u></html>");
                        }
                    } else {
                        if (bpObject instanceof Xref) {
                            String url = ((Xref) bpObject).getURL();
                            if (url != null) {
                                setToolTipText(url);
                                if (!isSelected) {
                                    setForeground(Color.blue);
                                }
                                setText("<html><u>" + text + "</u></html>");
                            }
                        } else if (bpObject instanceof SBEntity) {
                            String url = ((SBEntity) bpObject).getID();
                            if (url.contains("kineticLaw")) {
                                setToolTipText(url);
                                if (!isSelected) {
                                    setForeground(Color.blue);
                                }
                                if (url.contains("http")) {
                                    setText("<html><u>" + text + "</u></html>");
                                }
                            }
                        }
                    }
                }
                BioPaxObjectProperty property = tableModel.getValueAt(row);
                if (!property.tooltip.isEmpty()) {
                    setToolTipText(property.tooltip);
                }
                return this;
            }
        });
    // --- end of setCellRenderer()
    } catch (java.lang.Throwable ivjExc) {
        handleException(ivjExc);
    }
}
Also used : SBEntity(org.vcell.pathway.sbpax.SBEntity) PhysicalEntity(org.vcell.pathway.PhysicalEntity) Entity(org.vcell.pathway.Entity) ScrollTable(org.vcell.util.gui.ScrollTable) BioPaxObject(org.vcell.pathway.BioPaxObject) ListSelectionEvent(javax.swing.event.ListSelectionEvent) SpeciesContext(cbit.vcell.model.SpeciesContext) ActiveView(cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView) SBEntity(org.vcell.pathway.sbpax.SBEntity) JTextPane(javax.swing.JTextPane) Xref(org.vcell.pathway.Xref) UnificationXref(org.vcell.pathway.UnificationXref) RelationshipXref(org.vcell.pathway.RelationshipXref) PublicationXref(org.vcell.pathway.PublicationXref) BorderLayout(java.awt.BorderLayout) Component(java.awt.Component) JScrollPane(javax.swing.JScrollPane) MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter) Dimension(java.awt.Dimension) Point(java.awt.Point) BioModelEntityObject(cbit.vcell.model.BioModelEntityObject) Point(java.awt.Point) ListSelectionListener(javax.swing.event.ListSelectionListener) MolecularType(org.vcell.model.rbm.MolecularType) JTable(javax.swing.JTable) GroupObject(org.vcell.pathway.GroupObject) BioPaxObject(org.vcell.pathway.BioPaxObject) RelationshipObject(org.vcell.relationship.RelationshipObject) BioModelEntityObject(cbit.vcell.model.BioModelEntityObject) DefaultScrollTableCellRenderer(org.vcell.util.gui.DefaultScrollTableCellRenderer) JSplitPane(javax.swing.JSplitPane)

Example 9 with SBEntity

use of org.vcell.pathway.sbpax.SBEntity in project vcell by virtualcell.

the class SBPAX3Util method extractAllEntities.

public static Set<SBEntity> extractAllEntities(SBEntity entity) {
    Set<SBEntity> entities = new HashSet<SBEntity>();
    entities.add(entity);
    for (SBEntity subEntity : entity.getSBSubEntity()) {
        entities.addAll(extractAllEntities(subEntity));
    }
    return entities;
}
Also used : SBEntity(org.vcell.pathway.sbpax.SBEntity) HashSet(java.util.HashSet)

Example 10 with SBEntity

use of org.vcell.pathway.sbpax.SBEntity in project vcell by virtualcell.

the class PathwayReaderBiopax3 method addObjectSBEntity.

// ---------------- addObject section ---------------------
// 
private SBEntity addObjectSBEntity(Element element) {
    if (element.getChildren().size() == 0) {
        SBEntityProxy proxy = new SBEntityProxy();
        addAttributes(proxy, element);
        pathwayModel.add(proxy);
        return proxy;
    }
    for (Object child : element.getChildren()) {
        if (child instanceof Element) {
            Element childElement = (Element) child;
            if (childElement.getName().equals("SBMeasurable")) {
                SBMeasurable thingie = addObjectSBMeasurable(childElement);
                pathwayModel.add(thingie);
                return thingie;
            } else if (childElement.getName().equals("SBState")) {
                SBState thingie = addObjectSBState(childElement);
                pathwayModel.add(thingie);
                return thingie;
            }
        }
    }
    SBEntity sbSubEntity = new SBEntityImpl();
    if (element.getAttributes().size() > 0) {
        addAttributes(sbSubEntity, element);
    }
    for (Object child : element.getChildren()) {
        if (child instanceof Element) {
            Element childElement = (Element) child;
            if (!addContentSBEntity(sbSubEntity, element, childElement)) {
                showUnexpected(childElement);
            }
        }
    }
    pathwayModel.add(sbSubEntity);
    return sbSubEntity;
}
Also used : SBEntityImpl(org.vcell.pathway.sbpax.SBEntityImpl) Element(org.jdom.Element) GroupObject(org.vcell.pathway.GroupObject) BioPaxObject(org.vcell.pathway.BioPaxObject) SBEntity(org.vcell.pathway.sbpax.SBEntity) SBEntityProxy(org.vcell.pathway.persistence.BiopaxProxy.SBEntityProxy) SBState(org.vcell.pathway.sbpax.SBState) SBMeasurable(org.vcell.pathway.sbpax.SBMeasurable)

Aggregations

SBEntity (org.vcell.pathway.sbpax.SBEntity)11 SBMeasurable (org.vcell.pathway.sbpax.SBMeasurable)5 HashSet (java.util.HashSet)4 ArrayList (java.util.ArrayList)3 Element (org.jdom.Element)3 BioPaxObject (org.vcell.pathway.BioPaxObject)3 Control (org.vcell.pathway.Control)3 Entity (org.vcell.pathway.Entity)3 GroupObject (org.vcell.pathway.GroupObject)3 PhysicalEntity (org.vcell.pathway.PhysicalEntity)3 PublicationXref (org.vcell.pathway.PublicationXref)3 RelationshipXref (org.vcell.pathway.RelationshipXref)3 Xref (org.vcell.pathway.Xref)3 SBOTerm (org.vcell.pathway.sbo.SBOTerm)3 SBVocabulary (org.vcell.pathway.sbpax.SBVocabulary)3 PathwayStringObject (cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayStringObject)2 BioModelEntityObject (cbit.vcell.model.BioModelEntityObject)2 SBOParam (org.vcell.pathway.sbo.SBOParam)2 PathwayData (cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData)1 ActiveView (cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView)1