Coder Social home page Coder Social logo

alenzhao / visjs2jupyter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ucsd-ccbb/visjs2jupyter

0.0 1.0 0.0 1.76 MB

visJS2jupyter is a tool to bring the interactivity of networks created with vis.js into jupyter notebook cells

License: MIT License

Jupyter Notebook 93.76% Python 6.24%

visjs2jupyter's Introduction

visJS2jupyter

visJS2jupyter is a tool to bring the interactivity of networks created with vis.js into jupyter notebook cells, authored by members of the UCSD Center for Computational Biology & Bioinformatics

For full documentation of the tool, see https://ucsd-ccbb.github.io/visJS2jupyter/

Getting Started

These instructions will get you a copy of the package up and running on your local machine.

Prerequisites

You must have Jupyter notebook already installed. Visit here for more information.

Install matplotlib before using visJS2jupyter. Visit here for more information.

To use the visualizations module, install networkX and py2cytoscape:

pip install networkx
pip install py2cytoscape

Installing

visJS2jupyter supports both Python 2.7 and 3.4.

You can install visJS2jupyter using pip:

pip install visJS2jupyter

In your Jupyter notebook, first import matplotlib:

import matplotlib

To import visJS_module, use the following:

import visJS2jupyter.visJS_module

To import visualizations, use the following:

import visJS2jupyter.visualizations

Features and Examples

A simple use example with default parameters may be found here http://bl.ocks.org/brinrosenthal/raw/cfb0e12f113d55551a45d530527baedf/. In the example provided, we show how to display a graph created with NetworkX using visJS2jupyter. The networks displayed within Jupyter notebook cells may be dragged, clicked, and hovered on, and zooming is enabled within the window.

For an example of how more complex styles may be added to a network, see http://bl.ocks.org/brinrosenthal/raw/658325f6e0db7419625a31c883313e9b/. Nodes and edges may be styled with properties available from vis.js networks (see http://visjs.org/docs/network/ for a list and description of properties). The main function is 'visjs_network', which requires two inputs which describe the nodes and edges in the network- 'nodes_dict', and edges_dict'. The other arguments are optional, and apply general styles to the graph, such as sizes, highlight colors, and physics properties of the graph.

An interactive use example of visJS2jupyter may be found here (scroll to the bottom to see the network). In this example, we display the bipartite network composed of diseases in The Cancer Genome Atlas and the top 25 most common mutations in each disease. We also overlay information about drugs which target those mutations. Genes which have a drug targeting them are displayed with a bold black outline. The user may hover over each gene to get a list of associated drugs.

Visualizations

Supplementary module, containing frequently used network visualizations

  1. draw_graph_overlap takes in two graphs and displays their overlap. Intersecting nodes are triangles and non-intersecting nodes are either circles or squares, depending on which graph they belong to. An interactive example may be found here. In this example, we graph the union of two networks of 10 nodes each. The user can hover over each node to see the graph it belongs to and the node name.

  2. draw_heat_prop simulates heat propagation on the network initialized from a given set of seed nodes. It takes in a graph and a list of seed nodes. An interactive example may be found here.

  3. draw_colocalization similarly draws the heat propagation of the graph but with two sets of seed nodes. Another interactive example can be found here.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

visjs2jupyter's People

Contributors

brinrosenthal avatar julialen avatar m1webste avatar

Watchers

Alen Zhao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.