py4cytoscape.style_auto_mappings.gen_edge_opacity_map

gen_edge_opacity_map(table_column, number_scheme={'c': ('scheme_c_number_continuous', 'continuous', <function scheme_c_number_continuous.<locals>.<lambda>>), 'd': ('scheme_d_number_series', 'discrete', <function scheme_d_number_series.<locals>.<lambda>>)}, mapping_type='c', default_number=None, style_name=None, network=None, base_url='http://127.0.0.1:1234/v1')[source]

Generate opacity map parameters for discrete or continuous values in an edge table

A basic scheme is a tuple containing the scheme function name, scheme type, and a lambda resolving to a function that provides map-to values. There are a few ways a scheme can be encoded in the number_scheme parameter. The most generic is a dictionary that identifies which basic scheme to use if the mapping_type is discrete or continuous. Or the basic scheme can be provided directly (without being in a dict). Either way, for discrete mappings, the basic scheme that should be discrete. For continuous mappings, the basic scheme should be continuous.

Parameters
  • table_column (str) – Name of Cytoscape edge table column to map values from

  • number_scheme (dict or func) – Descriptor for functions that return an opacity list of a given length

  • default_number (int) – Opacity value to set as default for all unmapped values

  • style_name (str) – name for style

  • network (SUID or str or None) – Name or SUID of a network or view. 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://127.0.0.1:1234 and the latest version of the CyREST API supported by this version of py4cytoscape.

Returns

Collection of parameter values suitable for passing to a opacity style_mappings setter function

Return type

dict

Raises
  • CyError – if network doesn’t exist, or mapping_type is unsupported, or number_scheme doesn’t match mapping_type

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

Examples

>>> gen_edge_opacity_map('interaction', mapping_type='d')
{'table_column': 'interaction', 'table_column_values': ['pp', 'pd'], 'opacities': [0, 10], 'mapping_type': 'd', 'default_opacity': None, 'style_name': None, 'network': None, 'base_url': 'http://127.0.0.1:1234/v1'}
>>> gen_edge_opacity_map('interaction', scheme_d_number_series(start_value=100, step=20), style_name='galFiltered Style', mapping_type='d')
{'table_column': 'interaction', 'table_column_values': ['pp', 'pd'], 'opacities': [100, 120], 'mapping_type': 'd', 'default_opacity': None, 'style_name': 'galFiltered Style', 'network': None, 'base_url': 'http://127.0.0.1:1234/v1'}
>>> gen_edge_opacity_map('EdgeBetweenness')
{'table_column': 'EdgeBetweenness', 'table_column_values': [2.0, 9591.11110001, 19180.22220002], 'opacities': [10, 20.0, 30], 'mapping_type': 'c', 'default_opacity': None, 'style_name': None, 'network': None, 'base_url': 'http://127.0.0.1:1234/v1'}
>>> gen_edge_opacity_map('EdgeBetweenness', scheme_c_number_continuous(100, 200), style_name='galFiltered Style')
{'table_column': 'EdgeBetweenness', 'table_column_values': [2.0, 9591.11110001, 19180.22220002], 'opacities': [100, 150.0, 200], 'mapping_type': 'c', 'default_opacity': None, 'style_name': 'galFiltered Style', 'network': None, 'base_url': 'http://127.0.0.1:1234/v1'}

See also

set_edge_label_opacity_mapping(), set_edge_opacity_mapping()

See also

Value Generators in the Concepts section in the py4cytoscape User Manual.