Make graph with python

Visualization of data is very important.
Some years ago, I was interested in cytoscape to visualize molecular network (a.k.a. similarity, MMP, etc.).
But it was difficult to integrate python script.
Today, I found cool python library “d3py”.
It can get from github ;-). “https://github.com/mikedewar/d3py
This library can make any graphs easy like ggplot, vincent and also can make network using networkx.
I found good example.
Code is following….

import d3py
import networkx as nx
G=nx.Graph()
G.add_edge(1,2)
G.add_edge(1,3)
G.add_edge(3,2)
G.add_edge(3,4)
G.add_edge(4,2)
p = d3py.NetworkXFigure(G, name="graph", width="200",height="200")
p = d3py.NetworkXFigure(G, name="graph", width=200,height=200)
p += d3py.ForceLayout()
p.css['.node'] = {'fill':'blue', 'stroke': 'magenta'
p.show()

type p.show() commnad, or run the script, local server was started and you can get intaractive graph.
graph

That’s nice.
So, How about make mmp network using this library and supply data for MedChem ?
Node measns each molecule, and edge means transform.It was very easy to coding.

I think it was very interesting, but for other chemist Hmm :-( .

Published by iwatobipen

I'm medicinal chemist in mid size of pharmaceutical company. I love chemoinfo, cording, organic synthesis, my family.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: