Hi all,

I would like to generate the Murcko framework for a library.
CDK should be able to do this, but the code should be updated and the
function is currently not fully usable - if I understood well.
If anybody is aware of an other solution...?

So, I'm beginning to do a script with pybel. First, I just want to
remove atoms which have only one neighbour.

If there less than 2 neighbours, I do this:

for atom in ob.OBMolAtomIter(mol.OBMol):
        (...)
        if (neighborsCount <= 1):
            mol.OBMol.DeleteAtom(atom)

But it scans only 13 atoms, with 2 atom deleted, instead of 14 in the
test molecule (and theorically 3 deletion).
If I don't delete atoms, all is doing well (i.e., it scans all 14 atoms).
Any advice for doing it in the right manner?

Full code below, Open Babel 2.2.3.
Smiles used:
c1(n(c2c(cccc2)o1)C[C@@H](N)C)=O        ART12966845

Thanks,
Regards,
Pascal



#!/usr/bin/env python
# encoding: utf-8

import sys
import os, pybel
import openbabel as ob

def main():
        if len(sys.argv) < 2:
                print "No input file provided: Murcko.py filetosprocess.ext"
                sys.exit(1)
        for mol in pybel.readfile(sys.argv[1].split('.')[1], sys.argv[1]):
                mol.OBMol.DeleteHydrogens()
                atomCount = 0
                for atom in ob.OBMolAtomIter(mol.OBMol):
                        atomCount = atomCount + 1
                print "Atom count:", atomCount
                atomCount = 0
                for atom in ob.OBMolAtomIter(mol.OBMol):
                        atomCount = atomCount + 1
                        if not atom.IsInRing():
                                neighborsCount = 0
                                for neighbor in ob.OBAtomAtomIter(atom):
                                        neighborsCount = neighborsCount + 1
                                if (neighborsCount <= 1):
                                        print "Idx:", atom.GetIdx(), "Type:", 
atom.GetType(),"Deleted"
                                        mol.OBMol.DeleteAtom(atom)
                print "Atom count:", atomCount
                smilesMurcko = mol.write("smi")
                print "Current smiles:",  smilesMurcko

if __name__ == '__main__':
        main()

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
OpenBabel-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to