py4cytoscape.style_auto_mappings.gen_node_size_map

gen_node_size_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 size map parameters for discrete or continuous values in a node 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 node table column to map values from

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

  • mapping_type (str) – continuous or discrete (c, d); default is continuous

  • default_number (int) – size 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 size 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_node_sizes_map('newcol', mapping_type='d')
{'table_column': 'newcol', 'table_column_values': ['8', '7', '6'], 'sizes': [0, 10, 20], 'mapping_type': 'd', 'default_size': None, 'style_name': None, 'network': None, 'base_url': 'http://127.0.0.1:1234/v1'}
>>> gen_node_sizes_map('newcol', scheme_d_number_series(start_value=100, step=20), style_name='galFiltered Style', mapping_type='d')
{'table_column': 'newcol', 'table_column_values': ['8', '7', '6'], 'sizes': [100, 120, 140], 'mapping_type': 'd', 'default_size': None, 'style_name': 'galFiltered Style', 'network': None, 'base_url': 'http://127.0.0.1:1234/v1'}
>>> gen_node_sizes_map('newcol')
{'table_column': 'newcol', 'table_column_values': [1, 4.5, 8], 'sizes': [10, 20.0, 30], 'mapping_type': 'c', 'default_size': None, 'style_name': 'galFiltered Style', 'network': None, 'base_url': 'http://127.0.0.1:1234/v1'}
>>> gen_node_sizes_map('newcol', scheme_c_number_continuous(100, 200), style_name='galFiltered Style')
{'table_column': 'newcol', 'table_column_values': [1, 4.5, 8], 'sizes': [100, 150.0, 200], 'mapping_type': 'c', 'default_size': None, 'style_name': 'galFiltered Style', 'network': None, 'base_url': 'http://127.0.0.1:1234/v1'}

See also

set_node_font_size_mapping(), set_node_size_mapping()

See also

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