Code Monkey home page Code Monkey logo

py2cytoscape's Introduction

py2cytoscape

Build Status

Tools to use Cytoscape and Cytoscape.js from Python

Status

  • 9/1/2015: Version 0.5.0 release. View utilities added.
  • 6/27/2014: Version 0.4.3 release. Minor update version for Python 3.4.x.
  • 6/26/2014: Version 0.4.2 release. Confirmed to work with cyREST 1.1.0.
  • 6/23/2014: Version 0.4.1 release. Graph utility modules have been updated.
  • 6/4/2014: Version 0.4.0 release. This is still in alpha.

What is py2cytoscape?

py2cytoscape is a collection of utilities to use Cytoscape and Cytoscape.js from Python. Network visualization feature is still limited in Python, but with this tool, you can access both of Cytoscape and Cytoscape.js as network visualization engines for your Python code!

This package is still experimental and in alpha status.

Background

Cytoscape is a de-facto standard desktop application for network visualization in bioinformatics community. But actually, it is a domain-independent graph visualization software for all typs of network data analysis. We want to introduce cy2cytoscape, along with cyREST and Jupyter Notebook, to broader data science community.

Installation

We recommend that you install most of the py2cytoscape dependent packages with Miniconda Python package manager.

Mac

~/miniconda2/bin/conda install scipy pandas networkx jupyter
~/miniconda2/bin/pip install py2cytoscape

Windows

conda install scipy pandas networkx jupyter

Next download python-igraph whl file from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and

pip install THE_PYTHON_IGRAPH.whl

Finally,

pip install py2cytoscape

Features

cyREST Wrapper (New from 0.4.0)

cyREST is a language-agnostic RESTful API for Cytoscape 3. Of course you can drive Cytoscape by calling raw RESTful API using requests or other http client library, but with this wrapper, you can significantly reduce your lines of code.

Example: Creating an empty network in Cytoscape from Python

Without py2cytoscape (raw cyREST API call)
# HTTP Client for Python
import requests

# Standard JSON library
import json

# Basic Setup
PORT_NUMBER = 1234
BASE = 'http://localhost:' + str(PORT_NUMBER) + '/v1/'

# Header for posting data to the server as JSON
HEADERS = {'Content-Type': 'application/json'}

# Define dictionary of empty network
empty_network = {
        'data': {
            'name': 'I\'m empty!'
        },
        'elements': {
            'nodes':[],
            'edges':[]
        }
}

res = requests.post(BASE + 'networks?collection=My%20Collection', data=json.dumps(empty_network), headers=HEADERS)
new_network_id = res.json()['networkSUID']
print('Empty network created: SUID = ' + str(new_network_id))
With py2cytoscape
from py2cytoscape.data.cyrest_client import CyRestClient

cy = CyRestClient()
network = cy.network.create(name='My Network', collection='My network collection')
print(network.get_id())

Embedded Visualization Widget for Jupyter Notebook

You can use Cytoscape.js network visualization widget in Jupyter Notebook. This is particulaly useful when you share your network analysis results with others.

Data Conversion Utilities from/to Cytoscape.js JSON

Cytoscape.js JSON is one of the standard data exchange formats in Cytoscape community. py2cytoscape includes some graph data conversion utilities for popular graph analysis packages in Python.

Currently, the following graph objects are supported:

And these popular libraries will be supported soon:

py2cytoscape's People

Contributors

keiono avatar kozo2 avatar scholer avatar

Stargazers

 avatar

Watchers

 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.