use of org.vcell.relationship.RelationshipObject 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.relationship.RelationshipObject in project vcell by virtualcell.
the class PathwayGraphModel method refreshRelationshipInfo.
protected void refreshRelationshipInfo(Shape shape) {
if (shape instanceof BioPaxShape) {
BioPaxShape bpShape = (BioPaxShape) shape;
BioPaxObject bpObject = bpShape.getBioPaxObject();
boolean hasRelationships = false;
if (bioModel != null) {
HashSet<RelationshipObject> relationships = bioModel.getRelationshipModel().getRelationshipObjects(bpObject);
if (relationships.size() > 0) {
hasRelationships = true;
}
}
bpShape.setHasRelationships(hasRelationships);
}
}
use of org.vcell.relationship.RelationshipObject in project vcell by virtualcell.
the class BioModelEditorPathwayDiagramPanel method showPhysiologyLinks.
private void showPhysiologyLinks() {
BioPaxObject selectedBioPaxObject = getSelectedBioPaxObject();
if (selectedBioPaxObject != null) {
Set<RelationshipObject> relationshipSet = bioModel.getRelationshipModel().getRelationshipObjects(selectedBioPaxObject);
if (relationshipSet.size() > 0) {
ArrayList<BioModelEntityObject> selectedBioModelEntityObjects = new ArrayList<BioModelEntityObject>();
for (RelationshipObject re : relationshipSet) {
BioModelEntityObject bioModelEntityObject = re.getBioModelEntityObject();
selectedBioModelEntityObjects.add(bioModelEntityObject);
}
// if (selectedBioPaxObjects.get(0) instanceof ReactionStep) {
// selectionManager.setActiveView(new ActiveView(null,DocumentEditorTreeFolderClass.REACTIONS_NODE, ActiveViewID.reactions));
// } else if (selectedBioPaxObjects.get(0) instanceof SpeciesContext) {
// selectionManager.setActiveView(new ActiveView(null,DocumentEditorTreeFolderClass.SPECIES_NODE, ActiveViewID.species));
// }
selectionManager.followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.REACTION_DIAGRAM_NODE, ActiveViewID.reaction_diagram), selectedBioModelEntityObjects.toArray(new BioModelEntityObject[0]));
}
}
}
use of org.vcell.relationship.RelationshipObject 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.relationship.RelationshipObject 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