RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
TopologicalTorsionGenerator.h
Go to the documentation of this file.
1//
2// Copyright (C) 2018-2022 Boran Adas and other RDKit contributors
3//
4// @@ All Rights Reserved @@
5// This file is part of the RDKit.
6// The contents are covered by the terms of the BSD license
7// which is included in the file license.txt, found at the root
8// of the RDKit source tree.
9//
10
11#include <RDGeneral/export.h>
12#ifndef RD_TOPOLOGICALTORSIONGEN_H_2018_07
13#define RD_TOPOLOGICALTORSIONGEN_H_2018_07
14
17
18namespace RDKit {
19namespace TopologicalTorsion {
20
22 : public FingerprintArguments {
23 public:
24 uint32_t d_torsionAtomCount = 4;
25 bool df_onlyShortestPaths = false;
26
27 std::string infoString() const override;
28
29 /**
30 \brief Construct a new Topological Torsion Arguments object
31
32 \param includeChirality if set, chirality will be used in sparse result
33 \param torsionAtomCount the number of atoms to include in the "torsions"
34 \param useCountSimulation if set, use count simulation while
35 generating the fingerprint
36 \param countBounds boundaries for count simulation, corresponding bit will
37 be set if the count is higher than the number provided for that spot
38 \param fpSize size of the generated fingerprint, does not affect the sparse
39 versions
40 */
42 const bool includeChirality = false, const uint32_t torsionAtomCount = 4,
43 const bool countSimulation = true,
44 const std::vector<std::uint32_t> countBounds = {1, 2, 4, 8},
45 const std::uint32_t fpSize = 2048);
46};
47
48template <typename OutputType>
50 : public AtomEnvironment<OutputType> {
51 const OutputType d_bitId;
52 const INT_VECT d_atomPath;
53
54 public:
55 OutputType getBitId(
56 FingerprintArguments *arguments, // unused
57 const std::vector<std::uint32_t> *atomInvariants, // unused
58 const std::vector<std::uint32_t> *bondInvariants, // unused
59 AdditionalOutput *additionalOutput, // unused
60 const bool hashResults = false, // unused
61 const std::uint64_t fpSize = 0 // unused
62 ) const override;
64 size_t bitId) const override;
65 /**
66 \brief Construct a new Topological Torsion Atom Env object
67
68 \param bitId bitId generated for this environment
69 */
70 TopologicalTorsionAtomEnv(OutputType bitId, INT_VECT atomPath)
71 : d_bitId(bitId), d_atomPath(std::move(atomPath)) {}
72};
73
74template <typename OutputType>
76 : public AtomEnvironmentGenerator<OutputType> {
77 public:
78 std::vector<AtomEnvironment<OutputType> *> getEnvironments(
79 const ROMol &mol, FingerprintArguments *arguments,
80 const std::vector<std::uint32_t> *fromAtoms,
81 const std::vector<std::uint32_t> *ignoreAtoms, const int confId,
82 const AdditionalOutput *additionalOutput,
83 const std::vector<std::uint32_t> *atomInvariants,
84 const std::vector<std::uint32_t> *bondInvariants,
85 const bool hashResults = false) const override;
86
87 std::string infoString() const override;
88 OutputType getResultSize() const override;
89};
90
91/**
92 \brief Get the Topological Torsion Generator object
93
94 \tparam OutputType determines the size of the bitIds and the result, can only
95 be 64 bit unsigned integer for this type
96 \param includeChirality includeChirality argument for both the default atom
97 invariants generator and the fingerprint arguments
98 \param torsionAtomCount the number of atoms to include in the "torsions"
99 \param atomInvariantsGenerator custom atom invariants generator to use
100 \param useCountSimulation if set, use count simulation while
101 generating the fingerprint
102 \param countBounds boundaries for count simulation, corresponding bit will
103 be set if the count is higher than the number provided for that spot
104 \param fpSize size of the generated fingerprint, does not affect the sparse
105 versions
106 \param ownsAtomInvGen if set atom invariants generator is destroyed with the
107 fingerprint generator
108
109 /return FingerprintGenerator<OutputType>* that generates topological-torsion
110 fingerprints
111
112 This generator supports the following \c AdditionalOutput types:
113 - \c atomToBits : which bits each atom is involved in
114 - \c atomCounts : how many bits each atom sets
115 - \c bitPaths : map from bitId to vectors of atom indices
116
117 */
118template <typename OutputType>
123 bool countSimulation = true, std::uint32_t fpSize = 2048,
124 std::vector<std::uint32_t> countBounds = {1, 2, 4, 8},
125 bool ownsAtomInvGen = false);
126//! overload
127template <typename OutputType>
131 const bool ownsAtomInvGen = false);
132} // namespace TopologicalTorsion
133} // namespace RDKit
134
135#endif
abstract base class that generates atom-environments from a molecule
abstract base class that holds atom-environments that will be hashed to generate the fingerprint
abstract base class for atom invariants generators
Abstract base class that holds molecule independent arguments that are common amongst all fingerprint...
class that generates same fingerprint style for different output formats
TopologicalTorsionArguments(const bool includeChirality=false, const uint32_t torsionAtomCount=4, const bool countSimulation=true, const std::vector< std::uint32_t > countBounds={1, 2, 4, 8}, const std::uint32_t fpSize=2048)
Construct a new Topological Torsion Arguments object.
std::string infoString() const override
method that returns information string about the fingerprint specific argument set and the arguments ...
void updateAdditionalOutput(AdditionalOutput *output, size_t bitId) const override
TopologicalTorsionAtomEnv(OutputType bitId, INT_VECT atomPath)
Construct a new Topological Torsion Atom Env object.
OutputType getBitId(FingerprintArguments *arguments, const std::vector< std::uint32_t > *atomInvariants, const std::vector< std::uint32_t > *bondInvariants, AdditionalOutput *additionalOutput, const bool hashResults=false, const std::uint64_t fpSize=0) const override
calculates and returns the bit id to be set for this atom-environment
std::string infoString() const override
method that returns information about this /c AtomEnvironmentGenerator and its arguments if any
OutputType getResultSize() const override
Returns the size of the fingerprint based on arguments.
std::vector< AtomEnvironment< OutputType > * > getEnvironments(const ROMol &mol, FingerprintArguments *arguments, const std::vector< std::uint32_t > *fromAtoms, const std::vector< std::uint32_t > *ignoreAtoms, const int confId, const AdditionalOutput *additionalOutput, const std::vector< std::uint32_t > *atomInvariants, const std::vector< std::uint32_t > *bondInvariants, const bool hashResults=false) const override
generate and return all atom-envorinments from a molecule
#define RDKIT_FINGERPRINTS_EXPORT
Definition export.h:177
RDKIT_FINGERPRINTS_EXPORT FingerprintGenerator< OutputType > * getTopologicalTorsionGenerator(bool includeChirality=false, uint32_t torsionAtomCount=4, AtomInvariantsGenerator *atomInvariantsGenerator=nullptr, bool countSimulation=true, std::uint32_t fpSize=2048, std::vector< std::uint32_t > countBounds={1, 2, 4, 8}, bool ownsAtomInvGen=false)
Get the Topological Torsion Generator object.
Std stuff.
std::vector< int > INT_VECT
Definition types.h:291
bool rdvalue_is(const RDValue_cast_t)