Molassembler  1.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Interpret.h
Go to the documentation of this file.
1 
11 #ifndef INCLUDE_MOLASSEMBLER_INTERPRET_H
12 #define INCLUDE_MOLASSEMBLER_INTERPRET_H
13 
14 #include "Molassembler/Export.h"
15 #include "boost/optional.hpp"
16 #include <vector>
17 
18 
19 namespace Scine {
20 namespace Utils {
21 
22 // External forward-declarations
23 enum class ElementType : unsigned;
24 class AtomCollection;
25 class BondOrderCollection;
26 using ElementTypeCollection = std::vector<ElementType>;
27 } // namespace Utils
28 
29 namespace Molassembler {
30 
31 // Forward-declarations
32 class Molecule;
33 class Graph;
34 class AngstromPositions;
35 
37 namespace Interpret {
38 
40 enum class MASM_EXPORT BondDiscretizationOption {
42  Binary,
45 };
46 
48 struct MASM_EXPORT ComponentMap {
51  unsigned component;
53  unsigned long atomIndex;
54  };
55 
57  ComponentIndexPair apply(unsigned index) const;
59  unsigned invert(const ComponentIndexPair& pair) const;
60 
61 
67  std::vector<
68  std::vector<unsigned>
69  > invert() const;
70 
79  std::vector<Utils::AtomCollection> apply(const Utils::AtomCollection& atomCollection) const;
80 
82  inline unsigned size() const { return map.size(); }
83 
86  using Iterator = std::vector<unsigned>::iterator;
87  using ConstIterator = std::vector<unsigned>::const_iterator;
88  inline Iterator begin() { return std::begin(map); }
89  inline Iterator end() { return std::end(map); }
90  inline ConstIterator begin() const { return std::begin(map); }
91  inline ConstIterator end() const { return std::end(map); }
93 
94  std::vector<unsigned> map;
95 };
96 
98 struct MASM_EXPORT MoleculesResult {
100  std::vector<Molecule> molecules;
103 };
104 
123 MASM_EXPORT MoleculesResult molecules(
124  const Utils::ElementTypeCollection& elements,
125  const AngstromPositions& angstromWrapper,
126  const Utils::BondOrderCollection& bondOrders,
127  BondDiscretizationOption discretization = BondDiscretizationOption::Binary,
128  const boost::optional<double>& stereopermutatorThreshold = 1.4
129 );
130 
150 MASM_EXPORT MoleculesResult molecules(
151  const Utils::ElementTypeCollection& elements,
152  const AngstromPositions& angstromWrapper,
153  BondDiscretizationOption discretization = BondDiscretizationOption::Binary,
154  const boost::optional<double>& stereopermutatorThreshold = 1.4
155 );
156 
180 MASM_EXPORT MoleculesResult molecules(
181  const Utils::AtomCollection& atomCollection,
182  const Utils::BondOrderCollection& bondOrders,
183  BondDiscretizationOption discretization = BondDiscretizationOption::Binary,
184  const boost::optional<double>& stereopermutatorThreshold = 1.4
185 );
186 
210 MASM_EXPORT MoleculesResult molecules(
211  const Utils::AtomCollection& atomCollection,
212  BondDiscretizationOption discretization = BondDiscretizationOption::Binary,
213  const boost::optional<double>& stereopermutatorThreshold = 1.4
214 );
215 
217 struct MASM_EXPORT GraphsResult {
219  std::vector<Graph> graphs;
222 };
223 
240 MASM_EXPORT GraphsResult graphs(
241  const Utils::ElementTypeCollection& elements,
242  const AngstromPositions& angstromWrapper,
243  const Utils::BondOrderCollection& bondOrders,
244  BondDiscretizationOption discretization = BondDiscretizationOption::Binary
245 );
246 
265 MASM_EXPORT GraphsResult graphs(
266  const Utils::AtomCollection& atomCollection,
267  const Utils::BondOrderCollection& bondOrders,
268  BondDiscretizationOption discretization = BondDiscretizationOption::Binary
269 );
270 
273  unsigned i;
274  unsigned j;
275  double probability;
276 
277  inline bool operator < (const FalsePositive& other) const {
278  return probability < other.probability;
279  }
280 };
281 
292 std::vector<FalsePositive> uncertainBonds(
293  const Utils::AtomCollection& atomCollection,
294  const Utils::BondOrderCollection& bondOrders
295 );
296 
311 std::vector<FalsePositive> badHapticLigandBonds(
312  const Utils::AtomCollection& atomCollection,
313  const Utils::BondOrderCollection& bondOrders
314 );
315 
322  const Utils::AtomCollection& atoms,
323  const Utils::BondOrderCollection bonds
324 );
325 
326 } // namespace Interpret
327 } // namespace Molassembler
328 } // namespace Scine
329 
330 #endif
MoleculesResult molecules(const Utils::ElementTypeCollection &elements, const AngstromPositions &angstromWrapper, const Utils::BondOrderCollection &bondOrders, BondDiscretizationOption discretization=BondDiscretizationOption::Binary, const boost::optional< double > &stereopermutatorThreshold=1.4)
The function that actually does all the work with the library-internal wrapper.
Result type of an interpret call.
Definition: Interpret.h:98
BondDiscretizationOption
How floating-point bond orders are discretized into bond types.
Definition: Interpret.h:40
A wrapper class around Utils&#39; PositionCollection to emphasize that the positions stored therein are i...
Definition: AngstromPositions.h:25
std::vector< Graph > graphs
Individual graphs found.
Definition: Interpret.h:219
Bond orders are rounded to the nearest integer.
std::vector< Molecule > molecules
The list of individual molecules found in the 3D information.
Definition: Interpret.h:100
std::vector< FalsePositive > badHapticLigandBonds(const Utils::AtomCollection &atomCollection, const Utils::BondOrderCollection &bondOrders)
Suggests false positive haptic ligand bonds from a binary interpretation of bond orders.
ComponentMap componentMap
A map from an index within the AtomCollection to its index in molecules member.
Definition: Interpret.h:102
ComponentMap componentMap
Mapping from atom collection index to graph component index.
Definition: Interpret.h:221
All bond orders &gt;= 0.5 are considered single bonds.
unsigned long atomIndex
Atom index.
Definition: Interpret.h:53
Type used to represent a map from an atom collection index to an interpreted object.
Definition: Interpret.h:48
constexpr auto map(const ArrayType< T, size > &array, UnaryFunction &&function)
Maps all elements of any array-like container with a unary function.
Definition: Containers.h:62
unsigned component
Index of component.
Definition: Interpret.h:51
unsigned size() const
Size of the map.
Definition: Interpret.h:82
Result type of a graph interpret call.
Definition: Interpret.h:217
Fn result datatype.
Definition: Interpret.h:272
GraphsResult graphs(const Utils::ElementTypeCollection &elements, const AngstromPositions &angstromWrapper, const Utils::BondOrderCollection &bondOrders, BondDiscretizationOption discretization=BondDiscretizationOption::Binary)
The function that actually does all the work with the library-internal wrapper.
Utils::BondOrderCollection removeFalsePositives(const Utils::AtomCollection &atoms, const Utils::BondOrderCollection bonds)
Iteratively applies false positive detection schemes.
std::vector< FalsePositive > uncertainBonds(const Utils::AtomCollection &atomCollection, const Utils::BondOrderCollection &bondOrders)
Suggests false positives from a binary interpretation of bond orders.