Dear Noel,

just a few problems I am stuck with, using this procedure:

- SetRef() and SetTarget() need a vector of vector3 objects as argument. While vector3 is an OpenBabel class, vector is not (I assume it is the C++ vector?). How do I feed them a vector? Is a python list going to be fine?

- The match to the SMARTS is to exclude from the alignment, so did I get it right if the one below is the procedure to do it, or is there a SMARTer (sorry, the pun was too tempting) way? Although this seems similar to the old (non-working) way.

ob = pybel.ob
smarts = pybel.Smarts("[OH]C=O")

atomlist = []
for i in smarts.findall(mol):
    for j in i:
        atomlist.append(j),
for atom in mol:
    if atom.OBAtom.GetIdx() not in atomlist:
        reference.append(atom.vector)

ob.OBAlign().SetTarget(reference)
...

- Why ob.OBAlign().GetRMSD() should not work after using ob.OBAlign().Align() with this procedure? I am not sure why shall I apply the rotation matrix.

Thanks a lot for your help!
Best,
Pepe


On 30/05/14 19:46, Noel O'Boyle wrote:
Try using SetRef() and SetTarget() instead with just the coordinates for the atoms you want to align (in the same order for both, as given by the match to the Smarts). Afterwards, if you want the RMSD for the whole molecule, you can manually calculate the whole molecule RMSD by translating one of the molecules to its centroid and applying the rotation matrix. (I can explain more if this is confusing.)

- Noel


On 24 May 2014 13:14, Giulio Pepe <gp...@cam.ac.uk <mailto:gp...@cam.ac.uk>> wrote:

    Hi there,

    I am building a script in python that removes a certain moiety
    from two
    molecules and calculates the RMSD between the remaining structure.

    I am doing this by asking for one or more SMARTS strings to find
    in the
    molecules, labelling these atoms and deleting them using
    OBMol.DeleteAtom(). Then, I align the molecules and find the RMSD
    using
    the OBAlign() class.

    This works fine for some SMARTS string, but for others it gives a very
    high and unrealistic RMSD value. I investigated the reason for
    this and
    I found out that this is caused by a bad alignment of the two
    molecules.
    I suspect that this is caused by a disordering of the atom labels
    caused
    by removing certain SMARTS strings. I tested this by printing the
    canonical labels.

    I tried to renumber the atoms using OBMol.RenumberAtoms(),
    unsuccessfully. Symmetry should not be a problem in these molecules.

    Did anyone come across this, or have a better solution? I am
    attaching a
    simplified version of my code below:


    import pybel
    ob = pybel.ob

    mol = [mola,molb]
    smarts = [pybel.Smarts("[OH]C=O"),pybel.Smarts("C=C(C#N)C(=O)O")]

    for mols in mol:
         mols.OBMol.StripSalts()
         mols.removeh()

    if removemoiety:

         for ligands in smarts:

             i = 0
             todelete = []
             for mols in mol:
                 todelete.append([])
                 for atom in mols:
                     for l in ligands.findall(mol[i]):
                         if atom.OBAtom.GetIdx() in l:
                             todelete[i].append(atom.OBAtom)
                 i += 1

             j = 0
             for mols in todelete:
                 for atom in mols:
                     mol[j].OBMol.DeleteAtom(atom)
                 j += 1


    align = ob.OBAlign()
    align.SetRefMol(mol[0].OBMol)
    align.SetTargetMol(mol[1].OBMol)
    align.Align()
    print align.GetRMSD()


    Thank you very much for your help!

    Best,
    Pepe

    
------------------------------------------------------------------------------
    "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
    Instantly run your Selenium tests across 300+ browser/OS combos.
    Get unparalleled scalability from the best Selenium testing
    platform available
    Simple to use. Nothing to install. Get started now for free."
    http://p.sf.net/sfu/SauceLabs
    _______________________________________________
    OpenBabel-discuss mailing list
    OpenBabel-discuss@lists.sourceforge.net
    <mailto:OpenBabel-discuss@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/openbabel-discuss



--
PhD Student

Structure and Dynamics
University of Cambridge
Department of Physics
Cavendish Laboratory
J J Thomson Avenue
CB3 0HE, UK

Tel: +44 (0) 1223 337011 (Room 425)
Fax: +44 (0) 1223 350266
e-mail: gp...@cam.ac.uk
web: www.giuliopepe.com

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to