Chemical Data Processing Library C++ API - Version 1.2.0
ProtonationStateStandardizer.hpp
Go to the documentation of this file.
1 /*
2  * ProtonationStateStandardizer.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_CHEM_PROTONATIONSTATESTANDARDIZER_HPP
30 #define CDPL_CHEM_PROTONATIONSTATESTANDARDIZER_HPP
31 
32 #include <cstddef>
33 #include <vector>
34 #include <unordered_set>
35 #include <memory>
36 
37 #include "CDPL/Chem/APIPrefix.hpp"
40 #include "CDPL/Util/BitSet.hpp"
41 #include "CDPL/Util/Array.hpp"
42 
43 
44 namespace CDPL
45 {
46 
47  namespace Chem
48  {
49 
50  class Molecule;
51  class ChEMBLStandardizer;
52 
57  {
58 
59  public:
60  typedef std::shared_ptr<ProtonationStateStandardizer> SharedPointer;
61 
62  enum Flavor
63  {
64 
67  MAX_CHARGE_COMPENSATION
68  };
69 
71 
73 
74  bool standardize(Molecule& mol, Flavor flavor);
75 
76  bool standardize(const Molecule& mol, Molecule& std_mol, Flavor flavor);
77 
79 
80  private:
81  friend class ChEMBLStandardizer;
82 
83  typedef std::vector<Chem::Atom*> AtomList;
84 
85  void copyMolecule(const Molecule& mol, Molecule& mol_copy) const;
86 
87  bool minChargedAtomCount(Molecule& mol);
88  bool protForPhysCond(Molecule& mol);
89  bool maxChargeComp(Molecule& mol);
90 
91  const Chem::Atom* getAtomWithMappingID(const Molecule& ptn, std::size_t id) const;
92 
93  std::size_t adaptHydrogenCount(Atom& atom, Molecule& mol, long h_delta) const;
94 
95  std::size_t calcFreeValence(const Atom& atom) const;
96 
97  long calcNetCharge(const Atom& atom) const;
98 
99  std::size_t calcValenceExcess(const Atom& atom) const;
100 
101  std::size_t getMatches(const Molecule& ptn, const Molecule& mol, AtomList& matches);
102 
103  bool incrementCharge(Atom& atom, bool checked) const;
104 
105  bool isRemovableHydrogen(const Atom& atom) const;
106 
107  bool cmpCanonicalNumber(const Atom* atom1, const Atom* atom2) const;
108 
109  bool removeConnectedHydrogens(const AtomList& atoms, Molecule& mol) const;
110 
111  typedef std::unordered_set<const Atom*> AtomSet;
112 
113  SubstructureSearch substructSearch;
114  CanonicalNumberingCalculator canonNumberingCalc;
115  AtomList atomList;
116  AtomList posChargedAtoms;
117  AtomList posChargedNoHAtoms;
118  AtomList negChargedAtoms;
119  AtomList negChargedAcidAtoms;
120  Util::STArray canonAtomNumbering;
121  Util::BitSet atomMask;
122  AtomSet atomSet;
123  };
124  } // namespace Chem
125 } // namespace CDPL
126 
127 #endif // CDPL_CHEM_PROTONATIONSTATESTANDARDIZER_HPP
Definition of the class CDPL::Util::Array.
Definition of the type CDPL::Util::BitSet.
Definition of the class CDPL::Chem::CanonicalNumberingCalculator.
Definition of the preprocessor macro CDPL_CHEM_API.
#define CDPL_CHEM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of the class CDPL::Chem::SubstructureSearch.
Atom.
Definition: Atom.hpp:52
CanonicalNumberingCalculator.
Definition: CanonicalNumberingCalculator.hpp:67
Implementation of the ChEMBL structure preprocessing pipeline.
Definition: ChEMBLStandardizer.hpp:65
Molecule.
Definition: Molecule.hpp:49
Sets the protation state of molecules according to desired objectives.
Definition: ProtonationStateStandardizer.hpp:57
Flavor
Definition: ProtonationStateStandardizer.hpp:63
@ MIN_CHARGED_ATOM_COUNT
Definition: ProtonationStateStandardizer.hpp:65
@ PHYSIOLOGICAL_CONDITION_STATE
Definition: ProtonationStateStandardizer.hpp:66
bool standardize(const Molecule &mol, Molecule &std_mol, Flavor flavor)
ProtonationStateStandardizer & operator=(const ProtonationStateStandardizer &standardizer)
ProtonationStateStandardizer(const ProtonationStateStandardizer &standardizer)
bool standardize(Molecule &mol, Flavor flavor)
std::shared_ptr< ProtonationStateStandardizer > SharedPointer
Definition: ProtonationStateStandardizer.hpp:60
SubstructureSearch.
Definition: SubstructureSearch.hpp:64
Array< std::size_t > STArray
An array of unsigned integers of type std::size_t.
Definition: Array.hpp:567
boost::dynamic_bitset BitSet
A dynamic bitset class.
Definition: BitSet.hpp:46
The namespace of the Chemical Data Processing Library.