USRCATを実装してみる 修正

各分子の最安定構造のモーメントと
発生させた配座郡のシミラリティ計算になるようにした。

from rdkit import Chem
from rdkit.Chem import AllChem
from usrcat import sim
from usrcat.toolkits.rd import generate_moments
import sys

#mols = [Chem.AddHs(m) for m in Chem.SDMolSupplier(sys.argv[1])]

mols = [Chem.AddHs(m) for m in
        Chem.SDMolSupplier("first_200.props.sdf")]

LEConf_Mols = []
count=0
for m in mols:
    cids=AllChem.EmbedMultipleConfs(m)
    energylist = []
    for cid in cids:
        AllChem.UFFOptimizeMolecule(m, confId=cid)
        ff=AllChem.UFFGetMoleculeForceField(m, confId=cid)
        ff.Minimize()
        e=ff.CalcEnergy()
        energylist.append(e)
    min_id =energylist.index(min(energylist))    
    LEConf = m.GetConformer(min_id)
    LEConf_Mol = LEConf.GetOwningMol()
    LEConf_Mols.append(LEConf_Mol)

    count+=1
    print count,min_id, energylist[min_id]

momentslist=[]
for mol in mols:
    moments = generate_moments(mol)
    momentslist.append(moments)
print len(momentslist)

count = 0
for LEConf_Mol in LEConf_Mols:
    m1 = generate_moments(LEConf_Mol)
    for m2 in momentslist:
        similarity=sim.similarity(m1,m2)
        if similarity[1] >= 0.6:
            print  similarity
    print count
    count += 1
print "finished"            


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