RDKit: TautomerCatalogParams.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
TautomerCatalogParams.h
Go to the documentation of this file.
1//
2// Copyright (C) 2018-2021 Susan H. Leung 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#include <RDGeneral/export.h>
11#ifndef RD_TAUTOMER_CATALOG_PARAMS_H
12#define RD_TAUTOMER_CATALOG_PARAMS_H
13
14#include <Catalogs/CatalogParams.h>
15#include <GraphMol/RDKitBase.h>
16#include <string>
17#include <vector>
18
19namespace RDKit {
20class ROMol;
21
22namespace MolStandardize {
23
24 using TautomerTransformDefs =
25 std::vector<std::tuple<std::string, std::string, std::string, std::string>>;
26
27 namespace defaults {
28 RDKIT_MOLSTANDARDIZE_EXPORT extern const TautomerTransformDefs
29 defaultTautomerTransforms;
30 RDKIT_MOLSTANDARDIZE_EXPORT extern const TautomerTransformDefs
31 defaultTautomerTransformsv1;
32} // namespace defaults
33
34 class RDKIT_MOLSTANDARDIZE_EXPORT TautomerTransform {
35 public:
36 ROMol *Mol = nullptr;
37 std::vector<Bond::BondType> BondTypes;
38 std::vector<int> Charges;
39
40 TautomerTransform(ROMol *mol, std::vector<Bond::BondType> bondtypes,
41 std::vector<int> charges)
42 : Mol(mol),
43 BondTypes(std::move(bondtypes)),
44 Charges(std::move(charges)) {}
45
46 TautomerTransform(const TautomerTransform &other)
47 : BondTypes(other.BondTypes), Charges(other.Charges) {
48 Mol = new ROMol(*other.Mol);
49 }
50
51 TautomerTransform &operator=(const TautomerTransform &other) {
52 if (this != &other) {
53 delete Mol;
54 Mol = new ROMol(*other.Mol);
55 BondTypes = other.BondTypes;
56 Charges = other.Charges;
57 }
58 return *this;
59 }
60
61 ~TautomerTransform() { delete Mol; }
62};
63
64 class RDKIT_MOLSTANDARDIZE_EXPORT TautomerCatalogParams
65 : public RDCatalog::CatalogParams {
66 public:
67 TautomerCatalogParams() {
68 d_typeStr = "Tautomer Catalog Parameters";
69 d_transforms.clear();
70 }
71
72 TautomerCatalogParams(const std::string &tautomerFile);
73 TautomerCatalogParams(const TautomerTransformDefs &data);
74 // copy constructor
75 TautomerCatalogParams(const TautomerCatalogParams &other);
76
77 ~TautomerCatalogParams() override;
78
79 const std::vector<TautomerTransform> &getTransforms() const;
80
81 const TautomerTransform getTransform(unsigned int fid) const;
82
83 void toStream(std::ostream &) const override;
84 std::string Serialize() const override;
85 void initFromStream(std::istream &ss) override;
86 void initFromString(const std::string &text) override;
87
88 private:
89 // std::vector<std::pair<ROMol*, ROMol*>> d_pairs;
90 std::vector<TautomerTransform> d_transforms;
91
92}; // class TautomerCatalogParams
93
94} // namespace MolStandardize
95} // namespace RDKit
96
97#endif
CatalogParams.h
RDKitBase.h
pulls in the core RDKit functionality
RDCatalog::CatalogParams
abstract base class for the container used to create a catalog
Definition CatalogParams.h:18
RDCatalog::CatalogParams::d_typeStr
std::string d_typeStr
our type string
Definition CatalogParams.h:38
RDKit::MolStandardize::TautomerCatalogParams::Serialize
std::string Serialize() const override
returns a string with a serialized (pickled) representation
RDKit::MolStandardize::TautomerCatalogParams::getTransform
const TautomerTransform getTransform(unsigned int fid) const
RDKit::MolStandardize::TautomerCatalogParams::~TautomerCatalogParams
~TautomerCatalogParams() override
RDKit::MolStandardize::TautomerCatalogParams::TautomerCatalogParams
TautomerCatalogParams()
Definition TautomerCatalogParams.h:67
RDKit::MolStandardize::TautomerCatalogParams::initFromStream
void initFromStream(std::istream &ss) override
initializes from a stream pickle
RDKit::MolStandardize::TautomerCatalogParams::TautomerCatalogParams
TautomerCatalogParams(const std::string &tautomerFile)
RDKit::MolStandardize::TautomerCatalogParams::initFromString
void initFromString(const std::string &text) override
initializes from a string pickle
RDKit::MolStandardize::TautomerCatalogParams::TautomerCatalogParams
TautomerCatalogParams(const TautomerTransformDefs &data)
RDKit::MolStandardize::TautomerCatalogParams::toStream
void toStream(std::ostream &) const override
serializes (pickles) to a stream
RDKit::MolStandardize::TautomerCatalogParams::TautomerCatalogParams
TautomerCatalogParams(const TautomerCatalogParams &other)
RDKit::MolStandardize::TautomerCatalogParams::getTransforms
const std::vector< TautomerTransform > & getTransforms() const
RDKit::MolStandardize::TautomerTransform
Definition TautomerCatalogParams.h:34
RDKit::MolStandardize::TautomerTransform::TautomerTransform
TautomerTransform(ROMol *mol, std::vector< Bond::BondType > bondtypes, std::vector< int > charges)
Definition TautomerCatalogParams.h:40
RDKit::MolStandardize::TautomerTransform::Charges
std::vector< int > Charges
Definition TautomerCatalogParams.h:38
RDKit::MolStandardize::TautomerTransform::TautomerTransform
TautomerTransform(const TautomerTransform &other)
Definition TautomerCatalogParams.h:46
RDKit::MolStandardize::TautomerTransform::Mol
ROMol * Mol
Definition TautomerCatalogParams.h:36
RDKit::MolStandardize::TautomerTransform::BondTypes
std::vector< Bond::BondType > BondTypes
Definition TautomerCatalogParams.h:37
RDKit::MolStandardize::TautomerTransform::~TautomerTransform
~TautomerTransform()
Definition TautomerCatalogParams.h:61
RDKit::MolStandardize::TautomerTransform::operator=
TautomerTransform & operator=(const TautomerTransform &other)
Definition TautomerCatalogParams.h:51
RDKit::ROMol
Definition ROMol.h:199
export.h
RDKIT_MOLSTANDARDIZE_EXPORT
#define RDKIT_MOLSTANDARDIZE_EXPORT
Definition export.h:369
RDKit::MolStandardize::defaults
Definition TautomerCatalogParams.h:27
RDKit::MolStandardize::defaults::defaultTautomerTransforms
RDKIT_MOLSTANDARDIZE_EXPORT const TautomerTransformDefs defaultTautomerTransforms
RDKit::MolStandardize::defaults::defaultTautomerTransformsv1
RDKIT_MOLSTANDARDIZE_EXPORT const TautomerTransformDefs defaultTautomerTransformsv1
RDKit::MolStandardize
Definition AcidBaseCatalogEntry.h:22
RDKit::MolStandardize::TautomerTransformDefs
std::vector< std::tuple< std::string, std::string, std::string, std::string > > TautomerTransformDefs
Definition TautomerCatalogParams.h:24
RDKit
Std stuff.
Definition Abbreviations.h:19