NiceCXNetwork ------------- .. note:: Using the newer data model :py:class:`~ndex2.cx2.CX2Network` is encouraged since all networks on NDEx_ can be retrieved in newer `CX2 format`_ via the `NDEx REST Service`_ The :class:`~ndex2.nice_cx_network.NiceCXNetwork` class provides a data model for working with NDEx_ networks that are stored in the legacy `CX format`_ The term **niceCX** is CX_ with no duplicate aspects. Methods are provided to add nodes, edges, node attributes, edge attributes, etc. Once a :class:`~ndex2.nice_cx_network.NiceCXNetwork` object is populated it can be saved to the NDEx_ server by calling either :py:meth:`~ndex2.nice_cx_network.NiceCXNetwork.upload_to` to create a new network or :py:meth:`~ndex2.nice_cx_network.NiceCXNetwork.update_to` to update an existing network. Methods =========================== Example usage of the methods below can be found in the Jupyter notebook links here: `Tutorial Notebook `__ `Navigating NiceCXNetwork Notebook `__ Node methods **************************** .. autoclass:: ndex2.nice_cx_network.NiceCXNetwork :members: create_node, get_nodes, get_node_attributes, get_node_attribute, get_node_attribute_value, set_node_attribute, Edge methods **************************** .. autoclass:: ndex2.nice_cx_network.NiceCXNetwork :members: create_edge, get_edges, get_edge_attributes, get_edge_attribute, get_edge_attribute_value, set_edge_attribute :noindex: Network methods **************************** .. autoclass:: ndex2.nice_cx_network.NiceCXNetwork :members: get_context, get_name, get_network_attribute, get_network_attribute_names, get_opaque_aspect, set_context, set_name, set_network_attribute, set_opaque_aspect :noindex: Miscellaneous methods **************************** .. autoclass:: ndex2.nice_cx_network.NiceCXNetwork :members: apply_template, apply_style_from_network, print_summary, to_cx, to_cx_stream, to_networkx, to_pandas_dataframe, update_to, upload_to :noindex: Supported data types ===================== The following `CX Data Types `__ are supported in methods that accept **type** Example: .. code-block:: python import ndex2 net = ndex2.nice_cx_network.NiceCXNetwork() node_id = net.create_node('hi') net.set_node_attribute(node_id, 'somevalue', 0.5, type='double') * string * double * boolean * integer * long * list_of_string * list_of_double * list_of_boolean * list_of_integer * list_of_long These constants are defined here: :py:const:`~ndex2.constants.VALID_ATTRIBUTE_DATATYPES` .. _NDEx: https://www.ndexbio.org .. _`CX format`: https://cytoscape.org/cx/specification/cytoscape-exchange-format-specification-(version-1) .. _CX: https://cytoscape.org/cx/specification/cytoscape-exchange-format-specification-(version-1) .. _`CX2 format`: https://cytoscape.org/cx/cx2/specification/cytoscape-exchange-format-specification-(version-2) .. _`NDEx REST Service`: https://home.ndexbio.org/using-the-ndex-server-api