Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _RD_CANON_H_
00011 #define _RD_CANON_H_
00012
00013 namespace RDKit {
00014 class ROMol;
00015 class Atom;
00016 class Bond;
00017 };
00018
00019 namespace Canon {
00020 const int MAX_NATOMS=5000;
00021 const int MAX_CYCLES=99;
00022
00023
00024 typedef enum {
00025 WHITE_NODE=0,
00026 GREY_NODE,
00027 BLACK_NODE,
00028 } AtomColors;
00029
00030
00031 typedef enum {
00032 MOL_STACK_ATOM=0,
00033 MOL_STACK_BOND,
00034 MOL_STACK_RING,
00035 MOL_STACK_BRANCH_OPEN,
00036 MOL_STACK_BRANCH_CLOSE,
00037 } MolStackTypes;
00038
00039
00040 typedef union{
00041 RDKit::Atom *atom;
00042 RDKit::Bond *bond;
00043 } MolStackUnion;
00044
00045
00046 class MolStackElem {
00047 public:
00048
00049 explicit MolStackElem(RDKit::Atom *at) {
00050 type = MOL_STACK_ATOM;
00051 obj.atom = at;
00052 };
00053
00054
00055
00056
00057
00058
00059
00060 explicit MolStackElem(RDKit::Bond *bond,int idx) {
00061 type = MOL_STACK_BOND;
00062 obj.bond = bond;
00063 number = idx;
00064 };
00065
00066 explicit MolStackElem(int idx) {
00067 type = MOL_STACK_RING;
00068 number = idx;
00069 };
00070
00071 explicit MolStackElem(const char *chr,int idx) {
00072 switch(chr[0]){
00073 case '(':
00074 type = MOL_STACK_BRANCH_OPEN;
00075 break;
00076 case ')':
00077 type = MOL_STACK_BRANCH_CLOSE;
00078 break;
00079 default:
00080 break;
00081 }
00082 number=idx;
00083 }
00084 MolStackTypes type;
00085 MolStackUnion obj;
00086 int number;
00087 };
00088 typedef std::vector<MolStackElem> MolStack;
00089
00090
00091
00092 typedef std::pair< int, std::pair< int, RDKit::Bond * > > PossibleType;
00093
00094 PossibleType makePossible(int rank,int atomIdx,RDKit::Bond *bond);
00095
00096 int _possibleComp(const PossibleType &arg1,const PossibleType &arg2);
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 void canonicalizeFragment(RDKit::ROMol &mol,int atomIdx,
00113 std::vector<AtomColors> &colors,
00114 std::vector<int> &ranks,
00115 MolStack &molStack);
00116
00117 };
00118
00119 #endif