Cytoscape and MMP

I posted an example about cytoscape.js using molecular similarity.
Cytoscape.js is cool but not good for lots of data. I tried to make network that has 1000 nodes. My PC freeze….
So I go back to cytoscape.
Today I made network from mmpa data for example.
If you had rdkit, make mmp is very easy.
First, I got sample data from Chembl (Jak3 inh.) as tsv.
For rdkit, file format must be, smiles id.
Let’s make it.
I used PANDAS for do it.

import pandas as pd
datatab = pd.read_table("bioactivity-14_7-19-38.txt", header=0)
smi = datatab[[u'CANONICAL_SMILES', u'CMPD_CHEMBLID']]
smi.to_csv("smiles.smi", header=False, index=False)

Then make fragment file from smiles.
MMPA scripts are $RDBASE/Contrib/mmp .

iwatobipen$ wc bioactivity-14_7-19-38.txt 
     829   51884  448065 bioactivity-14_7-19-38.txt # 829 mols in this file.
iwatobipen$ time python ../ < smiles.smi > frag.smi

real	3m50.721s
user	3m49.754s
sys	0m0.388s

iwatobipen$ wc frag.smi 
   42031   42031 6558703 frag.smi # 42031 frags made!

Next, make pair.

iwatobipen$ time python ../ < frag.smi > jak3_mmp.csv

real	0m31.788s
user	0m31.074s

sys	0m0.120s
iwatobipen$ wc jak3_mmp.csv 
    8466    8466 1729873 jak3_mmp.csv # Just done!

I got pair files jak3_mmp.csv.

I got mmp-csv file. Cytoscape can read this file.
So , from cytoscape, new network from file and SMILES_OF_LEFT_MMP as source, SMILES_OF_RIGHT_MMP as target.
Then layout set organic.
I used ChemViz to convert smiles to structure.
Screen Shot 2014-09-15 at 10.09.58 PM

Screen Shot 2014-09-15 at 10.11.08 PM

It’s easy to add node attribute(ex, activity, target, mol prop. etc…) and make your custom view using vizmapper.
I upload sample file to github.
Be careful, this example code is incomplete, because this code ignore molecule that has no pair (singletone).

Leave a Reply

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

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

Google photo

You are commenting using your Google 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.