/usr/include/rdkit/GraphMol/Canon.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 | //
// Copyright (C) 2004-2006 Rational Discovery LLC
//
// @@ 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.
//
#ifndef _RD_CANON_H_
#define _RD_CANON_H_
#include <boost/tuple/tuple.hpp>
#include <boost/dynamic_bitset.hpp>
namespace RDKit {
class ROMol;
class Atom;
class Bond;
namespace Canon {
const int MAX_NATOMS=5000; //!< used in the canonical traversal code
const int MAX_CYCLES=1000; //!< used in the canonical traversal code
const int MAX_BONDTYPE=32; //!< used in the canonical traversal code
//! used in traversals of the molecule
typedef enum {
WHITE_NODE=0, //! not visited
GREY_NODE, //! visited, but not finished
BLACK_NODE, //! visited and finished
} AtomColors;
//! used to indicate types of entries in the molecular stack:
typedef enum {
MOL_STACK_ATOM=0, //!< an Atom
MOL_STACK_BOND, //!< a Bond
MOL_STACK_RING, //!< a ring closure
MOL_STACK_BRANCH_OPEN, //!< beginning of a branch
MOL_STACK_BRANCH_CLOSE, //!< end of a branch
} MolStackTypes;
//! used to store components in the molecular stack
typedef union{
Atom *atom;
Bond *bond;
} MolStackUnion;
//! these are the actual elements in the molecular stack
class MolStackElem {
public:
//! construct an Atom node
explicit MolStackElem(Atom *at) {
type = MOL_STACK_ATOM;
obj.atom = at;
};
//! construct a bond node
/*!
\param bond pointer to the Bond being added
\param idx index of the Atom traversed before this Bond
(beginAtom in the canonical traversal order)
*/
explicit MolStackElem(Bond *bond,int idx) {
type = MOL_STACK_BOND;
obj.bond = bond;
number = idx;
};
//! construct for a ring closure
explicit MolStackElem(int idx) {
type = MOL_STACK_RING;
number = idx;
};
//! construct for a branch opening or closing
explicit MolStackElem(const char *chr,int idx) {
switch(chr[0]){
case '(':
type = MOL_STACK_BRANCH_OPEN;
break;
case ')':
type = MOL_STACK_BRANCH_CLOSE;
break;
default:
break;
}
number=idx;
}
MolStackTypes type; //!< stores the type of node
MolStackUnion obj; //!< holds our pointer (if appropriate)
int number; //!< stores our number (relevant for bonds and ring closures)
};
typedef std::vector<MolStackElem> MolStack;
//! used to represent possible branches from an atom
typedef boost::tuple<int,int,Bond *> PossibleType;
//! constructs the canonical traversal order for a molecular fragment
/*!
\param mol the ROMol we're working on
\param atomIdx the index of the atom to start the traversal from
\param colors the traversal status of each atom in \c mol
\param ranks the assigned rank of each atom in \c mol
\param molStack the current traversal stack (used to return the results)
<b>Notes</b>
- \c mol will, in general, be modified by this operation as bond directions
and the like are changed to fit the canonical traversal order
*/
void canonicalizeFragment(ROMol &mol,int atomIdx,
std::vector<AtomColors> &colors,
const std::vector<unsigned int> &ranks,
MolStack &molStack,
const boost::dynamic_bitset<> *bondsInPlay=0,
const std::vector<std::string> *bondSymbols=0,
bool doIsomericSmiles=false);
} // end of namespace Canon
} // end of namespace RDKit
#endif
|