py4cytoscape.style_values.get_node_property¶
-
get_node_property(node_names=None, visual_property=None, network=None, base_url='http://127.0.0.1:1234/v1')[source]¶ Get values for any node property of the specified nodes.
- Parameters
nodes_names (str or list or int or None) – List of nodes or None. If node list:
listof node names or SUIDs, comma-separated string of node names or SUIDs, or scalar node name or SUID. Node names should be found in thenamecolumn of thenode table. If list is None, default is all nodes.visual_property (str) – Name of a visual property. See
get_visual_property_namesnetwork (SUID or str or None) – Name or SUID of a 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://127.0.0.1:1234 and the latest version of the CyREST API supported by this version of py4cytoscape.
- Returns
as a collection of {node-name: prop_value} for each node in node_names parameter
- Return type
dict
- Raises
CyError – if network name, node name or property name doesn’t exist
requests.exceptions.RequestException – if can’t connect to Cytoscape or Cytoscape returns an error
Examples
>>> get_node_property(visual_property='NODE_LABEL') {'YIL070C': 'MAM33', 'YHR198C': 'YHR198C', ...} >>> get_node_property(visual_property='NODE_LABEL', node_names=['YIL070C', 'YHR198C']) {'YIL070C': 'MAM33', 'YHR198C': 'YHR198C'} >>> get_node_property(visual_property='NODE_LABEL', node_names='YIL070C, YHR198C') {'YIL070C': 'MAM33', 'YHR198C': 'YHR198C'} >>> get_node_property(visual_property='NODE_LABEL', node_names=[391173, 391172, 391175]) {391173: 'RPL11B', 391172: 'SXM1', 391175: 'MPT1'} >>> get_node_property(visual_property='NODE_LABEL', node_names='391173, 391172, 391175') {391173: 'RPL11B', 391172: 'SXM1', 391175: 'MPT1'} >>> get_node_property(visual_property='NODE_LABEL', node_names='YER112W', network='galFiltered.sif') {'YER112W': 'LSM4'} >>> get_node_property(visual_property='NODE_LABEL', node_names=391173, network='galFiltered.sif') {391173: 'RPL11B'}