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();
}
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();
}
}
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;
}
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;
}
Aggregations