use of org.vcell.pathway.GroupObject in project vcell by virtualcell.
the class BioModelEditorPathwayDiagramPanel method groupBioPaxObjects.
private void groupBioPaxObjects() {
HashSet<BioPaxObject> selected = new HashSet<BioPaxObject>();
selected.addAll(getSelectedBioPaxObjects());
if (selected.size() == 0)
return;
if (bioModel == null || bioModel.getPathwayModel() == null)
return;
PathwayGrouping pathwayGrouping = new PathwayGrouping();
ArrayList<String> names = new ArrayList<String>();
String id = pathwayGrouping.groupIdGenerator(bioModel.getPathwayModel());
String newName = null;
try {
newName = DialogUtils.showInputDialog0(this, "Name of the GroupObject", id);
} catch (UtilCancelException ex) {
// user canceled; it's ok
}
if (newName != null) {
if (newName.length() == 0) {
PopupGenerator.showErrorDialog(this, "The Name of the GroupObject should be provided.");
} else {
names.add(newName);
GroupObject groupObject = pathwayGrouping.createGroupObject(bioModel.getPathwayModel(), names, id, selected, GroupObject.Type.GROUPEDBIOPAXOBJECTS);
if (groupObject == null) {
// error message
DialogUtils.showErrorDialog(this, "The set of selected objects is a subset of one group object in the model. They will not be grouped together again.");
} else {
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.GroupObject in project vcell by virtualcell.
the class PathwayReaderBiopax3 method addObjectGroupObject.
private GroupObject addObjectGroupObject(Element element) {
GroupObject gObject = new GroupObject();
addAttributes(gObject, element);
for (Object child : element.getChildren()) {
if (child instanceof Element) {
Element childElement = (Element) child;
if (!addContentGroupObject(gObject, element, childElement)) {
showUnexpected(childElement);
}
}
}
pathwayModel.add(gObject);
return gObject;
}
use of org.vcell.pathway.GroupObject in project vcell by virtualcell.
the class PathwayGrouping method updateGroupObjectList.
// get a list of group objects in a pathway model
public Set<BioPaxObject> updateGroupObjectList(PathwayModel pathwayModel) {
Set<BioPaxObject> groupList = new HashSet<BioPaxObject>();
Set<BioPaxObject> originalList = pathwayModel.getBiopaxObjects();
for (BioPaxObject bpObject : originalList) {
if (bpObject instanceof GroupObject) {
groupList.add(bpObject);
}
}
return groupList;
}
use of org.vcell.pathway.GroupObject in project vcell by virtualcell.
the class PathwayGrouping method createGroupObject.
// create a group object in pathway model
public GroupObject createGroupObject(PathwayModel pathwayModel, ArrayList<String> names, String id, HashSet<BioPaxObject> bpObjects, GroupObject.Type newType) {
HashSet<BioPaxObject> groupable = updateGroupableList(pathwayModel, bpObjects);
if (groupable.size() <= 1)
return null;
GroupObject gObject = new GroupObject();
gObject.setName(names);
gObject.setID(id);
gObject.setGroupedeObjects(groupable);
gObject.setType(newType);
return gObject;
}
use of org.vcell.pathway.GroupObject in project vcell by virtualcell.
the class PathwayGrouping method updateBioPaxObjectList.
// get a list of independent biopax Objects including groupObjects
public Set<BioPaxObject> updateBioPaxObjectList(PathwayModel pathwayModel) {
Set<BioPaxObject> clonedOriginalList = new HashSet<BioPaxObject>(pathwayModel.getBiopaxObjects());
Set<BioPaxObject> removedList = new HashSet<BioPaxObject>();
for (BioPaxObject bpObject : clonedOriginalList) {
if (bpObject instanceof GroupObject) {
GroupObject gObject = (GroupObject) bpObject;
for (BioPaxObject bpo : gObject.getGroupedObjects()) {
removedList.add(bpo);
}
}
}
clonedOriginalList.removeAll(removedList);
return clonedOriginalList;
}
Aggregations