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