pandas and vincent

Matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms.
But, sometime it is difficult to build maplotlib.

So, I used vincent instead of matplotlib.

It is easy to build vincent, because you can use pip or easy_install. Also It can download from github.

Example….
I used ipython notebook.
“vincent.core.initialize_notebook()” is useful for visualise chart.

from rdkit import Chem
from rdkit.Chem import PandasTools
import pandas as pd
import vincent
vincent.core.initialize_notebook()

OK let’s load SDF.
RDKit has SDMolSupplier module, but I used PadasTools.


mol_df = PandasTools.LoadSDF("cmpd_download_5053.sdf")
from rdkit.Chem import Descriptors

#########################
#use lambda function
#And calc. Molwt and LogP
#########################
wt = lambda mol : Descriptors.MolWt(mol)
logp = lambda mol : Descriptors.MolLogP( mol )
mol_df["molwt"] = mol_df.ROMol.map(wt)
mol_df["mollogp"] = mol_df.ROMol.map(logp)
hoge=pd.DataFrame(mol_df, columns = ["molwt","mollogp"])
hoge.describe()

Screen Shot 2013-10-23 at 11.16.43 PM

Next, Try to make Scatter plot.

scatter = vincent.Scatter(hoge ,iter_idx="molwt")
scatter.display()

Screen Shot 2013-10-23 at 11.19.00 PM

The data capabilities of Python. The visualization capabilities of JavaScript.
RDKit, Pandas and vincent are power full tools.

Advertisements

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 )

Google+ photo

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

Connecting to %s