Search in sources :

Example 21 with CyGroup

use of org.cytoscape.group.CyGroup in project cytoscape-impl by cytoscape.

the class CyGroupSettingsImpl method handleEvent.

public void handleEvent(NetworkAddedEvent e) {
    CyNetwork net = e.getNetwork();
    Set<CyGroup> groupSet = cyGroupManager.getGroupSet(net);
    if (groupSet == null || groupSet.size() == 0)
        return;
    for (CyGroup group : groupSet) {
        loadSettingsFromTable(group, net);
    }
}
Also used : CyGroup(org.cytoscape.group.CyGroup) CyNetwork(org.cytoscape.model.CyNetwork)

Example 22 with CyGroup

use of org.cytoscape.group.CyGroup in project cytoscape-impl by cytoscape.

the class GroupDataCollapseHandler method handleEvent.

public void handleEvent(GroupAboutToCollapseEvent e) {
    CyNetwork network = e.getNetwork();
    CyGroup group = e.getSource();
    if (e.collapsing()) {
        // Are we aggregating
        if (!cyGroupSettings.getEnableAttributeAggregation(group))
            return;
        // Yup -- all of our information is in the settings...
        CyTable nodeTable = network.getDefaultNodeTable();
        for (CyColumn column : nodeTable.getColumns()) {
            Class<?> type = column.getType();
            if (column.isPrimaryKey())
                continue;
            // Skip over our own columns
            if (CyGroupSettingsImpl.AGGREGATION_SETTINGS.equals(column.getName()))
                continue;
            if (CyGroupSettingsImpl.AGGREGATION_OVERRIDE_SETTINGS.equals(column.getName()))
                continue;
            if (CyGroupSettingsImpl.VIEW_SETTINGS.equals(column.getName()))
                continue;
            if (CyGroupImpl.CHILDREN_ATTR.equals(column.getName()))
                continue;
            if (CyGroupImpl.DESCENDENTS_ATTR.equals(column.getName()))
                continue;
            // Don't aggregate the name or shared name columns by default
            if (CyNetwork.NAME.equals(column.getName())) {
                if (!haveOverride(group, column))
                    continue;
            }
            if (CyRootNetwork.SHARED_NAME.equals(column.getName())) {
                if (!haveOverride(group, column))
                    continue;
            }
            // Do we have an override for this group and column?
            Aggregator<?> agg = cyGroupSettings.getAggregator(group, column);
            if (agg == null) {
                continue;
            }
            // OK, aggregate
            agg.aggregate(nodeTable, group, column);
        }
    }
}
Also used : CyGroup(org.cytoscape.group.CyGroup) CyTable(org.cytoscape.model.CyTable) CyColumn(org.cytoscape.model.CyColumn) CyNetwork(org.cytoscape.model.CyNetwork)

Example 23 with CyGroup

use of org.cytoscape.group.CyGroup in project cytoscape-impl by cytoscape.

the class GroupUtil method getGroups.

public Set<CyGroup> getGroups(final Collection<CyNetwork> networks) {
    final Set<CyGroup> groups = new HashSet<>();
    final CyGroupManager groupMgr = serviceRegistrar.getService(CyGroupManager.class);
    for (final CyNetwork net : networks) groups.addAll(groupMgr.getGroupSet(net));
    return groups;
}
Also used : CyGroup(org.cytoscape.group.CyGroup) CyNetwork(org.cytoscape.model.CyNetwork) CyGroupManager(org.cytoscape.group.CyGroupManager) HashSet(java.util.HashSet)

Example 24 with CyGroup

use of org.cytoscape.group.CyGroup in project cytoscape-impl by cytoscape.

the class GroupUtil method getExternalEdges.

public List<CyEdge> getExternalEdges(final CyNetwork network) {
    // Get all of our groups in this network
    final CyGroupManager groupMgr = serviceRegistrar.getService(CyGroupManager.class);
    Set<CyGroup> groupSet = groupMgr.getGroupSet(network);
    List<CyEdge> externalEdges = new ArrayList<>();
    for (CyGroup group : groupSet) {
        // Don't need to worry about this for expanded groups
        if (group.isCollapsed(network))
            externalEdges.addAll(group.getExternalEdgeList());
    }
    return externalEdges;
}
Also used : CyGroup(org.cytoscape.group.CyGroup) ArrayList(java.util.ArrayList) CyEdge(org.cytoscape.model.CyEdge) CyGroupManager(org.cytoscape.group.CyGroupManager)

Example 25 with CyGroup

use of org.cytoscape.group.CyGroup in project cytoscape-impl by cytoscape.

the class GroupUtil method prepareGroupsForSerialization.

public void prepareGroupsForSerialization(final Collection<CyNetwork> networks) {
    if (networks == null)
        return;
    addedNodes = new HashMap<>();
    for (CyNetwork net : networks) {
        if (!(net instanceof CySubNetwork))
            continue;
        // Get all of our groups
        final CyGroupManager groupMgr = serviceRegistrar.getService(CyGroupManager.class);
        Set<CyGroup> groupSet = groupMgr.getGroupSet(net);
        // For each group, save the list of external edges
        for (CyGroup group : groupSet) {
            updateExternalEdgeAttribute(group);
            updateCollapsedGroupsAttribute(group);
            updateGroupAttribute(net, group);
        }
    }
}
Also used : CyGroup(org.cytoscape.group.CyGroup) CyNetwork(org.cytoscape.model.CyNetwork) CySubNetwork(org.cytoscape.model.subnetwork.CySubNetwork) CyGroupManager(org.cytoscape.group.CyGroupManager)

Aggregations

CyGroup (org.cytoscape.group.CyGroup)60 CyNode (org.cytoscape.model.CyNode)33 CyNetwork (org.cytoscape.model.CyNetwork)26 ArrayList (java.util.ArrayList)22 CyEdge (org.cytoscape.model.CyEdge)12 CyNetworkView (org.cytoscape.view.model.CyNetworkView)10 HashSet (java.util.HashSet)8 CyRootNetwork (org.cytoscape.model.subnetwork.CyRootNetwork)7 CySubNetwork (org.cytoscape.model.subnetwork.CySubNetwork)7 List (java.util.List)6 GroupViewType (org.cytoscape.group.CyGroupSettingsManager.GroupViewType)6 CyGroupManager (org.cytoscape.group.CyGroupManager)5 CyRow (org.cytoscape.model.CyRow)5 TaskIterator (org.cytoscape.work.TaskIterator)5 CyGroupImpl (org.cytoscape.group.internal.CyGroupImpl)4 Dimension (java.awt.Dimension)3 LinkedHashSet (java.util.LinkedHashSet)3 CyEventHelper (org.cytoscape.event.CyEventHelper)3 GroupCollapsedEvent (org.cytoscape.group.events.GroupCollapsedEvent)3 FuzzyNodeCluster (edu.ucsf.rbvi.clusterMaker2.internal.algorithms.FuzzyNodeCluster)2