Class DistanceMoment

  • public class DistanceMoment
    extends Object
    Fast similarity measure for 3D structures. This class implements a fast descriptor based 3D similarity measure described by Ballester et al ([Bellester, P.J. and Richards, W.G. . Journal of Computational Chemistry. 2007. 28]). The approach calculates the distances of each atom to four specific points: the centroid of the molecule, the atom that is closest to the centroid, the atom that is farthest from the centroid and the atom that is farthest from the previous atom. Thus we get 4 sets of distance distributions. The final descriptor set is generated by evaluating the first three moments of each distance distribution. The similarity between two molecules is then evaluated using the inverse of a normalized Manhattan type metric. This class allows you to evaluate the 3D similarity between two specified molecules as well as generate the 12 descriptors used to characterize the 3D structure which can then be used for a variety of purposes such as storing in a database. Note: The methods of this class do not perform hydrogen removal. If you want to do the calculations excluding hydrogens, you'll need to do it yourself. Also, if the molecule has disconnected components, you should consider one (usually the largest), otherwise all components are considered in the calculation.
    Rajarshi Guha
    Source code:
    Belongs to CDK module:
    similarity, 3D, manhattan
    Created on:
    • Constructor Detail

      • DistanceMoment

        public DistanceMoment()
    • Method Detail

      • generateMoments

        public static float[] generateMoments​(IAtomContainer atomContainer)
                                       throws CDKException
        Evaluate the 12 descriptors used to characterize the 3D shape of a molecule.
        atomContainer - The molecule to consider, should have 3D coordinates
        A 12 element array containing the descriptors.
        CDKException - if there are no 3D coordinates
      • calculate

        public static float calculate​(IAtomContainer query,
                                      IAtomContainer target)
                               throws CDKException
        Evaluate the 3D similarity between two molecules. The method does not remove hydrogens. If this is required, remove them from the molecules before passing them here.
        query - The query molecule
        target - The target molecule
        The similarity between the two molecules (ranging from 0 to 1)
        CDKException - if either molecule does not have 3D coordinates