1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
//
// Copyright (C) 2018-2021 Susan H. Leung and other RDKit contributors
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
/*! \file MolStandardize.h
\brief Defines the CleanupParameters and some convenience functions.
*/
#include <RDGeneral/export.h>
#ifndef RD_MOLSTANDARDIZE_H
#define RD_MOLSTANDARDIZE_H
#include <string>
#include <GraphMol/RDKitBase.h>
namespace RDKit {
class RWMol;
class ROMol;
namespace MolStandardize {
//! The CleanupParameters structure defines the default parameters for the
/// cleanup process and also allows the user to customize the process by
/// changing the parameters.
/*!
<b>Notes:</b>
- To customize the parameters, the structure must be initialized first.
(Another on the TODO list)
- For this project, not all the parameters have been revealed.
(TODO)
*/
struct RDKIT_MOLSTANDARDIZE_EXPORT CleanupParameters {
// TODO reveal all parameters
private:
const char *rdbase_cstr = std::getenv("RDBASE");
public:
std::string rdbase = rdbase_cstr != nullptr ? rdbase_cstr : "";
std::string normalizations;
std::string acidbaseFile;
std::string fragmentFile;
std::string tautomerTransforms;
int maxRestarts{200}; //!< The maximum number of times to attempt to apply
//!< the series of normalizations (default 200).
bool preferOrganic{false}; //!< Whether to prioritize organic fragments when
//!< choosing fragment parent (default False).
bool doCanonical{true}; //!< Whether to apply normalizations in a
//!< canonical order
int maxTautomers{1000}; //!< The maximum number of tautomers to enumerate
//!< (default 1000).
int maxTransforms{1000}; //!< The maximum number of tautomer
//!< transformations to apply (default 1000).
bool tautomerRemoveSp3Stereo{
true}; //!< Whether to remove stereochemistry from sp3 centers involved
//!< in tautomerism (defaults to true)
bool tautomerRemoveBondStereo{
true}; //!< Whether to remove stereochemistry from double bonds involved
//!< in tautomerism (defaults to true)
bool tautomerRemoveIsotopicHs{
true}; //!< Whether to remove isotopic Hs from centers involved in
//!< tautomerism (defaults to true)
bool tautomerReassignStereo{
true}; //!< Whether enumerate() should call assignStereochemistry on all
//!< generated tautomers (defaults to true)
bool largestFragmentChooserUseAtomCount{
true}; //!< Whether LargestFragmentChooser should use atom count as main
//!< criterion before MW (defaults to true)
bool largestFragmentChooserCountHeavyAtomsOnly{
false}; //!< Whether LargestFragmentChooser should only count heavy atoms
//!< (defaults to false)
std::vector<std::pair<std::string, std::string>> normalizationData;
std::vector<std::pair<std::string, std::string>> fragmentData;
std::vector<std::tuple<std::string, std::string, std::string>> acidbaseData;
std::vector<std::tuple<std::string, std::string, std::string, std::string>>
tautomerTransformData;
CleanupParameters() {}
};
RDKIT_MOLSTANDARDIZE_EXPORT extern const CleanupParameters
defaultCleanupParameters;
RDKIT_MOLSTANDARDIZE_EXPORT void updateCleanupParamsFromJSON(
CleanupParameters ¶ms, const std::string &json);
//! The cleanup function is equivalent to the
/// molvs.Standardizer().standardize(mol) function. It calls the same steps,
/// namely: RemoveHs, RDKit SanitizeMol, MetalDisconnector, Normalizer,
/// Reionizer, RDKit AssignStereochemistry.
RDKIT_MOLSTANDARDIZE_EXPORT RWMol *cleanup(
const RWMol *mol,
const CleanupParameters ¶ms = defaultCleanupParameters);
//! \overload
inline RWMol *cleanup(const RWMol &mol, const CleanupParameters ¶ms =
defaultCleanupParameters) {
return cleanup(&mol, params);
};
//! Works the same as Normalizer().normalize(mol)
RDKIT_MOLSTANDARDIZE_EXPORT RWMol *normalize(
const RWMol *mol,
const CleanupParameters ¶ms = defaultCleanupParameters);
//! Works the same as Reionizer().reionize(mol)
RDKIT_MOLSTANDARDIZE_EXPORT RWMol *reionize(
const RWMol *mol,
const CleanupParameters ¶ms = defaultCleanupParameters);
//! Works the same as FragmentRemover().remove(mol)
RDKIT_MOLSTANDARDIZE_EXPORT RWMol *removeFragments(
const RWMol *mol,
const CleanupParameters ¶ms = defaultCleanupParameters);
//! Works the same as TautomerEnumerator().canonicalize(mol)
RDKIT_MOLSTANDARDIZE_EXPORT RWMol *canonicalTautomer(
const RWMol *mol,
const CleanupParameters ¶ms = defaultCleanupParameters);
//! Returns the tautomer parent of a given molecule. The fragment parent is the
/// standardized canonical tautomer of the molecule
RDKIT_MOLSTANDARDIZE_EXPORT RWMol *tautomerParent(
const RWMol &mol,
const CleanupParameters ¶ms = defaultCleanupParameters,
bool skipStandardize = false);
//! Returns the fragment parent of a given molecule. The fragment parent is the
/// largest organic covalent unit in the molecule.
RDKIT_MOLSTANDARDIZE_EXPORT RWMol *fragmentParent(
const RWMol &mol,
const CleanupParameters ¶ms = defaultCleanupParameters,
bool skip_standardize = false);
//! calls removeStereochemistry() on the given molecule
RDKIT_MOLSTANDARDIZE_EXPORT RWMol *stereoParent(
const RWMol &mol,
const CleanupParameters ¶ms = defaultCleanupParameters,
bool skip_standardize = false);
//! removes all isotopes specifications from the given molecule
RDKIT_MOLSTANDARDIZE_EXPORT RWMol *isotopeParent(
const RWMol &mol,
const CleanupParameters ¶ms = defaultCleanupParameters,
bool skip_standardize = false);
//! Returns the charge parent of a given molecule. The charge parent is the
//! uncharged version of the fragment parent.
RDKIT_MOLSTANDARDIZE_EXPORT RWMol *chargeParent(
const RWMol &mol,
const CleanupParameters ¶ms = defaultCleanupParameters,
bool skip_standardize = false);
//! Returns the super parent. The super parent is the fragment, charge, isotope,
//! stereo, and tautomer parent of the molecule.
RDKIT_MOLSTANDARDIZE_EXPORT RWMol *superParent(
const RWMol &mol,
const CleanupParameters ¶ms = defaultCleanupParameters,
bool skip_standardize = false);
//! Convenience function for quickly standardizing a single SMILES string.
/// Returns a standardized canonical SMILES string given a SMILES string.
/// This is the equivalent of calling cleanup() on each of the molecules
RDKIT_MOLSTANDARDIZE_EXPORT std::string standardizeSmiles(
const std::string &smiles);
//! TODO
RDKIT_MOLSTANDARDIZE_EXPORT std::vector<std::string> enumerateTautomerSmiles(
const std::string &smiles,
const CleanupParameters ¶ms = defaultCleanupParameters);
}; // namespace MolStandardize
} // namespace RDKit
#endif
|