Search in sources :

Example 6 with Entity

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

the class SpeciesPropertiesPanel method listLinkedPathwayObjects.

// wei's code
private String listLinkedPathwayObjects() {
    if (getSpeciesContext() == null) {
        return "no selected species";
    }
    if (bioModel == null || bioModel.getModel() == null) {
        return "no biomodel";
    }
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    String linkedPOlist = "";
    for (RelationshipObject relObject : bioModel.getRelationshipModel().getRelationshipObjects(getSpeciesContext())) {
        final BioPaxObject bpObject = relObject.getBioPaxObject();
        if (bpObject instanceof Entity) {
            JLabel label = new JLabel("<html><u>" + ((Entity) bpObject).getName().get(0) + "</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);
        }
    }
    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) RelationshipObject(org.vcell.relationship.RelationshipObject) BioPaxObject(org.vcell.pathway.BioPaxObject) ActiveView(cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView) RelationshipObject(org.vcell.relationship.RelationshipObject)

Example 7 with Entity

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

the class BioModelEditorConversionTableModel method createTableRow.

private ConversionTableRow createTableRow(BioPaxObject bpObject, String interactionId, String interactionLabel, String participantType, double stoich, HashSet<RelationshipObject> relationshipObjects) {
    String location = "";
    ConversionTableRow conversionTableRow = new ConversionTableRow(bpObject);
    conversionTableRow.setInteractionId(interactionId);
    conversionTableRow.setInteractionLabel(interactionLabel);
    conversionTableRow.setParticipantType(participantType);
    // stoichiometry and location
    if (participantType.equals("Reactant") || participantType.equals("Product")) {
        // stoichiometry
        if (stoich != 0)
            conversionTableRow.setStoich(stoich);
        else
            conversionTableRow.setStoich(1.0);
        // location
        // if(((PhysicalEntity)bpObject).getCellularLocation() != null && ((PhysicalEntity)bpObject).getCellularLocation().getTerm().size()>0)
        // location = ((PhysicalEntity)bpObject).getCellularLocation().getTerm().get(0);
        // else
        location = bioModel.getModel().getStructures()[0].getName();
        conversionTableRow.setLocation(location);
    } else {
        conversionTableRow.setStoich(1.0);
        // else
        if (bpObject instanceof Transport) {
            if (bioModel.getModel().getMembranes().size() > 0)
                location = bioModel.getModel().getMembranes().get(0).getName();
            else
                location = bioModel.getModel().getStructures()[0].getName();
        } else
            location = bioModel.getModel().getStructures()[0].getName();
        conversionTableRow.setLocation(location);
    }
    // id
    if (relationshipObjects == null) {
        if (bpObject instanceof Entity) {
            String id = (BioPAXUtil.getName((Entity) bpObject) + "_" + location).trim();
            if (isValid(id))
                conversionTableRow.setId(id);
            else
                conversionTableRow.setId(changeID(id));
        }
    } else {
        String id = null;
        for (RelationshipObject relationshipObject : relationshipObjects) {
            if (relationshipObject.getBioModelEntityObject() instanceof MolecularType) {
                id = relationshipObject.getBioModelEntityObject().getName();
                location = "";
            } else if (relationshipObject.getBioModelEntityObject().getStructure().getName().equalsIgnoreCase(location)) {
                id = relationshipObject.getBioModelEntityObject().getName();
            }
        }
        if (id != null) {
            // the linked bmObject with the same location will be used
            conversionTableRow.setId(id);
        } else {
            // a new bmObject will be created if no linked bmObject in the same location
            if (bpObject instanceof Entity) {
                id = (BioPAXUtil.getName((Entity) bpObject) + "_" + location).trim();
                if (isValid(id))
                    conversionTableRow.setId(id);
                else
                    conversionTableRow.setId(changeID(id));
            }
        }
    }
    return conversionTableRow;
}
Also used : MolecularType(org.vcell.model.rbm.MolecularType) Entity(org.vcell.pathway.Entity) PhysicalEntity(org.vcell.pathway.PhysicalEntity) ConversionTableRow(org.vcell.relationship.ConversionTableRow) Transport(org.vcell.pathway.Transport) RelationshipObject(org.vcell.relationship.RelationshipObject)

Example 8 with Entity

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

the class BioPaxShape method refreshLabel.

@Override
public void refreshLabel() {
    String name = "[" + bioPaxObject.getIDShort() + "]";
    if (bioPaxObject instanceof Entity) {
        Entity entity = (Entity) bioPaxObject;
        ArrayList<String> names = entity.getName();
        if (names.size() > 0) {
            name = names.get(0);
        }
    }
    setLabel(name);
    smallLabel = getLabel();
    if (bTruncateLabelName && getLabel().length() > (2 * SCS_LABEL_WIDTHPARM + SCS_LABEL_TRUCATED.length())) {
        smallLabel = getLabel().substring(0, SCS_LABEL_WIDTHPARM) + SCS_LABEL_TRUCATED + getLabel().substring(getLabel().length() - SCS_LABEL_WIDTHPARM);
    }
}
Also used : Entity(org.vcell.pathway.Entity)

Example 9 with Entity

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

the class BioModelEditorReactionTableModel method computeData.

protected ArrayList<ModelProcess> computeData() {
    ArrayList<ModelProcess> processList = new ArrayList<ModelProcess>();
    if (getModel() != null) {
        ModelProcess[] modelProcesses = getModel().getModelProcesses();
        if (searchText == null || searchText.length() == 0) {
            processList.addAll(Arrays.asList(modelProcesses));
        } else {
            String lowerCaseSearchText = searchText.toLowerCase();
            for (ModelProcess process : modelProcesses) {
                boolean bMatchRelationshipObj = false;
                if (process instanceof ReactionStep) {
                    ReactionStep reactionStep = (ReactionStep) process;
                    HashSet<RelationshipObject> relObjsHash = bioModel.getRelationshipModel().getRelationshipObjects(reactionStep);
                    for (RelationshipObject relObj : relObjsHash) {
                        if (relObj.getBioPaxObject() instanceof Entity) {
                            if (((Entity) relObj.getBioPaxObject()).getName().get(0).toLowerCase().contains(lowerCaseSearchText)) {
                                bMatchRelationshipObj = true;
                                break;
                            }
                        }
                    }
                }
                if (bMatchRelationshipObj || process.containsSearchText(lowerCaseSearchText)) {
                    if (!processList.contains(process)) {
                        processList.add(process);
                    }
                }
                if (process instanceof ReactionStep) {
                    // we also search in reaction step expression, for strings like "s1 + s2" or s1 -> s2
                    ModelProcessEquation mpe = new ModelProcessEquation(process, bioModel.getModel());
                    if (mpe.toString().toLowerCase().contains(lowerCaseSearchText)) {
                        if (!processList.contains(process)) {
                            processList.add(process);
                        }
                    }
                }
            }
        }
    }
    return processList;
}
Also used : Entity(org.vcell.pathway.Entity) ReactionStep(cbit.vcell.model.ReactionStep) ArrayList(java.util.ArrayList) ModelProcessEquation(cbit.gui.ModelProcessEquation) ModelProcess(cbit.vcell.model.ModelProcess) RelationshipObject(org.vcell.relationship.RelationshipObject)

Example 10 with Entity

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

the class BioModelEditorSpeciesTableModel method computeData.

protected ArrayList<SpeciesContext> computeData() {
    ArrayList<SpeciesContext> speciesContextList = new ArrayList<SpeciesContext>();
    if (getModel() != null) {
        if (searchText == null || searchText.length() == 0) {
            speciesContextList.addAll(Arrays.asList(getModel().getSpeciesContexts()));
        } else {
            String lowerCaseSearchText = searchText.toLowerCase();
            for (SpeciesContext s : getModel().getSpeciesContexts()) {
                boolean bMatchRelationshipObj = false;
                HashSet<RelationshipObject> relObjsHash = bioModel.getRelationshipModel().getRelationshipObjects(s);
                for (RelationshipObject relObj : relObjsHash) {
                    if (relObj.getBioPaxObject() instanceof Entity) {
                        if (((Entity) relObj.getBioPaxObject()).getName().get(0).toLowerCase().contains(lowerCaseSearchText)) {
                            bMatchRelationshipObj = true;
                            break;
                        }
                    }
                }
                if (bMatchRelationshipObj || s.getName().toLowerCase().contains(lowerCaseSearchText) || s.getStructure().getName().toLowerCase().contains(lowerCaseSearchText)) {
                    speciesContextList.add(s);
                }
            }
        }
    }
    return speciesContextList;
}
Also used : Entity(org.vcell.pathway.Entity) ArrayList(java.util.ArrayList) SpeciesContext(cbit.vcell.model.SpeciesContext) 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