Search in sources :

Example 16 with BioPaxObject

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

the class BioModel method getVCID.

public VCID getVCID(Identifiable identifiable) {
    String localName;
    String className;
    if (identifiable instanceof SpeciesContext) {
        localName = ((SpeciesContext) identifiable).getName();
        className = "SpeciesContext";
    } else if (identifiable instanceof Species) {
        localName = ((Species) identifiable).getCommonName();
        className = VCID.CLASS_SPECIES;
    } else if (identifiable instanceof Structure) {
        localName = ((Structure) identifiable).getName();
        className = "Structure";
    } else if (identifiable instanceof ReactionStep) {
        localName = ((ReactionStep) identifiable).getName();
        className = VCID.CLASS_REACTION_STEP;
    } else if (identifiable instanceof BioModel) {
        localName = ((BioModel) identifiable).getName();
        className = VCID.CLASS_BIOMODEL;
    // }else if (identifiable instanceof SimulationContext){
    // localName = ((SimulationContext)identifiable).getName();
    // className = "Application";
    } else if (identifiable instanceof BioPaxObject) {
        localName = ((BioPaxObject) identifiable).getID();
        className = "BioPaxObject";
    } else if (identifiable instanceof MolecularType) {
        localName = ((MolecularType) identifiable).getName();
        className = "MolecularType";
    } else if (identifiable instanceof ReactionRule) {
        localName = ((ReactionRule) identifiable).getName();
        className = "ReactionRule";
    } else if (identifiable instanceof RbmObservable) {
        localName = ((RbmObservable) identifiable).getName();
        className = "RbmObservable";
    } else {
        throw new RuntimeException("unsupported Identifiable class");
    }
    localName = TokenMangler.mangleVCId(localName);
    VCID vcid;
    try {
        vcid = VCID.fromString(className + "(" + localName + ")");
    } catch (VCID.InvalidVCIDException e) {
        e.printStackTrace();
        throw new RuntimeException(e.getMessage());
    }
    return vcid;
}
Also used : VCID(cbit.vcell.biomodel.meta.VCID) ReactionRule(cbit.vcell.model.ReactionRule) BioPaxObject(org.vcell.pathway.BioPaxObject) RbmObservable(cbit.vcell.model.RbmObservable) SpeciesContext(cbit.vcell.model.SpeciesContext) MolecularType(org.vcell.model.rbm.MolecularType) ReactionStep(cbit.vcell.model.ReactionStep) Structure(cbit.vcell.model.Structure) Species(cbit.vcell.model.Species)

Example 17 with BioPaxObject

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

the class PathwayGraphModel method removeEdgeShape.

private void removeEdgeShape(EdgeShape shape) {
    PhysicalEntity physicalEntity = null;
    if (shape instanceof BioPaxInteractionParticipantShape) {
        BioPaxInteractionParticipantShape edgeShape = (BioPaxInteractionParticipantShape) shape;
        physicalEntity = ((InteractionParticipant) edgeShape.getModelObject()).getPhysicalEntity();
    } else if (shape instanceof BioPaxGroupNeighborShape) {
        BioPaxGroupNeighborShape edgeShape = (BioPaxGroupNeighborShape) shape;
        BioPaxObject bpObject = ((GroupNeighbor) edgeShape.getModelObject()).getNeighbor();
        if (bpObject instanceof PhysicalEntity) {
            physicalEntity = (PhysicalEntity) bpObject;
        }
    }
    if (physicalEntity == null)
        return;
    if (!pathwayModel.getDisplayableBioPaxObjectList().contains(physicalEntity)) {
        removeShape(shape);
    }
}
Also used : PhysicalEntity(org.vcell.pathway.PhysicalEntity) BioPaxObject(org.vcell.pathway.BioPaxObject)

Example 18 with BioPaxObject

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

the class PathwayGraphModel method refreshInteraction.

private void refreshInteraction(Interaction interaction) {
    BioPaxInteractionShape interactionShape = (BioPaxInteractionShape) getShapeFromModelObject(interaction);
    BioPaxObject ancestorObject = pathwayModel.findTopLevelGroupAncestor(interaction);
    if (ancestorObject == interaction) {
        // conversion was not grouped
        for (InteractionParticipant participant : interaction.getParticipants()) {
            refreshParticipant(interactionShape, participant);
        }
    } else {
        if (ancestorObject instanceof GroupObject) {
            // conversion has been grouped
            GroupObject groupObject = (GroupObject) ancestorObject;
            for (InteractionParticipant participant : interaction.getParticipants()) {
                refreshGroupInteraction(groupObject, participant);
            }
        }
    }
}
Also used : BioPaxObject(org.vcell.pathway.BioPaxObject) InteractionParticipant(org.vcell.pathway.InteractionParticipant) GroupObject(org.vcell.pathway.GroupObject)

Example 19 with BioPaxObject

use of org.vcell.pathway.BioPaxObject 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)

Example 20 with BioPaxObject

use of org.vcell.pathway.BioPaxObject 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)

Aggregations

BioPaxObject (org.vcell.pathway.BioPaxObject)53 GroupObject (org.vcell.pathway.GroupObject)21 ArrayList (java.util.ArrayList)15 HashSet (java.util.HashSet)14 PhysicalEntity (org.vcell.pathway.PhysicalEntity)14 RelationshipObject (org.vcell.relationship.RelationshipObject)14 ActiveView (cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView)9 Conversion (org.vcell.pathway.Conversion)9 BioModelEntityObject (cbit.vcell.model.BioModelEntityObject)8 SpeciesContext (cbit.vcell.model.SpeciesContext)7 Entity (org.vcell.pathway.Entity)7 Complex (org.vcell.pathway.Complex)6 Control (org.vcell.pathway.Control)6 InteractionParticipant (org.vcell.pathway.InteractionParticipant)6 Dimension (java.awt.Dimension)5 MouseAdapter (java.awt.event.MouseAdapter)5 MouseEvent (java.awt.event.MouseEvent)5 JLabel (javax.swing.JLabel)5 JPanel (javax.swing.JPanel)5 MolecularType (org.vcell.model.rbm.MolecularType)5