User 677b9c22ff
07-12-2009 23:41:27
Hi,
is there an RMSD number output possible for the chemaxon.marvin.alignment.Alignment procedure?
Similar to:
SuperPose Mols with QuatFit V0.091
RMSD of the seleced coordinates: 2.0049278041672443
http://www.chemaxon.com/forum/ftopic4318.html
This is what I used
package examples;
import chemaxon.marvin.plugin.PluginException;
import chemaxon.formats.MolImporter;
import chemaxon.marvin.alignment.Alignment;
import chemaxon.struc.Molecule;
import chemaxon.util.MolHandler;
// http://www.chemaxon.com/marvin/help/developer/beans/api/chemaxon/marvin/alignment/Alignment.html
/>// http://www.chemaxon.com/forum/ftopic4318.html
/>// API example Adrian Kalaszi
public class SuperPoseNew {
public static void main(String[] args) throws PluginException {
System.out.println("SuperPose Mols with Marvin Alignment");
try {
// API example Adrian Kalaszi
Molecule[] mols = new Molecule[2];
mols[0] = MolImporter.importMol("CCCCC");
mols[1] = MolImporter.importMol("CCCCCCC");
mols[0].aromatize();
mols[1].aromatize();
mols[0].clean(3, null);
mols[1].clean(3, null);
Alignment aa = new Alignment();
aa.setRigidPreAlignOnly(false); //If true faster but less precise. Default is false.
aa.setDisableAuto(false); //If true align using user defined atom pairs only. Default is false.
aa.removeAllConstraints();
aa.removeAllMolecules();
//setConvergenceLimit is used as the "Accuracy" in the msketch plugin GUI.
//Low: 1e-1, Normal 1e-3, High: 1e-5, Very high 1e-8
aa.setConvergenceLimit(1e-3); // default is normal
aa.setTimeLimit(10); // time limit int nanosecond, by default this is -1, means time limit is off
aa.addMolecule(mols[0], false); // adds molecule
aa.addMolecule(mols[1], false);
aa.addConstraint(0, 3, 1, 4); // optional: add user constraint between atoms of two different molecules. Any constraint can be added
Molecule result = aa.align();
System.out.println("Finished.");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Would it be useful to have such a number also attached to the MView or MSketch Window, after alignment?
Or any number or measurement output?
Thank you!
Tobias
ChemAxon 1b9e90b2e7
08-12-2009 17:18:07
Hi Tobias,
yes, there are such possibilities in the marvin 5.3 codetree. Both the rmsd and the volume Tanimoto similarity can be calculated.
Download 5.3 aplha from here:
http://www.chemaxon.com/download.php?d=/data/download/marvin/devel/
and check sjars\plugins\Alignment.jar.
The chemaxon.marvin.alignment.Alignment is designed for general use both for flexible and for rigid alignment and even for more than 2 molecules. The other main difference is that Alignment does not requests user added atompairs although optionally can be added. This class has a method called getVolumeTanimoto() that can be used only between two molecules only also in the case when there are no user added atompairs. This Tanimoto ranges between 0..1 just like normal Tanimoto similarity. Thank you for the hint: I will add getRmsd() to Alignment soon.
Until than there is the chemaxon.marvin.alignment.PairedAlign that does the rmsd calculation for you. The name "paired" is given while the user is expected to give the atom pairs between the two molecules to align. Two classes implement the PairedAlign interface: chemaxon.marvin.alignment.RigidAlignment and chemaxon.marvin.alignment.FlexibleAlignment. They have the same API. This API is subjected to change in marvin 5.3.1 that is why I have not made its APIdoc public.
Example code:
Molecule mRef = null; // get the molecule from somewhere
Molecule mRot = null;
PairedAlign p;
boolean rigid = true; // or false
if (rigid) {
// This is for rigid alignment.
//"mRef" is the reference molecule that is kept in the original position.
p = new RigidAlignment(mRef);
} else {
// This is flexible alignment.
// If the second parameter is false mRef is kept flexible if true than rigid
p = new FlexibleAlignment(mRef, true);
}
p.setMoleculeToAlign(mRot);
//add pairs where you want
for (int i = 0; i < m.getAtomCount(); i++) {
p.addPair(i, i); // params: atom seq from mRef, atom seq from mRot
}
p.align();
System.out.println("rmsd: " + p.getRmsd());
Molecule result = p.getAlignedMolecule();
Hope this helps.
Cheers,
Adrian
User 677b9c22ff
09-12-2009 18:06:14
Hello Adrian,
thank you for the explanation. That really helps.
Tobias
ChemAxon 990acf0dec
25-02-2010 14:07:03
Hi Tobias,
I would like to inform you that we had to make an urgent patch release that was named 5.3.1, therefore the API change promised in this topic will be included only in the patch release coming at the end of March (probably named 5.3.2).
Best regards,
Akos