Search in sources :

Example 6 with Protein

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

the class PathwayGraphModel method refreshAll.

@Override
public void refreshAll() {
    if (pathwayModel == null) {
        clearAllShapes();
        fireGraphChanged();
        return;
    }
    unwantedShapes = new HashSet<Shape>();
    unwantedShapes.addAll(getShapes());
    pathwayContainerShape = (PathwayContainerShape) getShapeFromModelObject(pathwayModel);
    if (pathwayContainerShape == null) {
        pathwayContainerShape = new PathwayContainerShape(this, pathwayModel);
        pathwayContainerShape.getSpaceManager().setSize(400, 300);
        addShape(pathwayContainerShape);
    }
    unwantedShapes.remove(pathwayContainerShape);
    Set<BioPaxObject> bioPaxObjects = new HashSet<BioPaxObject>(pathwayModel.getDisplayableBioPaxObjectList());
    for (BioPaxObject bpObject : bioPaxObjects) {
        BioPaxShape bpObjectShape = (BioPaxShape) getShapeFromModelObject(bpObject);
        if (bpObjectShape == null) {
            if (bpObject instanceof Conversion) {
                bpObjectShape = new BioPaxConversionShape((Conversion) bpObject, this);
            } else if (bpObject instanceof MolecularInteraction) {
                bpObjectShape = new BioPaxMolecularInteractionShape((MolecularInteraction) bpObject, this);
            } else if (bpObject instanceof Protein) {
                bpObjectShape = new BioPaxProteinShape((Protein) bpObject, this);
            } else if (bpObject instanceof Complex) {
                bpObjectShape = new BioPaxComplexShape((Complex) bpObject, this);
            } else if (bpObject instanceof SmallMolecule) {
                bpObjectShape = new BioPaxSmallMoleculeShape((SmallMolecule) bpObject, this);
            } else if (bpObject instanceof Dna) {
                bpObjectShape = new BioPaxDnaShape((Dna) bpObject, this);
            } else if (bpObject instanceof Rna) {
                bpObjectShape = new BioPaxRnaShape((Rna) bpObject, this);
            } else if (bpObject instanceof PhysicalEntity) {
                bpObjectShape = new BioPaxPhysicalEntityShape((PhysicalEntity) bpObject, this);
            } else if (bpObject instanceof GroupObject) {
                bpObjectShape = new BioPaxGroupShape((GroupObject) bpObject, this);
            } else {
                bpObjectShape = new BioPaxObjectShape(bpObject, this);
            }
            if (!(bpObject instanceof Control)) {
                // the Control objects will not be displayed on the diagram
                pathwayContainerShape.addChildShape(bpObjectShape);
                addShape(bpObjectShape);
            }
            Dimension shapeSize = bpObjectShape.getSpaceManager().getSize();
            Rectangle boundary = getContainerLayout().getBoundaryForAutomaticLayout(pathwayContainerShape);
            int xPos = boundary.x + random.nextInt(boundary.width - shapeSize.width);
            int yPos = boundary.y + random.nextInt(boundary.height - shapeSize.height);
            bpObjectShape.setAbsPos(xPos, yPos);
        }
        unwantedShapes.remove(bpObjectShape);
    }
    for (BioPaxObject bpObject : bioPaxObjects) {
        if (bpObject instanceof Conversion) {
            refreshInteraction((Conversion) bpObject);
        } else if (bpObject instanceof MolecularInteraction) {
            refreshInteraction((MolecularInteraction) bpObject);
        } else if (bpObject instanceof Control) {
            refreshControl((Control) bpObject);
        } else if (bpObject instanceof GroupObject) {
            refreshGroupObject((GroupObject) bpObject);
        }
    }
    for (Shape unwantedShape : unwantedShapes) {
        removeShape(unwantedShape);
    }
    refreshRelationshipInfo();
    fireGraphChanged();
}
Also used : EdgeShape(cbit.gui.graph.EdgeShape) Shape(cbit.gui.graph.Shape) Rna(org.vcell.pathway.Rna) BioPaxObject(org.vcell.pathway.BioPaxObject) Rectangle(java.awt.Rectangle) Complex(org.vcell.pathway.Complex) Control(org.vcell.pathway.Control) MolecularInteraction(org.vcell.pathway.MolecularInteraction) HashSet(java.util.HashSet) GroupObject(org.vcell.pathway.GroupObject) Dimension(java.awt.Dimension) Conversion(org.vcell.pathway.Conversion) Protein(org.vcell.pathway.Protein) PhysicalEntity(org.vcell.pathway.PhysicalEntity) SmallMolecule(org.vcell.pathway.SmallMolecule) Dna(org.vcell.pathway.Dna)

Example 7 with Protein

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

the class BioModelEditorPathwayDiagramPanel method collapseBioPaxObject.

private void collapseBioPaxObject() {
    HashSet<BioPaxObject> selected = new HashSet<BioPaxObject>(getSelectedBioPaxObjects());
    if (selected.size() == 0)
        return;
    if (bioModel == null || bioModel.getPathwayModel() == null)
        return;
    PathwayGrouping pathwayGrouping = new PathwayGrouping();
    GroupObject groupObject = null;
    HashSet<BioPaxObject> hiddenobjects = new HashSet<BioPaxObject>();
    for (BioPaxObject bpObject : selected) {
        hiddenobjects.clear();
        if (bpObject instanceof Complex || bpObject instanceof Protein || bpObject instanceof SmallMolecule) {
            // collapse complex with physicalEntities
            groupObject = collapse2Complex(bpObject);
        } else if (bpObject instanceof Interaction) {
            for (InteractionParticipant itp : ((Interaction) bpObject).getParticipants()) {
                hiddenobjects.add(itp.getPhysicalEntity());
            }
            hiddenobjects.add(bpObject);
            String id = pathwayGrouping.groupIdGenerator(bioModel.getPathwayModel());
            groupObject = pathwayGrouping.createGroupObject(bioModel.getPathwayModel(), ((Entity) bpObject).getName(), id, hiddenobjects, GroupObject.Type.GROUPEDINTERACTION);
        }
    }
    if (groupObject != null) {
        bioModel.getPathwayModel().add(groupObject);
        bioModel.getPathwayModel().refreshGroupMap();
        // set the grouped object to be selected
        graphCartoonTool.getGraphModel().setSelectedObjects(new GroupObject[] { groupObject });
        pathwayGraphModel.refreshAll();
    }
}
Also used : PathwayGrouping(org.vcell.pathway.group.PathwayGrouping) SmallMolecule(org.vcell.pathway.SmallMolecule) BioPaxObject(org.vcell.pathway.BioPaxObject) Interaction(org.vcell.pathway.Interaction) InteractionParticipant(org.vcell.pathway.InteractionParticipant) GroupObject(org.vcell.pathway.GroupObject) Protein(org.vcell.pathway.Protein) HashSet(java.util.HashSet) Complex(org.vcell.pathway.Complex)

Example 8 with Protein

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

the class PathwayProducerBiopax3 method addContentProtein.

// entityReference 	EntityReference 	single
private Element addContentProtein(BioPaxObject bpObject, Element element) {
    element = addContentPhysicalEntity(bpObject, element);
    Protein ob = (Protein) bpObject;
    Element tmpElement = null;
    if (ob.getEntityReference() != null) {
        tmpElement = new Element("entityReference", bp);
        addIDToProperty(tmpElement, ob.getEntityReference());
        mustPrintObject(ob.getEntityReference());
        element.addContent(tmpElement);
    }
    return element;
}
Also used : Element(org.jdom.Element) Protein(org.vcell.pathway.Protein)

Example 9 with Protein

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

the class PathwayReader method addObjectProtein.

private Protein addObjectProtein(Element element) {
    Protein protein = new Protein();
    addAttributes(protein, element);
    for (Object child : element.getChildren()) {
        if (child instanceof Element) {
            Element childElement = (Element) child;
            if (!addContentProtein(protein, element, childElement)) {
                showUnexpected(childElement, protein);
            }
        }
    }
    pathwayModel.add(protein);
    return protein;
}
Also used : Element(org.jdom.Element) BioPaxObject(org.vcell.pathway.BioPaxObject) Protein(org.vcell.pathway.Protein)

Aggregations

Protein (org.vcell.pathway.Protein)9 BioPaxObject (org.vcell.pathway.BioPaxObject)8 GroupObject (org.vcell.pathway.GroupObject)7 Complex (org.vcell.pathway.Complex)6 SmallMolecule (org.vcell.pathway.SmallMolecule)6 Element (org.jdom.Element)5 HashSet (java.util.HashSet)4 Dna (org.vcell.pathway.Dna)4 PhysicalEntity (org.vcell.pathway.PhysicalEntity)4 Rna (org.vcell.pathway.Rna)4 DnaRegion (org.vcell.pathway.DnaRegion)3 Interaction (org.vcell.pathway.Interaction)3 RnaRegion (org.vcell.pathway.RnaRegion)3 ArrayList (java.util.ArrayList)2 Set (java.util.Set)2 Control (org.vcell.pathway.Control)2 Entity (org.vcell.pathway.Entity)2 InteractionParticipant (org.vcell.pathway.InteractionParticipant)2 MolecularInteraction (org.vcell.pathway.MolecularInteraction)2 PathwayGrouping (org.vcell.pathway.group.PathwayGrouping)2