Package: ndex2
OverviewThe NDEx2 Python Client provides methods to accessNDExvia
theNDEx REST Server API. As well as methods for common operations on
networks via the NiceCXNetwork class.Dependenciessixijsonrequestsrequests_toolbeltnetworkxurllib3pandasenum34(Python < 3.4)numpyenum(Python 2.6 & 2.7)CompatibilityPython 3.5+NotePython < 3.5 may have some issuesInstallationThe NDEx2 Python Client module can be installed from the Python Package
Index (PyPI) repository using PIP:pip install ndex2If you already have an older version of the ndex2 module installed, you
can use this command instead:pip install --upgrade ndex2ResourcesThe NDEx2 Python Clientdocumentationis available on Read the Docs.Please refer to ourJupyter Notebook TutorialsGitHub repository for code examples to work with networks using the NDEx2 Python Client and NiceCX object class.LicenseSeeLICENSE.txtHistory3.8.0 (2024-02-07)EnhancementsAddedadd_network_attribute(),add_node_attribute(),add_edge_attribute(),lookup_node_id_by_name()toCX2Networkclass.Added new parameters toget_cx2networkinPandasDataFrameToCX2NetworkFactoryto make it easier to convert Pandas Dataframe.Addedget_nodelist_table()toCX2NetworkPandasDataFrameFactoryclass.3.7.0 (2024-01-03)EnhancementsAddedCX2NetworkXFactoryundercx2.pymodule to convertCX2Networkobject toNetworkX GraphAddedNetworkXToCX2NetworkFactoryundercx2.pymodule to convertNetworkX GraphtoCX2NetworkobjectAddedPandasDataFrameToCX2NetworkFactoryundercx2.pymodule to
convertPandas DataFrametoCX2NetworkobjectAddedCX2NetworkPandasDataFrameFactoryundercx2.pymodule to convertCX2Networkobject toPandas DataFrame3.6.0 (2023-11-14)EnhancementsAddedCX2Networkclass undercx2.pymodule to represent networksCX2 formatAddedRawCX2NetworkFactoryclass undercx2.pyto createCX2NetworkobjectsAddedNoStyleCXToCX2NetworkFactoryclass undercx2.pyto convertNiceCXNetworktoCX2NetworkBug fixesFixed SyntaxWarningsIssue #923.5.1 (2023-04-11)Bug fixesFixed bug wherendex2.create_nice_cx_from_networkx()fails with numpy version 1.24Issue #96Updated post and put calls inclient.pyto only pass credentials if they are
set. This change is to accommodate changes in upcoming version 3 of requests library3.5.0 (2022-06-28)EnhancementsAddedskip_version_checkparameter toNdex2()constructor to let caller
optionally bypass NDEx server call to see ifv2endpoint is supportedAdded the followingCX2methods toNdex2()client:get_network_as_cx2_stream(),get_network_aspect_as_cx2_stream(),save_cx2_stream_as_new_network(),save_new_cx2_network(), andupdate_cx2_network()Issue #87InNdex2()client, methods that raiseNDExErrorexceptions from calls
to NDEx server will now raise the more specificNDExUnauthorizedErrorsubclass when the response from NDEx server is a 401 aka unauthorized.Added new parametersdataconverterandinclude_attributestoNiceCXNetwork.to_pandas_dataframe().dataconverterparameter specifies data type conversion andinclude_attributesparameter lets
caller specify whether all node/edge attributes are added to the resulting DataFrameAdded new parameter tondex2.create_nice_cx_from_server()namedndex_clientthat lets caller specifyNDex2()client object to use.PassingNonefor theserverpositional parameter intondex2.create_nice_cx_from_server(None,uuid='XXXX')will default to the production
NDEx serverBug fixesFixed bug where creation ofNiceCXNetworkfrom networkx viandex2.create_nice_cx_from_networkx()incorrectly set the data type for boolean values to integer.
Issue#83Fixed bug where convertingNiceCXNetworkto networkx and back does not handle
name attribute correctly.Issue #84Fixed bug where@contextwas lost if it was set as aspect in CX format and loaded
into NiceCXNetwork object.Issue #88Fixed bug where creation ofNiceCXNetworkfrom networkx viandex2.create_nice_cx_from_networkx()incorrectly set the data type for empty list to string.
Issue#90Fixed bug where Y coordinates of nodes would be inverted when converting to/from
networkx fromNiceCXNetwork. This was due to differences in coordinate systems
between networkx andNiceCXNetworkDefaultNetworkXFactorynetworkx converter (used byNiceCXNetwork.to_networkx(mode='default'))
no longer converts edge attributes that are of type list into strings delimited by
commasFixed bug wherendex2.create_nice_cx_from_server()failed on networks
withprovenanceHistoryaspectRemovalsRemoved unused test methods from internal classNiceCXBuilder:load_aspect(),stream_aspect(),stream_aspect_raw()Removed the following deprecated methods fromNiceCXNetwork:add_node(),add_edge(),get_edge_attribute_object(),get_node_attribute_objects(),get_edge_attribute_objects(),add_metadata(),get_provenance(),set_provenance(),__merge_node_attributes(),create_from_pandas(),create_from_networkx(),create_from_server(),upload_new_network_stream(), &create_from_cx()3.4.0 (2021-05-06)Addedoffsetandlimitparameters toNdex2.get_network_ids_for_user()to enable
retrieval of all networks for a user.Issue #78SwitchedNiceCXNetwork.upload_to()to named arguments and addedclientparameter.Issue #80SwitchedNiceCXNetwork.update_to()to named arguments and addedclientparameter.Issue #81Fixed documentationNiceCXNetwork.update_to()to correctly state method returns empty
string upon success.Issue #82Fixed bug inNiceCXNetwork.set_opaque_aspect()where passingNonein theaspect_elementsparameter raised an error instead of removing the aspectAddedNdex2.get_user_by_id()method to get user information by NDEx user Id.AddedNdex2.get_id_for_user()method to get NDEx user Id by username.AddedNdex2.get_networksets_for_user_id()to get Network Sets for a given user Id.Issue #61Improved documentation by adding intersphinx to provide links to python documentation for
python objects.3.3.3 (2021-04-22)Fixed bug whereNiceCXNetwork.to_networkx()fails withValueErrorwhen installed
networkx version has X.Y.Z format (example: 2.5.1)Issue #793.3.2 (2021-04-13)Fixed bug whereNiceCXNetwork.create_node()and.create_edge()overwrote existing nodes/edges.Issue #60Fixed bug whereenum34package would be unnecessarily installed on versions of Python 3.4 and newer.Issue #76Improved documentation forNdex2.set_network_properties()method.Issue #773.3.1 (2019-09-23)AddedMANIFEST.infile to includeREADME.rst, HISTORY.rst, and LICENSE.txtfiles as well as documentation and tests sopython setup.py installwill work properly on distribution of this client on PyPI. Thanks to Ben G. for catching this.Issue #62Minor updates toREADME.rst3.3.0 (2019-09-11)Fixed bug where if server version is not 2.0 exactly thenNdex2()object incorrectly falls back to version of 1.3 of REST callsIssue #40Fixed bug inNiceCXNetwork.add_network_attribute()method where type not properly reset when adding duplicate attributeIssue #50Addeddelete_networksets()method to Ndex2 client to allow deletion of networksetsIssue #593.2.0 (2019-04-23)Verify consistent conversion of CX for networkx 1.11 and 2.0+Issue #30NiceCXNetwork.get_nodes(),NiceCXNetwork.get_edges(),NiceCXNetwork.get_metadata()needs to make correct iterator call in Python 2Issue #44AddNiceCXNetwork.get_network_attribute_names()function enhancementIssue #45NiceCXNetwork.create_edge()fails to correctly create edge when node dict passed inIssue #463.1.0a1 (2019-03-20)Add method to ndex2 python client to apply style from one NiceCXNetwork
to another NiceCXNetworkIssue #433.0.0a1 (2019-02-11)In NiceCXNetwork class ability to add to User-Agent for calls to NDEx serviceIssue #36Methods inndex2/client.pyshould raise an NDExError for invalid credentialsIssue #39Add timeout flag to all web request callsIssue #33UpdateUser-Agentto reflect actual version of softwareIssue #35NiceCXNetwork.set_node_attribute()incorrectly handles duplicate attributesIssue #41NiceCXNetwork.set_node_attribute()fails if node object passed to itIssue #42Passing None to user_agent parameterinNdex2()constructor raises TypeErrorIssue #34Ndex2()constructor does not properly handle invalid json from serverIssue #28Eliminate circular import between ndex2 and ndex2cx/nice_cx_builder.pyIssue #31Replace print statements with logging calls inndex2/client.pyIssue #322.0.1 (2019-01-03)Fixed bug where logs directory is created within
the package installation directory.Issue #26