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)
datatab.columns
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 ../rfrag.py < 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 ../indexing.py < 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.
This file has some field, SMILES_OF_LEFT_MMP,SMILES_OF_RIGHT_MMP,ID_OF_LEFT_MMP,ID_OF_RIGHT_MMP,SMIRKS_OF_TRANSFORMATION,SMILES_OF_CONTEXT.

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. https://github.com/iwatobipen/mmp_example.
Be careful, this example code is incomplete, because this code ignore molecule that has no pair (singletone).

広告

コメントを残す

以下に詳細を記入するか、アイコンをクリックしてログインしてください。

WordPress.com ロゴ

WordPress.com アカウントを使ってコメントしています。 ログアウト / 変更 )

Twitter 画像

Twitter アカウントを使ってコメントしています。 ログアウト / 変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト / 変更 )

Google+ フォト

Google+ アカウントを使ってコメントしています。 ログアウト / 変更 )

%s と連携中