RDCode: AtomPairs.h Source File

# AtomPairs.h

Go to the documentation of this file.

    00001 //
    00002 //  Copyright (C) 2007-2008 Greg Landrum
    00003 //
    00004 //   @@ All Rights Reserved  @@
    00005 //
    00006
    00007 /*! \file AtomPairs.h
    00008
    00009   \brief Use MolDescriptors.h in client code.
    00010
    00011 */
    00012 #ifndef __RD_ATOMPAIRS_H__
    00013 #define __RD_ATOMPAIRS_H__
    00014
    00015 #include <DataStructs/SparseIntVect.h>
    00016 #include <boost/cstdint.hpp>
    00017 namespace RDKit {
    00018   class Atom;
    00019
    00020   namespace Descriptors {
    00021     namespace AtomPairs {
    00022       const std::string atomPairsVersion="1.0.0";
    00023       const unsigned int numTypeBits=4;
    00024       const unsigned int atomNumberTypes[1<<numTypeBits]={5,6,7,8,9,14,15,16,17,33,34,35,51,52,43};
    00025       const unsigned int numPiBits=2;
    00026       const unsigned int maxNumPi=(1<<numPiBits)-1;
    00027       const unsigned int numBranchBits=3;
    00028       const unsigned int maxNumBranches=(1<<numBranchBits)-1;
    00029       const unsigned int codeSize=numTypeBits+numPiBits+numBranchBits;
    00030       const unsigned int numPathBits=5;
    00031       const unsigned int maxPathLen=(1<<numPathBits)-1;
    00032       const unsigned int numAtomPairFingerprintBits=numPathBits+2*codeSize;
    00033
    00034       //! returns a numeric code for the atom (the atom's hash in the
    00035       //! atom-pair scheme)
    00036       /*!
    00037         \param atom            the atom to be considered
    00038         \param branchSubtract  (optional) a constant to subtract from
    00039                                the number of neighbors when the hash
    00040                                is calculated (used in the topological
    00041                                torsions code)
    00042       */
    00043       boost::uint32_t getAtomCode(const Atom *atom,unsigned int branchSubtract=0);
    00044
    00045       //! returns an atom pair hash based on two atom hashes and the
    00046       //! distance between the atoms.
    00047       /*!
    00048         \param codeI  the hash for the first atom
    00049         \param codeJ  the hash for the second atom
    00050         \param dist   the distance (number of bonds) between the two
    00051                       atoms
    00052        */
    00053       boost::uint32_t getAtomPairCode(boost::uint32_t codeI,boost::uint32_t codeJ,
    00054                                       unsigned int dist);
    00055
    00056       //! returns the atom-pair fingerprint for a molecule
    00057       /*!
    00058         The algorithm used is described here:
    00059         R.E. Carhart, D.H. Smith, R. Venkataraghavan; "Atom Pairs as
    00060           Molecular Features in Structure-Activity Studies: Definition
    00061           and Applications" JCICS 25, 64-73 (1985).
    00062
    00063
    00064         \param mol:   the molecule to be fingerprinted
    00065         \return a pointer to the fingerprint. The client is
    00066                 responsible for calling delete on this.
    00067
    00068        */
    00069       SparseIntVect<boost::int32_t> *getAtomPairFingerprint(const ROMol &mol);
    00070
    00071       //! returns an topological torsion hash based on the atom hashes
    00072       //! passed in
    00073       /*!
    00074         \param atomCodes  the vector of atom hashes
    00075        */
    00076       boost::uint64_t getTopologicalTorsionCode(const std::vector<boost::uint32_t> &atomCodes);
    00077
    00078       //! returns the topological-torsion fingerprint for a molecule
    00079       /*!
    00080         The algorithm used is described here:
    00081         R. Nilakantan, N. Bauman, J. S. Dixon, R. Venkataraghavan;
    00082         "Topological Torsion: A New Molecular Descriptor for SAR Applications.
    00083         Comparison with Other Descriptors" JCICS 27, 82-85 (1987).
    00084
    00085         \param mol:         the molecule to be fingerprinted
    00086         \param targetSize:  the number of atoms to include in the torsions
    00087
    00088         \return a pointer to the fingerprint. The client is
    00089                 responsible for calling delete on this.
    00090
    00091        */
    00092       SparseIntVect<boost::int64_t > *getTopologicalTorsionFingerprint(const ROMol &mol,
    00093                                                                         unsigned int targetSize=4);
    00094     }
    00095   } // end of namespace Descriptors
    00096 }
    00097
    00098 #endif