Search in sources :

Example 1 with SelectUtils

use of org.cytoscape.task.internal.select.SelectUtils in project cytoscape-impl by cytoscape.

the class ApplyFilterTask method applyFilter.

public static void applyFilter(CyServiceRegistrar serviceRegistrar, CyNetwork network, NamedTransformer<CyNetwork, CyIdentifiable> transformer) {
    CyEventHelper eventHelper = serviceRegistrar.getService(CyEventHelper.class);
    TransformerManager transformerManager = serviceRegistrar.getService(TransformerManager.class);
    SelectUtils selectUtils = new SelectUtils(eventHelper);
    // De-select all nodes and edges.
    // Do this before running the filter because selection handlers can run in parallel with the filter.
    selectUtils.setSelectedNodes(network, network.getNodeList(), false);
    selectUtils.setSelectedEdges(network, network.getEdgeList(), false);
    Sink sink = new Sink();
    transformerManager.execute(network, transformer.getTransformers(), sink);
    selectUtils.setSelectedNodes(network, sink.getNodes(), true);
}
Also used : CyEventHelper(org.cytoscape.event.CyEventHelper) SelectUtils(org.cytoscape.task.internal.select.SelectUtils) TransformerManager(org.cytoscape.filter.TransformerManager)

Aggregations

CyEventHelper (org.cytoscape.event.CyEventHelper)1 TransformerManager (org.cytoscape.filter.TransformerManager)1 SelectUtils (org.cytoscape.task.internal.select.SelectUtils)1