use of org.vcell.pathway.Entity 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;
}
use of org.vcell.pathway.Entity 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;
}
use of org.vcell.pathway.Entity in project vcell by virtualcell.
the class BioPaxShape method refreshLabel.
@Override
public void refreshLabel() {
String name = "[" + bioPaxObject.getIDShort() + "]";
if (bioPaxObject instanceof Entity) {
Entity entity = (Entity) bioPaxObject;
ArrayList<String> names = entity.getName();
if (names.size() > 0) {
name = names.get(0);
}
}
setLabel(name);
smallLabel = getLabel();
if (bTruncateLabelName && getLabel().length() > (2 * SCS_LABEL_WIDTHPARM + SCS_LABEL_TRUCATED.length())) {
smallLabel = getLabel().substring(0, SCS_LABEL_WIDTHPARM) + SCS_LABEL_TRUCATED + getLabel().substring(getLabel().length() - SCS_LABEL_WIDTHPARM);
}
}
use of org.vcell.pathway.Entity in project vcell by virtualcell.
the class BioModelEditorReactionTableModel method computeData.
protected ArrayList<ModelProcess> computeData() {
ArrayList<ModelProcess> processList = new ArrayList<ModelProcess>();
if (getModel() != null) {
ModelProcess[] modelProcesses = getModel().getModelProcesses();
if (searchText == null || searchText.length() == 0) {
processList.addAll(Arrays.asList(modelProcesses));
} else {
String lowerCaseSearchText = searchText.toLowerCase();
for (ModelProcess process : modelProcesses) {
boolean bMatchRelationshipObj = false;
if (process instanceof ReactionStep) {
ReactionStep reactionStep = (ReactionStep) process;
HashSet<RelationshipObject> relObjsHash = bioModel.getRelationshipModel().getRelationshipObjects(reactionStep);
for (RelationshipObject relObj : relObjsHash) {
if (relObj.getBioPaxObject() instanceof Entity) {
if (((Entity) relObj.getBioPaxObject()).getName().get(0).toLowerCase().contains(lowerCaseSearchText)) {
bMatchRelationshipObj = true;
break;
}
}
}
}
if (bMatchRelationshipObj || process.containsSearchText(lowerCaseSearchText)) {
if (!processList.contains(process)) {
processList.add(process);
}
}
if (process instanceof ReactionStep) {
// we also search in reaction step expression, for strings like "s1 + s2" or s1 -> s2
ModelProcessEquation mpe = new ModelProcessEquation(process, bioModel.getModel());
if (mpe.toString().toLowerCase().contains(lowerCaseSearchText)) {
if (!processList.contains(process)) {
processList.add(process);
}
}
}
}
}
}
return processList;
}
use of org.vcell.pathway.Entity in project vcell by virtualcell.
the class BioModelEditorSpeciesTableModel method computeData.
protected ArrayList<SpeciesContext> computeData() {
ArrayList<SpeciesContext> speciesContextList = new ArrayList<SpeciesContext>();
if (getModel() != null) {
if (searchText == null || searchText.length() == 0) {
speciesContextList.addAll(Arrays.asList(getModel().getSpeciesContexts()));
} else {
String lowerCaseSearchText = searchText.toLowerCase();
for (SpeciesContext s : getModel().getSpeciesContexts()) {
boolean bMatchRelationshipObj = false;
HashSet<RelationshipObject> relObjsHash = bioModel.getRelationshipModel().getRelationshipObjects(s);
for (RelationshipObject relObj : relObjsHash) {
if (relObj.getBioPaxObject() instanceof Entity) {
if (((Entity) relObj.getBioPaxObject()).getName().get(0).toLowerCase().contains(lowerCaseSearchText)) {
bMatchRelationshipObj = true;
break;
}
}
}
if (bMatchRelationshipObj || s.getName().toLowerCase().contains(lowerCaseSearchText) || s.getStructure().getName().toLowerCase().contains(lowerCaseSearchText)) {
speciesContextList.add(s);
}
}
}
}
return speciesContextList;
}
Aggregations