use of org.cytoscape.filter.TransformerManager 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);
}
Aggregations