py4cytoscape.filters.apply_filter

apply_filter(filter_name='Default filter', hide=False, network=None, base_url='http://127.0.0.1:1234/v1')[source]

Run an existing filter by supplying the filter name.

Parameters
  • filter_name (str) – Name of filter to apply. Default is “Default filter”.

  • hide (bool) – Whether to hide filtered out nodes and edges. Default is FALSE. Ignored if all nodes or edges are filtered out. This is an alternative to filtering for node and edge selection.

  • network (SUID or str or None) – Name or SUID of the network. Default is the “current” network active in Cytoscape.

  • base_url (str) – Ignore unless you need to specify a custom domain, port or version to connect to the CyREST API. Default is http://localhost:1234 and the latest version of the CyREST API supported by this version of py4cytoscape.

Returns

{‘nodes’: <node list>, ‘edges’: <edge list>} returns list of nodes and edges selected after filter executes

Return type

dict

Raises
  • CyError – if filter doesn’t exist

  • requests.exceptions.RequestException – if can’t connect to Cytoscape or Cytoscape returns an error

Examples

>>> apply_filter('degree filter 1x')
{'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}
>>> apply_filter('degree filter 1x', hide=True, network='My Network')
{'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}

See also

unhide_all()