NDEx Jupyter Notebook Tutorials
This repository contains tutorials and code examples to work with networks using the ndex2
Python client and NiceCX object class.
The tutorials require Python 3.6+ and the ndex2
module . See the ndex2 GitHub repo for installation instructions.
ndex2 Client v2.0 Tutorial
In this tutorial you will learn to use the ndex2
Python client. It is a module that simplifies access to the NDEx
Server API and provides convenience methods for common operations on networks.
Style and Edit an NDEx Network
This notebook shows how to:
- Load a network from
NDEx
- Copy and apply a visual style from an existing template in
NDEx
- Save (upload) the modified network to your
NDEx
account - Apply a layout
- Save (update) the modified network to your
NDEx
account
Edit an NDEx Network Using NetworkX and Save as a New Network
This notebook shows how to:
- download a network from
NDEx
as aNiceCX
network - make a
networkxGraph()object
via the to_networkx(mode='default') method - display the networkx network
- remove 0 degree nodes
- create a new
NiceCX
network from the modified networkx network - upload the new network to NDEx.
Find Subgraphs of NDEx Networks with Neighborhood Queries
This notebook shows how to find subgraphs of NDEx networks based on queries in which a list of strings is applied to a network. The result returned is a CX
network containing nodes whose names match one of the strings and nodes that are "nearby" in the network, the "neighborhood" subgraph. A common use for these queries is to find subgraphs of an interactome based on a list of gene names.
Five Ways to Create NiceCX networks
This notebook shows how to create a NiceCX
network from:
- An Empty Network
- A CX File
- An NDEx Networks
- A NetworkX Network
- A Pandas DataFrame
Using NDEx Network Sets
Network Sets
are used to group networks. They are essentially sets of "bookmarks", where a network can belong to many different sets, created by different users. This notebook shows how to:
- Get a network set
- Operate on the networks in a set
- Create a network set
- Add a network to a set
- Remove a network from a set
- Rename a network set
- Delete a network set
Access Node, Edge, and Network Attributes in NiceCX
This notebook shows how to access the elements of the NiceCX
network object.
Protocol 3: Working with NDEx Networks in Python
This notebook shows how to perform simple operations on networks stored in NDEx
, using the ndex2
client and NiceCX
class. This notebook is part of the publication: "NDEx: Accessing Network Models and Streamlining Network Biology Workflows" (Curr Protoc. 2021 Sep;1(9):e258. doi: 10.1002/cpz1.258).
Create an NDEx Network with Data Extracted from PubMed
In this notebook, we show how to extract information from PubMed records using the Element Tree XML
API, organize it in a Pandas
dataframe and save it to NDEx
as a network. The starting point of the notebook is a short list of PubMed IDs (PMIDS), so this example doesn't include any code to query the PubMed API.
How to Reset Continuous Mappings in an NDEx Network using py4cytoscape
This notebook shows how to reset the values used in a continuous mapping to match the actual range of values in the data rather then using the range of values present in the style template. This is achieved by using py4cytoscape
to control the Cytoscape
desktop application.