use of org.vcell.model.rbm.MolecularType in project vcell by virtualcell.
the class RbmMolecularTypeTreeCellRenderer method getTreeCellRendererComponent.
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
setBorder(null);
if (value instanceof BioModelNode) {
BioModelNode node = (BioModelNode) value;
Object userObject = node.getUserObject();
String text = null;
String toolTip = null;
Icon icon = null;
if (userObject instanceof MolecularType) {
MolecularType mt = (MolecularType) userObject;
text = toHtml(mt, true);
toolTip = toHtmlWithTip(mt, true);
if (owner == null) {
icon = VCellIcons.rbmMolecularTypeSimpleIcon;
;
} else {
Graphics gc = owner.getGraphics();
icon = new MolecularTypeSmallShape(1, 4, mt, null, gc, mt, null, issueManager);
}
} else if (userObject instanceof MolecularComponent) {
BioModelNode parentNode = (BioModelNode) node.getParent();
MolecularComponent mc = (MolecularComponent) userObject;
text = toHtml(mc, true);
toolTip = toHtmlWithTip(mc, true);
icon = VCellIcons.rbmComponentGreenIcon;
if (mc.getComponentStateDefinitions().size() > 0) {
icon = VCellIcons.rbmComponentGreenStateIcon;
}
// here is how to set the cell minimum size !!!
FontMetrics fm = getFontMetrics(getFont());
int width = fm.stringWidth(text);
setMinimumSize(new Dimension(width + 50, fm.getHeight() + 5));
} else if (userObject instanceof ComponentStateDefinition) {
ComponentStateDefinition cs = (ComponentStateDefinition) userObject;
text = toHtml(cs);
toolTip = toHtmlWithTip(cs);
icon = VCellIcons.rbmComponentStateIcon;
} else {
System.out.println("unknown thingie " + userObject);
}
setText(text);
setIcon(icon);
setToolTipText(toolTip == null ? text : toolTip);
}
return this;
}
use of org.vcell.model.rbm.MolecularType in project vcell by virtualcell.
the class SpeciesPropertiesPanel method showPopupMenu.
private void showPopupMenu(MouseEvent e, PointLocationInShapeContext locationContext) {
if (popupFromShapeMenu == null) {
popupFromShapeMenu = new JPopupMenu();
}
if (popupFromShapeMenu.isShowing()) {
return;
}
final Object deepestShape = locationContext.getDeepestShape();
final RbmElementAbstract selectedObject;
if (deepestShape == null) {
selectedObject = null;
// when cursor is outside any species pattern we offer to add a new one
System.out.println("outside");
// popupFromShapeMenu.add(getAddSpeciesPatternFromShapeMenuItem());
} else if (deepestShape instanceof ComponentStateLargeShape) {
System.out.println("inside state");
if (((ComponentStateLargeShape) deepestShape).isHighlighted()) {
selectedObject = ((ComponentStateLargeShape) deepestShape).getComponentStatePattern();
} else {
return;
}
} else if (deepestShape instanceof MolecularComponentLargeShape) {
System.out.println("inside component");
if (((MolecularComponentLargeShape) deepestShape).isHighlighted()) {
selectedObject = ((MolecularComponentLargeShape) deepestShape).getMolecularComponentPattern();
} else {
return;
}
} else if (deepestShape instanceof MolecularTypeLargeShape) {
System.out.println("inside molecule");
if (((MolecularTypeLargeShape) deepestShape).isHighlighted()) {
selectedObject = ((MolecularTypeLargeShape) deepestShape).getMolecularTypePattern();
} else {
return;
}
} else if (deepestShape instanceof SpeciesPatternLargeShape) {
System.out.println("inside species pattern");
if (((SpeciesPatternLargeShape) deepestShape).isHighlighted()) {
selectedObject = ((SpeciesPatternLargeShape) deepestShape).getSpeciesPattern();
} else {
if (!fieldSpeciesContext.hasSpeciesPattern()) {
selectedObject = new SpeciesPattern();
} else {
return;
}
}
} else {
selectedObject = null;
System.out.println("inside something else?");
return;
}
System.out.println(selectedObject);
popupFromShapeMenu.removeAll();
Point mousePoint = e.getPoint();
if (selectedObject instanceof SpeciesPattern) {
final SpeciesPattern sp = (SpeciesPattern) selectedObject;
JMenu addMenuItem = new JMenu(VCellErrorMessages.SpecifyMolecularTypes);
popupFromShapeMenu.add(addMenuItem);
addMenuItem.removeAll();
for (final MolecularType mt : bioModel.getModel().getRbmModelContainer().getMolecularTypeList()) {
JMenuItem menuItem = new JMenuItem(mt.getName());
Graphics gc = shapePanel.getGraphics();
Icon icon = new MolecularTypeSmallShape(1, 4, mt, null, gc, mt, null, issueManager);
menuItem.setIcon(icon);
addMenuItem.add(menuItem);
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MolecularTypePattern molecularTypePattern = new MolecularTypePattern(mt);
for (MolecularComponentPattern mcp : molecularTypePattern.getComponentPatternList()) {
mcp.setBondType(BondType.None);
}
if (!fieldSpeciesContext.hasSpeciesPattern()) {
fieldSpeciesContext.setSpeciesPattern(sp);
}
fieldSpeciesContext.getSpeciesPattern().addMolecularTypePattern(molecularTypePattern);
}
});
}
// JMenu compartmentMenuItem = new JMenu("Specify structure");
// popupFromShapeMenu.add(compartmentMenuItem);
// compartmentMenuItem.removeAll();
// for (final Structure struct : bioModel.getModel().getStructures()) {
// JMenuItem menuItem = new JMenuItem(struct.getName());
// compartmentMenuItem.add(menuItem);
// menuItem.addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent e) {
// String nameStruct = e.getActionCommand();
// Structure struct = bioModel.getModel().getStructure(nameStruct);
// fieldSpeciesContext.setStructure(struct);
// }
// });
// }
} else if (selectedObject instanceof MolecularTypePattern) {
MolecularTypePattern mtp = (MolecularTypePattern) selectedObject;
String moveRightMenuText = "Move <b>" + "right" + "</b>";
moveRightMenuText = "<html>" + moveRightMenuText + "</html>";
JMenuItem moveRightMenuItem = new JMenuItem(moveRightMenuText);
Icon icon = VCellIcons.moveRightIcon;
moveRightMenuItem.setIcon(icon);
moveRightMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MolecularTypePattern from = (MolecularTypePattern) selectedObject;
SpeciesPattern sp = locationContext.sps.getSpeciesPattern();
sp.shiftRight(from);
speciesPropertiesTreeModel.populateTree();
}
});
popupFromShapeMenu.add(moveRightMenuItem);
String moveLeftMenuText = "Move <b>" + "left" + "</b>";
moveLeftMenuText = "<html>" + moveLeftMenuText + "</html>";
JMenuItem moveLeftMenuItem = new JMenuItem(moveLeftMenuText);
icon = VCellIcons.moveLeftIcon;
moveLeftMenuItem.setIcon(icon);
moveLeftMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MolecularTypePattern from = (MolecularTypePattern) selectedObject;
SpeciesPattern sp = locationContext.sps.getSpeciesPattern();
sp.shiftLeft(from);
speciesPropertiesTreeModel.populateTree();
}
});
popupFromShapeMenu.add(moveLeftMenuItem);
popupFromShapeMenu.add(new JSeparator());
String deleteMenuText = "Delete <b>" + mtp.getMolecularType().getName() + "</b>";
deleteMenuText = "<html>" + deleteMenuText + "</html>";
JMenuItem deleteMenuItem = new JMenuItem(deleteMenuText);
deleteMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MolecularTypePattern mtp = (MolecularTypePattern) selectedObject;
SpeciesPattern sp = locationContext.sps.getSpeciesPattern();
sp.removeMolecularTypePattern(mtp);
if (sp.getMolecularTypePatterns().isEmpty()) {
fieldSpeciesContext.setSpeciesPattern(null);
}
}
});
popupFromShapeMenu.add(deleteMenuItem);
} else if (selectedObject instanceof MolecularComponentPattern) {
manageComponentPatternFromShape(selectedObject, locationContext, ShowWhat.ShowBond);
} else if (selectedObject instanceof ComponentStatePattern) {
MolecularComponentPattern mcp = ((ComponentStateLargeShape) deepestShape).getMolecularComponentPattern();
manageComponentPatternFromShape(mcp, locationContext, ShowWhat.ShowState);
} else {
System.out.println("Where am I ???");
}
popupFromShapeMenu.show(e.getComponent(), mousePoint.x, mousePoint.y);
}
use of org.vcell.model.rbm.MolecularType in project vcell by virtualcell.
the class BioModelEditor method setRightBottomPanelOnSelection.
@Override
protected void setRightBottomPanelOnSelection(Object[] selections) {
if (selections == null) {
return;
}
JComponent bottomComponent = rightBottomEmptyPanel;
int destComponentIndex = DocumentEditorTabID.object_properties.ordinal();
boolean bShowInDatabaseProperties = false;
boolean bShowPathway = false;
if (selections.length == 1) {
Object singleSelection = selections[0];
if (singleSelection instanceof ReactionStep) {
bottomComponent = getReactionPropertiesPanel();
} else if (singleSelection instanceof ReactionRule) {
bottomComponent = getReactionRulePropertiesPanel();
} else if (singleSelection instanceof SpeciesContext) {
bottomComponent = getSpeciesPropertiesPanel();
} else if (singleSelection instanceof MolecularType) {
bottomComponent = getMolecularTypePropertiesPanel();
} else if (singleSelection instanceof RbmObservable) {
bottomComponent = getObservablePropertiesPanel();
} else if (singleSelection instanceof Structure) {
bottomComponent = getStructurePropertiesPanel();
getStructurePropertiesPanel().setModel(bioModel.getModel());
} else if (singleSelection instanceof Parameter) {
bottomComponent = getParameterPropertiesPanel();
} else if (singleSelection instanceof SimulationContext) {
bottomComponent = getApplicationPropertiesPanel();
} else if (singleSelection instanceof ParameterEstimationTask) {
bottomComponent = parameterEstimationTaskPropertiesPanel;
} else if (singleSelection instanceof Product || singleSelection instanceof Reactant) {
bottomComponent = getReactionParticipantPropertiesPanel();
} else if (singleSelection instanceof BioModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = bioModelMetaDataPanel;
} else if (singleSelection instanceof MathModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = mathModelMetaDataPanel;
} else if (singleSelection instanceof GeometryInfo) {
bShowInDatabaseProperties = true;
bottomComponent = geometryMetaDataPanel;
} else if (singleSelection instanceof SpeciesContextSpec) {
bottomComponent = getSpeciesContextSpecPanel();
} else if (singleSelection instanceof ReactionSpec) {
bottomComponent = getKineticsTypeTemplatePanel();
} else if (singleSelection instanceof ReactionRuleSpec) {
//
bottomComponent = getReactionRuleSpecPropertiesPanel();
} else if (singleSelection instanceof BioModelsNetModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = getBioModelsNetPropertiesPanel();
} else if (singleSelection instanceof Simulation) {
bottomComponent = getSimulationSummaryPanel();
} else if (singleSelection instanceof DataSymbol) {
bottomComponent = getDataSymbolsSpecPanel();
} else if (singleSelection instanceof BioEvent) {
bottomComponent = getEventPanel();
} else if (singleSelection instanceof SpatialObject) {
bottomComponent = getSpatialObjectPropertyPanel();
} else if (singleSelection instanceof SpatialProcess) {
bottomComponent = getSpatialProcessPropertyPanel();
} else if (singleSelection instanceof BioPaxObject) {
bottomComponent = bioPaxObjectPropertiesPanel;
} else if (singleSelection instanceof BioModel || singleSelection instanceof VCMetaData) {
bottomComponent = bioModelEditorAnnotationPanel;
} else if (singleSelection instanceof PathwayData) {
bShowPathway = true;
bottomComponent = getBioModelEditorPathwayPanel();
} else if (singleSelection instanceof Model) {
} else if (singleSelection instanceof RuleParticipantSignature) {
bottomComponent = getReactionRuleParticipantSignaturePropertiesPanel();
} else if (singleSelection instanceof CSGObject) {
bottomComponent = csgObjectPropertiesPanel;
csgObjectPropertiesPanel.setSimulationContext(getSelectedSimulationContext());
} else if (singleSelection instanceof DocumentEditorTreeFolderNode) {
DocumentEditorTreeFolderClass folderClass = ((DocumentEditorTreeFolderNode) singleSelection).getFolderClass();
if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && !(singleSelection instanceof ReactionRule)) {
bottomComponent = getReactionPropertiesPanel();
} else if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && (singleSelection instanceof ReactionRule)) {
bottomComponent = getReactionRulePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.STRUCTURES_NODE) {
bottomComponent = getStructurePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.SPECIES_NODE) {
bottomComponent = getSpeciesPropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE) {
bottomComponent = getMolecularTypePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.OBSERVABLES_NODE) {
bottomComponent = getObservablePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.APPLICATIONS_NODE) {
bottomComponent = getApplicationsPropertiesPanel();
getApplicationsPropertiesPanel().setBioModel(bioModel);
} else if (folderClass == DocumentEditorTreeFolderClass.PARAMETER_ESTIMATION_NODE) {
bottomComponent = parameterEstimationTaskPropertiesPanel;
}
}
}
if (bShowPathway) {
for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
if (rightBottomTabbedPane.getComponentAt(destComponentIndex) == bottomComponent) {
break;
}
}
String tabTitle = "Pathway Preview";
if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
rightBottomTabbedPane.addTab(tabTitle, new TabCloseIcon(), bottomComponent);
}
} else if (bShowInDatabaseProperties) {
for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
Component c = rightBottomTabbedPane.getComponentAt(destComponentIndex);
if (c == bioModelMetaDataPanel || c == mathModelMetaDataPanel || c == geometryMetaDataPanel || c == getBioModelsNetPropertiesPanel()) {
break;
}
}
if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
rightBottomTabbedPane.addTab(DATABASE_PROPERTIES_TAB_TITLE, new TabCloseIcon(), bottomComponent);
}
}
if (rightBottomTabbedPane.getComponentAt(destComponentIndex) != bottomComponent) {
bottomComponent.setBorder(GuiConstants.TAB_PANEL_BORDER);
rightBottomTabbedPane.setComponentAt(destComponentIndex, bottomComponent);
rightSplitPane.repaint();
}
if (rightBottomTabbedPane.getSelectedComponent() != bottomComponent) {
rightBottomTabbedPane.setSelectedComponent(bottomComponent);
}
}
use of org.vcell.model.rbm.MolecularType in project vcell by virtualcell.
the class BioModelEditor method popupMenuActionPerformed.
@Override
protected void popupMenuActionPerformed(DocumentEditorPopupMenuAction action, String actionCommand) {
Model model = bioModel.getModel();
final SimulationContext selectedSimulationContext = getSelectedSimulationContext();
switch(action) {
case add_new:
try {
Object obj = documentEditorTree.getLastSelectedPathComponent();
if (obj == null || !(obj instanceof BioModelNode)) {
return;
}
BioModelNode selectedNode = (BioModelNode) obj;
Object userObject = selectedNode.getUserObject();
if (userObject instanceof DocumentEditorTreeFolderNode) {
DocumentEditorTreeFolderClass folderClass = ((DocumentEditorTreeFolderNode) userObject).getFolderClass();
Object newObject = null;
switch(folderClass) {
case REACTIONS_NODE:
// TODO: should add a Add New Rule menu item
newObject = model.createSimpleReaction(model.getStructure(0));
break;
case STRUCTURES_NODE:
newObject = model.createFeature();
break;
case SPECIES_NODE:
newObject = model.createSpeciesContext(model.getStructure(0));
break;
case MOLECULAR_TYPES_NODE:
MolecularType mt = model.getRbmModelContainer().createMolecularType();
model.getRbmModelContainer().addMolecularType(mt, true);
newObject = mt;
break;
case OBSERVABLES_NODE:
if (bioModel.getModel().getRbmModelContainer().getMolecularTypeList().isEmpty()) {
PopupGenerator.showInfoDialog(this, VCellErrorMessages.MustBeRuleBased);
return;
}
RbmObservable o = model.getRbmModelContainer().createObservable(RbmObservable.ObservableType.Molecules);
model.getRbmModelContainer().addObservable(o);
SpeciesPattern sp = new SpeciesPattern();
o.addSpeciesPattern(sp);
newObject = o;
break;
case SIMULATIONS_NODE:
if (selectedSimulationContext != null) {
AsynchClientTask task1 = new AsynchClientTask("new simulation", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
MathMappingCallback callback = new MathMappingCallbackTaskAdapter(getClientTaskStatusSupport());
selectedSimulationContext.refreshMathDescription(callback, NetworkGenerationRequirements.AllowTruncatedStandardTimeout);
}
};
AsynchClientTask task2 = new AsynchClientTask("new simulation", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
MathMappingCallback callback = new MathMappingCallbackTaskAdapter(getClientTaskStatusSupport());
Object newsim = selectedSimulationContext.addNewSimulation(SimulationOwner.DEFAULT_SIM_NAME_PREFIX, callback, NetworkGenerationRequirements.AllowTruncatedStandardTimeout);
selectionManager.setSelectedObjects(new Object[] { newsim });
}
};
ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 });
}
break;
default:
break;
}
if (newObject != null) {
selectionManager.setSelectedObjects(new Object[] { newObject });
}
}
} catch (Exception ex) {
DialogUtils.showErrorDialog(this, ex.getMessage());
}
break;
case add_new_app_deterministic:
newApplication(Application.NETWORK_DETERMINISTIC);
break;
case add_new_app_stochastic:
newApplication(Application.NETWORK_STOCHASTIC);
break;
case add_new_app_rulebased:
{
// if(model.getStructures().length > 1) {
// DialogUtils.showErrorDialog(this, VCellErrorMessages.NFSimAppNotAllowedForMultipleStructures);
// return;
// }
newApplication(Application.RULE_BASED_STOCHASTIC);
break;
}
case copy_app:
ApplicationActionCommand acc = ApplicationActionCommand.lookup(actionCommand);
switch(acc.actionType()) {
case COPY_AS_IS:
copyApplication();
break;
case COPY_CHANGE:
boolean bothSpatial = acc.isSourceSpatial() && acc.isDestSpatial();
// if(acc.getAppType().equals(SimulationContext.Application.RULE_BASED_STOCHASTIC) && model.getStructures().length > 1) {
// DialogUtils.showErrorDialog(this, VCellErrorMessages.NFSimAppNotAllowedForMultipleStructures);
// return;
// }
copyApplication(bothSpatial, acc.getAppType());
break;
case CREATE:
// not used in this menu
throw new UnsupportedOperationException();
}
break;
case app_new_biomodel:
if (actionCommand.equals(GuiConstants.MENU_TEXT_APP_NEWBIOMODEL)) {
createNewBiomodelFromApp();
}
break;
case delete:
try {
if (selectedSimulationContext != null) {
String confirm = PopupGenerator.showOKCancelWarningDialog(this, "Deleting application", "You are going to delete the Application '" + selectedSimulationContext.getName() + "'. Continue?");
if (confirm.equals(UserMessage.OPTION_CANCEL)) {
return;
}
deleteSimulationcontexts(new SimulationContext[] { selectedSimulationContext });
}
} catch (Exception ex) {
DialogUtils.showErrorDialog(this, ex.getMessage());
}
break;
case deleteChoose:
try {
SimulationContext[] allSimContexts = Arrays.copyOf(getBioModelWindowManager().getVCDocument().getSimulationContexts(), getBioModelWindowManager().getVCDocument().getSimulationContexts().length);
Arrays.sort(allSimContexts, new Comparator<SimulationContext>() {
@Override
public int compare(SimulationContext o1, SimulationContext o2) {
return o1.getName().compareToIgnoreCase(o2.getName());
}
});
String[][] rowDataOrig = new String[allSimContexts.length][2];
for (int i = 0; i < allSimContexts.length; i++) {
rowDataOrig[i][0] = allSimContexts[i].getName();
rowDataOrig[i][1] = allSimContexts[i].getSimulations().length + "";
}
final String DELETE = "Delete";
final String CANCEL = "Cancel";
TableListResult result = DialogUtils.showComponentOptionsTableList(this, "Select Applications (and associated Simulations) to delete.", new String[] { "Application", "# of Sims" }, rowDataOrig, ListSelectionModel.MULTIPLE_INTERVAL_SELECTION, null, new String[] { DELETE, CANCEL }, CANCEL, null);
if (result != null && result.selectedOption != null && result.selectedOption.equals(DELETE) && result.selectedTableRows != null && result.selectedTableRows.length > 0) {
ArrayList<SimulationContext> deleteTheseSimcontexts = new ArrayList<SimulationContext>();
for (int i = 0; i < result.selectedTableRows.length; i++) {
deleteTheseSimcontexts.add(allSimContexts[result.selectedTableRows[i]]);
}
deleteSimulationcontexts(deleteTheseSimcontexts.toArray(new SimulationContext[0]));
}
} catch (Exception ex) {
DialogUtils.showErrorDialog(this, ex.getMessage());
}
break;
default:
break;
}
}
use of org.vcell.model.rbm.MolecularType in project vcell by virtualcell.
the class BioModelEditorConversionTableModel method createTableRow.
private ConversionTableRow createTableRow(BioPaxObject bpObject, String interactionId, String interactionLabel, String participantType, double stoich, HashSet<RelationshipObject> relationshipObjects) {
String location = "";
ConversionTableRow conversionTableRow = new ConversionTableRow(bpObject);
conversionTableRow.setInteractionId(interactionId);
conversionTableRow.setInteractionLabel(interactionLabel);
conversionTableRow.setParticipantType(participantType);
// stoichiometry and location
if (participantType.equals("Reactant") || participantType.equals("Product")) {
// stoichiometry
if (stoich != 0)
conversionTableRow.setStoich(stoich);
else
conversionTableRow.setStoich(1.0);
// location
// if(((PhysicalEntity)bpObject).getCellularLocation() != null && ((PhysicalEntity)bpObject).getCellularLocation().getTerm().size()>0)
// location = ((PhysicalEntity)bpObject).getCellularLocation().getTerm().get(0);
// else
location = bioModel.getModel().getStructures()[0].getName();
conversionTableRow.setLocation(location);
} else {
conversionTableRow.setStoich(1.0);
// else
if (bpObject instanceof Transport) {
if (bioModel.getModel().getMembranes().size() > 0)
location = bioModel.getModel().getMembranes().get(0).getName();
else
location = bioModel.getModel().getStructures()[0].getName();
} else
location = bioModel.getModel().getStructures()[0].getName();
conversionTableRow.setLocation(location);
}
// id
if (relationshipObjects == null) {
if (bpObject instanceof Entity) {
String id = (BioPAXUtil.getName((Entity) bpObject) + "_" + location).trim();
if (isValid(id))
conversionTableRow.setId(id);
else
conversionTableRow.setId(changeID(id));
}
} else {
String id = null;
for (RelationshipObject relationshipObject : relationshipObjects) {
if (relationshipObject.getBioModelEntityObject() instanceof MolecularType) {
id = relationshipObject.getBioModelEntityObject().getName();
location = "";
} else if (relationshipObject.getBioModelEntityObject().getStructure().getName().equalsIgnoreCase(location)) {
id = relationshipObject.getBioModelEntityObject().getName();
}
}
if (id != null) {
// the linked bmObject with the same location will be used
conversionTableRow.setId(id);
} else {
// a new bmObject will be created if no linked bmObject in the same location
if (bpObject instanceof Entity) {
id = (BioPAXUtil.getName((Entity) bpObject) + "_" + location).trim();
if (isValid(id))
conversionTableRow.setId(id);
else
conversionTableRow.setId(changeID(id));
}
}
}
return conversionTableRow;
}
Aggregations