py4cytoscape.tables.get_table_columns

get_table_columns(table='node', columns=None, namespace='default', network=None, base_url='http://127.0.0.1:1234/v1')[source]

Retrieve one or more columns of data from node, edge or network tables.

The ‘SUID’ column is always retrieved along with specified columns. The ‘SUID’ values are used as index in the returned dataframe.

Parameters
  • table (str) – Name of table, e.g., node (default), edge, network

  • columns (str or list or None) – Names of columns to retrieve values from as list object or comma-separated list; default is all columns

  • namespace (str) – Namespace of table. Default is “default”.

  • network (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

requested columns (including SUID), and rows for each node/edge or network.

Return type

dataframe

Raises
  • HTTPError – if table or namespace doesn’t exist in network

  • CyError – if network name or SUID doesn’t exist

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

Examples

>>> get_table_columns()
      SUID shared name     name  ...   gal4RGsig   gal80Rsig isExcludedFromPaths
3072  3072     YDL081C  YDL081C  ...    0.048133  5.9631e-06               False
3073  3073     YGL166W  YGL166W  ...   0.0012181    0.032147               False
...
>>> get_table_columns(columns='name')
      SUID shared name     name  ...   gal4RGsig   gal80Rsig isExcludedFromPaths
3072  3072     YDL081C  YDL081C  ...    0.048133  5.9631e-06               False
3073  3073     YGL166W  YGL166W  ...   0.0012181    0.032147               False
...
>>> get_table_columns(columns=['gal1RGexp', 'Eccentricity', 'Stress'])
    gal1RGexp Eccentricity  Stress
4608    -0.262           17       0
4609    -0.704           17    2092
...
>>> get_table_columns(columns='Stress, NumberOfDirectedEdges')
        Stress NumberOfDirectedEdges
4608       0                     1
4609    2092                     2
...

Note

For requested columns not present in the table, the column is not returned, but a warning is shown.