Other graph formats interface¶
PyViPR uses NetworkX functions and cytoscape.js extensions to enable the visualization of the following graph formats:
nx.Graph, nx.DiGraph, nx.MultiDiGraph
GRAPHML
SIF
SBGN XML
GEXF
GML
YAML
CYTOSCAPE JSON
Networkx graph¶
[1]:
import networkx as nx
import pyvipr.network_viz as nviz
from pyvipr.util_networkx import network_dynamic_data
[2]:
G = nx.Graph()
G.add_edge(1, 2)
e = (2, 3)
G.add_edge(*e) # unpack edge tuple*
node_rel = {1:[50, 100, 0],
2:[50, 100, 0],
3:[50, 100, 0]}
edge_colors = {(1,2):['#2b913a', '#2b913a', '#2b913a'],
(2, 3):['#2b913a', '#2b913a', '#2b913a'],
(1, 3):['#2b913a', '#2b913a', '#2b913a']}
[3]:
nviz.nx_graph_dyn_view(G, tspan=[1,2,3], node_rel=node_rel,
edge_colors=edge_colors, layout_name='fcose')
GRAPHML format¶
[4]:
nviz.graphml_view('graphs_formats/graphml_example2.graphml', layout_name='fcose')
SBGN XML format¶
[6]:
nviz.sbgn_xml_view('graphs_formats/activated_stat1alpha_induction_of_the_irf1_gene.xml', layout_name='fcose')