/usr/include/rdkit/GraphMol/Fingerprints/AtomPairs.h is in librdkit-dev 201503-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | //
// Copyright (C) 2007-2013 Greg Landrum
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
/*! \file AtomPairs.h
A few quick notes about fingerprint size and the way chirality is handled in these functions.
By default the atom-pair and topologic-torsion fingerprints do not include any information about
chirality; the atom invariants only include information about the atomic number,
number of pi electrons, and degree.
When chirality is included, two additional bits are added to the atom invariants to flag R/S/no
chirality. These additional bits change the size of the atom invariants and either the size
of the final fingerprint (atom pairs) or the maximum allowed path length (torsions). This means
that even fingerprints for achiral molecules are different when includeChirality is true.
*/
#ifndef __RD_ATOMPAIRS_H__
#define __RD_ATOMPAIRS_H__
#include <DataStructs/SparseIntVect.h>
#include <DataStructs/BitVects.h>
#include <boost/cstdint.hpp>
namespace RDKit {
class Atom;
namespace AtomPairs {
const std::string atomPairsVersion="1.1.0";
const unsigned int numTypeBits=4;
const unsigned int atomNumberTypes[1<<numTypeBits]={5,6,7,8,9,14,15,16,17,33,34,35,51,52,43};
const unsigned int numPiBits=2;
const unsigned int maxNumPi=(1<<numPiBits)-1;
const unsigned int numBranchBits=3;
const unsigned int maxNumBranches=(1<<numBranchBits)-1;
const unsigned int numChiralBits=2;
const unsigned int codeSize=numTypeBits+numPiBits+numBranchBits;
const unsigned int numPathBits=5;
const unsigned int maxPathLen=(1<<numPathBits)-1;
const unsigned int numAtomPairFingerprintBits=numPathBits+2*codeSize; // note that this is only accurate if chirality is not included
//! returns a numeric code for the atom (the atom's hash in the
//! atom-pair scheme)
/*!
\param atom the atom to be considered
\param branchSubtract (optional) a constant to subtract from
the number of neighbors when the hash
is calculated (used in the topological
torsions code)
\param includeChirality toggles the inclusions of bits indicating R/S chirality
*/
boost::uint32_t getAtomCode(const Atom *atom,unsigned int branchSubtract=0,bool includeChirality=false);
//! returns an atom pair hash based on two atom hashes and the
//! distance between the atoms.
/*!
\param codeI the hash for the first atom
\param codeJ the hash for the second atom
\param dist the distance (number of bonds) between the two
atoms
\param includeChirality toggles the inclusions of bits indicating R/S chirality
*/
boost::uint32_t getAtomPairCode(boost::uint32_t codeI,boost::uint32_t codeJ,
unsigned int dist,bool includeChirality=false);
//! returns the atom-pair fingerprint for a molecule
/*!
The algorithm used is described here:
R.E. Carhart, D.H. Smith, R. Venkataraghavan; "Atom Pairs as
Molecular Features in Structure-Activity Studies: Definition
and Applications" JCICS 25, 64-73 (1985).
\param mol: the molecule to be fingerprinted
\param minLength: minimum distance between atoms to be
considered in a pair. Default is 1 bond.
\param maxLength: maximum distance between atoms to be
considered in a pair.
Default is maxPathLen-1 bonds.
\param fromAtoms: if provided, only atom pairs that involve
the specified atoms will be included in the
fingerprint
\param ignoreAtoms: if provided, any atom pairs that include
the specified atoms will not be included in the
fingerprint
\param atomInvariants: a list of invariants to use for the atom hashes
note: only the first \c codeSize bits of each
invariant are used.
\param includeChirality: if set, chirality will be used in the atom invariants
(note: this is ignored if atomInvariants are provided)
\param use2D: if set, the 2D (topological) distance matrix is used.
\param confId: the conformation to use if 3D distances are being used
\return a pointer to the fingerprint. The client is
responsible for calling delete on this.
*/
SparseIntVect<boost::int32_t> *
getAtomPairFingerprint(const ROMol &mol,
unsigned int minLength,unsigned int maxLength,
const std::vector<boost::uint32_t> *fromAtoms=0,
const std::vector<boost::uint32_t> *ignoreAtoms=0,
const std::vector<boost::uint32_t> *atomInvariants=0,
bool includeChirality=false,
bool use2D=true,
int confId=-1);
//! \overload
SparseIntVect<boost::int32_t> *
getAtomPairFingerprint(const ROMol &mol,
const std::vector<boost::uint32_t> *fromAtoms=0,
const std::vector<boost::uint32_t> *ignoreAtoms=0,
const std::vector<boost::uint32_t> *atomInvariants=0,
bool includeChirality=false,
bool use2D=true,
int confId=-1);
//! returns the hashed atom-pair fingerprint for a molecule
/*!
\param mol: the molecule to be fingerprinted
\param nBits: the length of the fingerprint to generate
\param minLength: minimum distance between atoms to be
considered in a pair. Default is 1 bond.
\param maxLength: maximum distance between atoms to be
considered in a pair.
Default is maxPathLen-1 bonds.
\param fromAtoms: if provided, only atom pairs that involve
the specified atoms will be included in the
fingerprint
\param ignoreAtoms: if provided, any atom pairs that include
the specified atoms will not be included in the
fingerprint
\param atomInvariants: a list of invariants to use for the atom hashes
note: only the first \c codeSize bits of each
invariant are used.
\param includeChirality: if set, chirality will be used in the atom invariants
(note: this is ignored if atomInvariants are provided)
\param use2D: if set, the 2D (topological) distance matrix is used.
\return a pointer to the fingerprint. The client is
responsible for calling delete on this.
*/
SparseIntVect<boost::int32_t> *
getHashedAtomPairFingerprint(const ROMol &mol,
unsigned int nBits=2048,
unsigned int minLength=1,
unsigned int maxLength=maxPathLen-1,
const std::vector<boost::uint32_t> *fromAtoms=0,
const std::vector<boost::uint32_t> *ignoreAtoms=0,
const std::vector<boost::uint32_t> *atomInvariants=0,
bool includeChirality=false,
bool use2D=true,
int confId=-1);
//! returns the hashed atom-pair fingerprint for a molecule as a bit vector
/*!
\param mol: the molecule to be fingerprinted
\param nBits: the length of the fingerprint to generate
\param minLength: minimum distance between atoms to be
considered in a pair. Default is 1 bond.
\param maxLength: maximum distance between atoms to be
considered in a pair.
Default is maxPathLen-1 bonds.
\param fromAtoms: if provided, only atom pairs that involve
the specified atoms will be included in the
fingerprint
\param ignoreAtoms: if provided, any atom pairs that include
the specified atoms will not be included in the
fingerprint
\param atomInvariants: a list of invariants to use for the atom hashes
note: only the first \c codeSize bits of each
invariant are used.
\param nBitsPerEntry: number of bits to use in simulating counts
\param includeChirality: if set, chirality will be used in the atom invariants
(note: this is ignored if atomInvariants are provided)
\param use2D: if set, the 2D (topological) distance matrix is used.
\param confId: the conformation to use if 3D distances are being used
\return a pointer to the fingerprint. The client is
responsible for calling delete on this.
*/
ExplicitBitVect *
getHashedAtomPairFingerprintAsBitVect(const ROMol &mol,
unsigned int nBits=2048,
unsigned int minLength=1,
unsigned int maxLength=maxPathLen-1,
const std::vector<boost::uint32_t> *fromAtoms=0,
const std::vector<boost::uint32_t> *ignoreAtoms=0,
const std::vector<boost::uint32_t> *atomInvariants=0,
unsigned int nBitsPerEntry=4,
bool includeChirality=false,
bool use2D=true,
int confId=-1);
//! returns an topological torsion hash based on the atom hashes
//! passed in
/*!
\param atomCodes the vector of atom hashes
*/
boost::uint64_t getTopologicalTorsionCode(const std::vector<boost::uint32_t> &atomCodes,bool includeChirality=false);
//! returns the topological-torsion fingerprint for a molecule
/*!
The algorithm used is described here:
R. Nilakantan, N. Bauman, J. S. Dixon, R. Venkataraghavan;
"Topological Torsion: A New Molecular Descriptor for SAR Applications.
Comparison with Other Descriptors" JCICS 27, 82-85 (1987).
\param mol: the molecule to be fingerprinted
\param targetSize: the number of atoms to include in the "torsions"
\param fromAtoms: if provided, only torsions that start or end at
the specified atoms will be included in the
fingerprint
\param ignoreAtoms: if provided, any torsions that include
the specified atoms will not be included in the
fingerprint
\param atomInvariants: a list of invariants to use for the atom hashes
note: only the first \c codeSize bits of each
invariant are used.
\param includeChirality: if set, chirality will be used in the atom invariants
(note: this is ignored if atomInvariants are provided)
\return a pointer to the fingerprint. The client is
responsible for calling delete on this.
*/
SparseIntVect<boost::int64_t > *
getTopologicalTorsionFingerprint(const ROMol &mol,
unsigned int targetSize=4,
const std::vector<boost::uint32_t> *fromAtoms=0,
const std::vector<boost::uint32_t> *ignoreAtoms=0,
const std::vector<boost::uint32_t> *atomInvariants=0,
bool includeChirality=false
);
//! returns a hashed topological-torsion fingerprint for a molecule
/*!
The algorithm used is described here:
R. Nilakantan, N. Bauman, J. S. Dixon, R. Venkataraghavan;
"Topological Torsion: A New Molecular Descriptor for SAR Applications.
Comparison with Other Descriptors" JCICS 27, 82-85 (1987).
\param mol: the molecule to be fingerprinted
\param nBits: number of bits to include in the fingerprint
\param targetSize: the number of atoms to include in the "torsions"
\param fromAtoms: if provided, only torsions that start or end at
the specified atoms will be included in the
fingerprint
\param ignoreAtoms: if provided, any torsions that include
the specified atoms will not be included in the
fingerprint
\param atomInvariants: a list of invariants to use for the atom hashes
note: only the first \c codeSize bits of each
invariant are used.
\param includeChirality: if set, chirality will be used in the atom invariants
(note: this is ignored if atomInvariants are provided)
\return a pointer to the fingerprint. The client is
responsible for calling delete on this.
*/
SparseIntVect<boost::int64_t > *
getHashedTopologicalTorsionFingerprint(const ROMol &mol,
unsigned int nBits=2048,
unsigned int targetSize=4,
const std::vector<boost::uint32_t> *fromAtoms=0,
const std::vector<boost::uint32_t> *ignoreAtoms=0,
const std::vector<boost::uint32_t> *atomInvariants=0,
bool includeChirality=false);
//! returns a hashed topological-torsion fingerprint for a molecule as a bit vector
/*!
\param mol: the molecule to be fingerprinted
\param nBits: number of bits to include in the fingerprint
\param targetSize: the number of atoms to include in the "torsions"
\param fromAtoms: if provided, only torsions that start or end at
the specified atoms will be included in the
fingerprint
\param ignoreAtoms: if provided, any torsions that include
the specified atoms will not be included in the
fingerprint
\param atomInvariants: a list of invariants to use for the atom hashes
note: only the first \c codeSize bits of each
invariant are used.
\param nBitsPerEntry: number of bits to use in simulating counts
\param includeChirality: if set, chirality will be used in the atom invariants
(note: this is ignored if atomInvariants are provided)
\return a pointer to the fingerprint. The client is
responsible for calling delete on this.
*/
ExplicitBitVect *
getHashedTopologicalTorsionFingerprintAsBitVect(const ROMol &mol,
unsigned int nBits=2048,
unsigned int targetSize=4,
const std::vector<boost::uint32_t> *fromAtoms=0,
const std::vector<boost::uint32_t> *ignoreAtoms=0,
const std::vector<boost::uint32_t> *atomInvariants=0,
unsigned int nBitsPerEntry=4,
bool includeChirality=false);
}
}
#endif
|