Search in sources :

Example 16 with PhysicalEntity

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

the class PathwayTableModel method refreshData.

private void refreshData() {
    if (pathwayModel == null) {
        setData(null);
        return;
    }
    List<BioPaxObject> allPathwayObjectList = new ArrayList<BioPaxObject>();
    for (BioPaxObject bpObject1 : pathwayModel.getBiopaxObjects()) {
        if (bpObject1 instanceof PhysicalEntity || (bpObject1 instanceof Interaction && !(bpObject1 instanceof Control))) {
            allPathwayObjectList.add(bpObject1);
        }
    }
    ArrayList<BioPaxObject> pathwayObjectList = new ArrayList<BioPaxObject>();
    for (BioPaxObject bpObject : allPathwayObjectList) {
        if (searchText == null || searchText.length() == 0 || getLabel(bpObject).toLowerCase().contains(searchText.toLowerCase()) || getType(bpObject).toLowerCase().contains(searchText.toLowerCase())) {
            pathwayObjectList.add(bpObject);
            bioPaxObjectImportedMap.put(bpObject, bioModel != null && bioModel.getPathwayModel().find(bpObject) != null);
        }
    }
    setData(pathwayObjectList);
}
Also used : Control(org.vcell.pathway.Control) PhysicalEntity(org.vcell.pathway.PhysicalEntity) BioPaxObject(org.vcell.pathway.BioPaxObject) Interaction(org.vcell.pathway.Interaction) ArrayList(java.util.ArrayList)

Example 17 with PhysicalEntity

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

the class PathwayGraphModel method refreshParticipant.

private void refreshParticipant(BioPaxInteractionShape interactionShape, InteractionParticipant participant) {
    BioPaxInteractionParticipantShape edgeShape = (BioPaxInteractionParticipantShape) getShapeFromModelObject(participant);
    PhysicalEntity physicalEntity = participant.getPhysicalEntity();
    BioPaxObject ancestorObject = pathwayModel.findTopLevelGroupAncestor(physicalEntity);
    if (edgeShape == null) {
        Shape shape = getShapeFromModelObject(physicalEntity);
        if (shape instanceof BioPaxPhysicalEntityShape) {
            BioPaxPhysicalEntityShape physicalEntityShape = (BioPaxPhysicalEntityShape) shape;
            edgeShape = new BioPaxInteractionParticipantShape(participant, interactionShape, physicalEntityShape, this);
            pathwayContainerShape.addChildShape(edgeShape);
            addShape(edgeShape);
        }
    } else {
        // edges without end objects will be removed
        if (ancestorObject != physicalEntity) {
            removeEdgeShape(edgeShape);
        }
    }
    unwantedShapes.remove(refreshGroup(pathwayContainerShape, ancestorObject, interactionShape, participant));
    unwantedShapes.remove(edgeShape);
}
Also used : PhysicalEntity(org.vcell.pathway.PhysicalEntity) EdgeShape(cbit.gui.graph.EdgeShape) Shape(cbit.gui.graph.Shape) BioPaxObject(org.vcell.pathway.BioPaxObject)

Example 18 with PhysicalEntity

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

the class PathwayGraphModel method refreshGroupInteraction.

private void refreshGroupInteraction(GroupObject groupObject, InteractionParticipant participant) {
    BioPaxGroupShape groupShape = (BioPaxGroupShape) getShapeFromModelObject(groupObject);
    PhysicalEntity physicalEntity = participant.getPhysicalEntity();
    GroupNeighbor groupNeighbor = new GroupNeighbor(groupObject, physicalEntity, participant.getType());
    BioPaxGroupNeighborShape edgeShape = (BioPaxGroupNeighborShape) getShapeFromModelObject(groupNeighbor);
    BioPaxObject ancestorObject = pathwayModel.findTopLevelGroupAncestor(physicalEntity);
    if (edgeShape == null) {
        Shape shape = getShapeFromModelObject(physicalEntity);
        if (shape instanceof BioPaxPhysicalEntityShape) {
            BioPaxPhysicalEntityShape physicalEntityShape = (BioPaxPhysicalEntityShape) shape;
            edgeShape = new BioPaxGroupNeighborShape(groupNeighbor, groupShape, physicalEntityShape, this);
            pathwayContainerShape.addChildShape(edgeShape);
            addShape(edgeShape);
        }
    } else {
        // edges without end objects will be removed
        if (ancestorObject != physicalEntity) {
            // for grouped objects
            removeEdgeShape(edgeShape);
        }
    }
    unwantedShapes.remove(refreshGroup(pathwayContainerShape, ancestorObject, groupShape, participant));
    unwantedShapes.remove(edgeShape);
}
Also used : PhysicalEntity(org.vcell.pathway.PhysicalEntity) EdgeShape(cbit.gui.graph.EdgeShape) Shape(cbit.gui.graph.Shape) GroupNeighbor(org.vcell.pathway.GroupNeighbor) BioPaxObject(org.vcell.pathway.BioPaxObject)

Example 19 with PhysicalEntity

use of org.vcell.pathway.PhysicalEntity 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 20 with PhysicalEntity

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

the class PathwayProducerBiopax3 method addContentConversion.

// right 						PhysicalEntity 	multiple
// participantStoichiometry 	Stoichiometry 	multiple
// left 						PhysicalEntity 	multiple
// spontaneous 				Boolean 		single
// conversionDirection 		String 			single
private Element addContentConversion(BioPaxObject bpObject, Element element) {
    element = addContentInteraction(bpObject, element);
    Conversion ob = (Conversion) bpObject;
    Element tmpElement = null;
    if (ob.getLeft() != null && ob.getLeft().size() > 0) {
        List<PhysicalEntity> list = ob.getLeft();
        for (PhysicalEntity item : list) {
            tmpElement = new Element("left", bp);
            addIDToProperty(tmpElement, item);
            mustPrintObject(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getRight() != null && ob.getRight().size() > 0) {
        List<PhysicalEntity> list = ob.getRight();
        for (PhysicalEntity item : list) {
            tmpElement = new Element("right", bp);
            addIDToProperty(tmpElement, item);
            mustPrintObject(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getParticipantStoichiometry() != null && ob.getParticipantStoichiometry().size() > 0) {
        List<Stoichiometry> list = ob.getParticipantStoichiometry();
        for (Stoichiometry item : list) {
            tmpElement = new Element("participantStoichiometry", bp);
            addIDToProperty(tmpElement, item);
            mustPrintObject(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getSpontaneous() != null) {
        tmpElement = new Element("spontaneous", bp);
        tmpElement.setAttribute("datatype", schemaBoolean, rdf);
        tmpElement.setText(ob.getSpontaneous().toString());
        element.addContent(tmpElement);
    }
    if (ob.getConversionDirection() != null && ob.getConversionDirection().length() > 0) {
        tmpElement = new Element("conversionDirection", bp);
        tmpElement.setAttribute("datatype", schemaString, rdf);
        tmpElement.setText(ob.getConversionDirection());
        element.addContent(tmpElement);
    }
    return element;
}
Also used : Stoichiometry(org.vcell.pathway.Stoichiometry) PhysicalEntity(org.vcell.pathway.PhysicalEntity) Element(org.jdom.Element) Conversion(org.vcell.pathway.Conversion)

Aggregations

PhysicalEntity (org.vcell.pathway.PhysicalEntity)27 BioPaxObject (org.vcell.pathway.BioPaxObject)15 ArrayList (java.util.ArrayList)10 Conversion (org.vcell.pathway.Conversion)9 Element (org.jdom.Element)8 Complex (org.vcell.pathway.Complex)8 HashSet (java.util.HashSet)7 Control (org.vcell.pathway.Control)7 GroupObject (org.vcell.pathway.GroupObject)6 SmallMolecule (org.vcell.pathway.SmallMolecule)5 MolecularType (org.vcell.model.rbm.MolecularType)4 Protein (org.vcell.pathway.Protein)4 RelationshipObject (org.vcell.relationship.RelationshipObject)4 EdgeShape (cbit.gui.graph.EdgeShape)3 Shape (cbit.gui.graph.Shape)3 SpeciesContext (cbit.vcell.model.SpeciesContext)3 Dna (org.vcell.pathway.Dna)3 Entity (org.vcell.pathway.Entity)3 InteractionParticipant (org.vcell.pathway.InteractionParticipant)3 Rna (org.vcell.pathway.Rna)3