Search in sources :

Example 16 with GroupObject

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();
}
Also used : UtilCancelException(org.vcell.util.UtilCancelException) PathwayGrouping(org.vcell.pathway.group.PathwayGrouping) BioPaxObject(org.vcell.pathway.BioPaxObject) ArrayList(java.util.ArrayList) GroupObject(org.vcell.pathway.GroupObject) HashSet(java.util.HashSet)

Example 17 with GroupObject

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;
}
Also used : Element(org.jdom.Element) GroupObject(org.vcell.pathway.GroupObject) GroupObject(org.vcell.pathway.GroupObject) BioPaxObject(org.vcell.pathway.BioPaxObject)

Example 18 with GroupObject

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;
}
Also used : BioPaxObject(org.vcell.pathway.BioPaxObject) GroupObject(org.vcell.pathway.GroupObject) HashSet(java.util.HashSet)

Example 19 with GroupObject

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;
}
Also used : BioPaxObject(org.vcell.pathway.BioPaxObject) GroupObject(org.vcell.pathway.GroupObject)

Example 20 with GroupObject

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;
}
Also used : BioPaxObject(org.vcell.pathway.BioPaxObject) GroupObject(org.vcell.pathway.GroupObject) HashSet(java.util.HashSet)

Aggregations

GroupObject (org.vcell.pathway.GroupObject)20 BioPaxObject (org.vcell.pathway.BioPaxObject)19 HashSet (java.util.HashSet)12 ArrayList (java.util.ArrayList)6 Complex (org.vcell.pathway.Complex)5 Conversion (org.vcell.pathway.Conversion)5 InteractionParticipant (org.vcell.pathway.InteractionParticipant)5 PhysicalEntity (org.vcell.pathway.PhysicalEntity)5 Interaction (org.vcell.pathway.Interaction)4 Protein (org.vcell.pathway.Protein)4 SmallMolecule (org.vcell.pathway.SmallMolecule)4 Control (org.vcell.pathway.Control)3 MolecularInteraction (org.vcell.pathway.MolecularInteraction)3 PathwayGrouping (org.vcell.pathway.group.PathwayGrouping)3 RelationshipObject (org.vcell.relationship.RelationshipObject)3 EdgeShape (cbit.gui.graph.EdgeShape)2 Shape (cbit.gui.graph.Shape)2 BioModelEntityObject (cbit.vcell.model.BioModelEntityObject)2 Set (java.util.Set)2 Element (org.jdom.Element)2