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> 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
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss