Search in sources :

Example 1 with MolecularInteraction

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

the class PathwayReaderBiopax3 method addContentControl.

private boolean addContentControl(Control control, Element element, Element childElement) {
    if (addContentInteraction(control, element, childElement)) {
        return true;
    }
    /**
     * InteractionImpl controlledInteraction
     * Pathway controlledPathway
     * String controlType
     * ArrayList<Pathway> pathwayControllers
     * ArrayList<PhysicalEntity> physicalControllers
     */
    if (childElement.getName().equals("controller")) {
        // if (resourceAttribute != null){
        if (childElement.getChildren().size() == 0) {
            // if there are no children it must be a resource inside another object
            // we don't know yet whether it's Interaction or Pathway, we make a proxy for each
            // at the time when we solve the references we'll find out which is fake
            PhysicalEntityProxy proxyE = new PhysicalEntityProxy();
            addAttributes(proxyE, childElement);
            pathwayModel.add(proxyE);
            control.addPhysicalController(proxyE);
            PathwayProxy proxyP = new PathwayProxy();
            addAttributes(proxyP, childElement);
            pathwayModel.add(proxyP);
            control.getPathwayControllers().add(proxyP);
            return true;
        } else {
            for (Object child : element.getChildren()) {
                if (child instanceof Element) {
                    if (((Element) child).getName().equals("Pathway")) {
                        Pathway thingie = addObjectPathway((Element) child);
                        control.getPathwayControllers().add(thingie);
                        return true;
                    } else if (((Element) child).getName().equals("Complex")) {
                        Complex thingie = addObjectComplex((Element) child);
                        control.getPhysicalControllers().add(thingie);
                        return true;
                    } else if (((Element) child).getName().equals("Dna")) {
                        Dna thingie = addObjectDna((Element) child);
                        control.getPhysicalControllers().add(thingie);
                        return true;
                    } else if (((Element) child).getName().equals("DnaRegion")) {
                        DnaRegion thingie = addObjectDnaRegion((Element) child);
                        control.getPhysicalControllers().add(thingie);
                        return true;
                    } else if (((Element) child).getName().equals("Rna")) {
                        Rna thingie = addObjectRna((Element) child);
                        control.getPhysicalControllers().add(thingie);
                        return true;
                    } else if (((Element) child).getName().equals("RnaRegion")) {
                        RnaRegion thingie = addObjectRnaRegion((Element) child);
                        control.getPhysicalControllers().add(thingie);
                        return true;
                    } else if (((Element) child).getName().equals("Protein")) {
                        Protein thingie = addObjectProtein((Element) child);
                        control.getPhysicalControllers().add(thingie);
                        return true;
                    } else if (((Element) child).getName().equals("SmallMolecule")) {
                        SmallMolecule thingie = addObjectSmallMolecule((Element) child);
                        control.getPhysicalControllers().add(thingie);
                        return true;
                    } else {
                        return false;
                    }
                }
            }
        }
        return false;
    } else if (childElement.getName().equals("controlled")) {
        if (childElement.getChildren().size() == 0) {
            InteractionProxy proxyI = new InteractionProxy();
            addAttributes(proxyI, childElement);
            pathwayModel.add(proxyI);
            control.setControlledInteraction(proxyI);
            PathwayProxy proxyP = new PathwayProxy();
            addAttributes(proxyP, childElement);
            pathwayModel.add(proxyP);
            control.setControlledPathway(proxyP);
            return true;
        } else {
            for (Object child : childElement.getChildren()) {
                if (child instanceof Element) {
                    if (((Element) child).getName().equals("Pathway")) {
                        Pathway thingie = addObjectPathway((Element) child);
                        control.setControlledPathway(thingie);
                        return true;
                    } else {
                        Interaction thingie = (Interaction) addObjectBioPaxObjectSubclass((Element) child);
                        if (thingie == null) {
                            return false;
                        } else {
                            control.setControlledInteraction(thingie);
                            return true;
                        }
                    }
                // if(((Element)child).getName().equals("Pathway")) {
                // Pathway thingie = addObjectPathway((Element)child);
                // control.setControlledPathway(thingie);
                // return true;
                // } else if(((Element)child).getName().equals("Interaction")) {
                // Interaction thingie = addObjectInteraction((Element)child);
                // control.setControlledInteraction(thingie);
                // return true;
                // } else if(((Element)child).getName().equals("Control")) {
                // Control thingie = addObjectControl((Element)child);
                // control.setControlledInteraction(thingie);
                // return true;
                // } else if(((Element)child).getName().equals("Modulation")) {
                // Modulation thingie = addObjectModulation((Element)child);
                // control.setControlledInteraction(thingie);
                // return true;
                // } else if(((Element)child).getName().equals("Catalysis")) {
                // Catalysis thingie = addObjectCatalysis((Element)child);
                // control.setControlledInteraction(thingie);
                // return true;
                // } else if(((Element)child).getName().equals("TemplateReactionRegulation")) {
                // TemplateReactionRegulation thingie = addObjectTemplateReactionRegulation((Element)child);
                // control.setControlledInteraction(thingie);
                // return true;
                // } else if(((Element)child).getName().equals("Conversion")) {
                // Conversion thingie = addObjectConversion((Element)child);
                // control.setControlledInteraction(thingie);
                // return true;
                // } else if(((Element)child).getName().equals("BiochemicalReaction")) {
                // BiochemicalReaction thingie = addObjectBiochemicalReaction((Element)child);
                // control.setControlledInteraction(thingie);
                // return true;
                // } else if(((Element)child).getName().equals("TransportWithBiochemicalReaction")) {
                // TransportWithBiochemicalReaction thingie = addObjectTransportWithBiochemicalReaction((Element)child);
                // control.setControlledInteraction(thingie);
                // return true;
                // } else if(((Element)child).getName().equals("ComplexAssembly")) {
                // ComplexAssembly thingie = addObjectComplexAssembly((Element)child);
                // control.setControlledInteraction(thingie);
                // return true;
                // } else if(((Element)child).getName().equals("Degradation")) {
                // Degradation thingie = addObjectDegradation((Element)child);
                // control.setControlledInteraction(thingie);
                // return true;
                // } else if(((Element)child).getName().equals("Transport")) {
                // Transport thingie = addObjectTransport((Element)child);
                // control.setControlledInteraction(thingie);
                // return true;
                // } else if(((Element)child).getName().equals("GeneticInteraction")) {
                // GeneticInteraction thingie = addObjectGeneticInteraction((Element)child);
                // control.setControlledInteraction(thingie);
                // return true;
                // } else if(((Element)child).getName().equals("MolecularInteraction")) {
                // MolecularInteraction thingie = addObjectMolecularInteraction((Element)child);
                // control.setControlledInteraction(thingie);
                // return true;
                // } else if(((Element)child).getName().equals("TemplateReaction")) {
                // TemplateReaction thingie = addObjectTemplateReaction((Element)child);
                // control.setControlledInteraction(thingie);
                // return true;
                // } else {
                // return false;
                // }
                }
            }
        }
        return false;
    } else if (childElement.getName().equals("controlType")) {
        control.setControlType(childElement.getTextTrim());
        return true;
    } else {
        return false;
    }
}
Also used : InteractionProxy(org.vcell.pathway.persistence.BiopaxProxy.InteractionProxy) Rna(org.vcell.pathway.Rna) Pathway(org.vcell.pathway.Pathway) Interaction(org.vcell.pathway.Interaction) MolecularInteraction(org.vcell.pathway.MolecularInteraction) GeneticInteraction(org.vcell.pathway.GeneticInteraction) Element(org.jdom.Element) Protein(org.vcell.pathway.Protein) Complex(org.vcell.pathway.Complex) RnaRegion(org.vcell.pathway.RnaRegion) DnaRegion(org.vcell.pathway.DnaRegion) SmallMolecule(org.vcell.pathway.SmallMolecule) Dna(org.vcell.pathway.Dna) GroupObject(org.vcell.pathway.GroupObject) BioPaxObject(org.vcell.pathway.BioPaxObject) PathwayProxy(org.vcell.pathway.persistence.BiopaxProxy.PathwayProxy) PhysicalEntityProxy(org.vcell.pathway.persistence.BiopaxProxy.PhysicalEntityProxy)

Example 2 with MolecularInteraction

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

the class PathwayProducerBiopax3 method addContentMolecularInteraction.

private Element addContentMolecularInteraction(BioPaxObject bpObject, Element element) {
    element = addContentInteraction(bpObject, element);
    MolecularInteraction ob = (MolecularInteraction) bpObject;
    Element tmpElement = null;
    return element;
}
Also used : MolecularInteraction(org.vcell.pathway.MolecularInteraction) Element(org.jdom.Element)

Example 3 with MolecularInteraction

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

the class PathwayReader method addObjectMolecularInteraction.

private MolecularInteraction addObjectMolecularInteraction(Element element) {
    MolecularInteraction molecularInteraction = new MolecularInteraction();
    addAttributes(molecularInteraction, element);
    for (Object child : element.getChildren()) {
        if (!addContentMolecularInteraction(molecularInteraction, element, (Element) child)) {
            showUnexpected((Element) child, molecularInteraction);
        }
    }
    pathwayModel.add(molecularInteraction);
    return molecularInteraction;
}
Also used : MolecularInteraction(org.vcell.pathway.MolecularInteraction) Element(org.jdom.Element) BioPaxObject(org.vcell.pathway.BioPaxObject)

Example 4 with MolecularInteraction

use of org.vcell.pathway.MolecularInteraction 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 5 with MolecularInteraction

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

the class PathwayGraphModel method refreshGroupObject.

private void refreshGroupObject(GroupObject groupObject) {
    for (BioPaxObject bpObject : groupObject.getGroupedObjects()) {
        if (bpObject instanceof Conversion) {
            // Conversions inside groupObject
            Conversion conversion = (Conversion) bpObject;
            refreshInteraction(conversion);
        } else if (bpObject instanceof MolecularInteraction) {
            // molecularInteraction inside  groupObject
            MolecularInteraction molecularInteraction = (MolecularInteraction) bpObject;
            refreshInteraction(molecularInteraction);
        } else if (bpObject instanceof GroupObject) {
            // groupObject inside another groupObject
            refreshGroupObject((GroupObject) bpObject);
        }
    }
}
Also used : BioPaxObject(org.vcell.pathway.BioPaxObject) MolecularInteraction(org.vcell.pathway.MolecularInteraction) GroupObject(org.vcell.pathway.GroupObject) Conversion(org.vcell.pathway.Conversion)

Aggregations

MolecularInteraction (org.vcell.pathway.MolecularInteraction)6 BioPaxObject (org.vcell.pathway.BioPaxObject)5 Element (org.jdom.Element)4 GroupObject (org.vcell.pathway.GroupObject)4 Complex (org.vcell.pathway.Complex)2 Conversion (org.vcell.pathway.Conversion)2 Dna (org.vcell.pathway.Dna)2 Protein (org.vcell.pathway.Protein)2 Rna (org.vcell.pathway.Rna)2 SmallMolecule (org.vcell.pathway.SmallMolecule)2 EdgeShape (cbit.gui.graph.EdgeShape)1 Shape (cbit.gui.graph.Shape)1 Dimension (java.awt.Dimension)1 Rectangle (java.awt.Rectangle)1 HashSet (java.util.HashSet)1 Control (org.vcell.pathway.Control)1 DnaRegion (org.vcell.pathway.DnaRegion)1 GeneticInteraction (org.vcell.pathway.GeneticInteraction)1 Interaction (org.vcell.pathway.Interaction)1 Pathway (org.vcell.pathway.Pathway)1