Normalize.h
Go to the documentation of this file.
//
// Copyright (C) 2018 Susan H. Leung
//
// @@ 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 Normalize.h
\brief Defines the Normalizer class.
*/
#include <RDGeneral/export.h>
#ifndef __RD_NORMALIZE_H__
#define __RD_NORMALIZE_H__
#include <Catalogs/Catalog.h>
#include <GraphMol/MolStandardize/TransformCatalog/TransformCatalogEntry.h>
#include <GraphMol/MolStandardize/TransformCatalog/TransformCatalogParams.h>
#include <GraphMol/MolStandardize/MolStandardize.h>
namespace RDKit {
class RWMol;
class ROMol;
namespace MolStandardize {
RDKIT_MOLSTANDARDIZE_EXPORT extern const CleanupParameters
defaultCleanupParameters;
typedef RDCatalog::HierarchCatalog<TransformCatalogEntry,
TransformCatalogParams, int>
TransformCatalog;
//! The Normalizer class for applying Normalization transforms.
/*!
<b>Notes:</b>
- This class is typically used to apply a series of Normalization transforms
to correct functional groups and recombine charges.
- Each transform is repeatedly applied until no further changes
occur.
*/
class RDKIT_MOLSTANDARDIZE_EXPORT Normalizer {
public:
Normalizer();
//! Construct a Normalizer with a particular normalizeFile and maxRestarts
Normalizer(const std::string normalizeFile, const unsigned int maxRestarts);
//! Construct a Normalizer with a particular stream (with parameters) and
//! maxRestarts
Normalizer(std::istream &normalizeStream, const unsigned int maxRestarts);
//! making Normalizer objects non-copyable
Normalizer(const Normalizer &other) = delete;
Normalizer &operator=(Normalizer const &) = delete;
~Normalizer();
//! Apply a series of Normalization transforms to correct functional groups
//! and recombine charges.
/*!
<b>Notes:</b>
- A series of transforms are applied to the molecule. For each
Normalization, the transform is applied repeatedly until no further changes
occur.
- If any changes occurred, we go back and start from the first
Normalization again, in case the changes mean an earlier transform is now
applicable.
- The molecule is returned once the entire series of
Normalizations cause no further changes or if max_restarts (default 200) is
reached.
*/
ROMol *normalize(const ROMol &mol);
struct Product {
std::string Smiles;
boost::shared_ptr<ROMol> Mol;
Product(std::string smiles, boost::shared_ptr<ROMol> &mol)
: Smiles(smiles), Mol(mol) {}
// sorting products alphabetically by SMILES
bool operator<(const Product &pdt) const { return (Smiles < pdt.Smiles); }
};
private:
const TransformCatalog *d_tcat;
unsigned int MAX_RESTARTS;
boost::shared_ptr<ROMol> normalizeFragment(
const ROMol &mol,
const std::vector<std::shared_ptr<ChemicalReaction>> &transforms);
boost::shared_ptr<ROMol> applyTransform(const boost::shared_ptr<ROMol> mol,
ChemicalReaction &rule);
}; // Normalizer class
} // namespace MolStandardize
} // namespace RDKit
#endif
MolStandardize.h
RDKit::MolStandardize::Normalizer
The Normalizer class for applying Normalization transforms.
Definition: Normalize.h:46
RDKit::MolStandardize::Normalizer::Product::Mol
boost::shared_ptr< ROMol > Mol
Definition: Normalize.h:76
TransformCatalogParams.h
RDKit::MolStandardize::Normalizer::Product::Product
Product(std::string smiles, boost::shared_ptr< ROMol > &mol)
Definition: Normalize.h:77
TransformCatalogEntry.h
RDKit::MolStandardize::Normalizer::Product::operator<
bool operator<(const Product &pdt) const
Definition: Normalize.h:81
RDKit::MolStandardize::Normalizer::Product
Definition: Normalize.h:74
RDKit::MolStandardize::Normalizer::Product::Smiles
std::string Smiles
Definition: Normalize.h:75
RDCatalog::HierarchCatalog
A Catalog with a hierarchical structure.
Definition: Catalog.h:135
Catalog.h
RDKit::ROMol
Definition: ROMol.h:171
RDKit::ChemicalReaction
This is a class for storing and applying general chemical reactions.
Definition: Reaction.h:119
RDKit::MolStandardize::normalize
RDKIT_MOLSTANDARDIZE_EXPORT RWMol * normalize(const RWMol *mol, const CleanupParameters &params=defaultCleanupParameters)
Works the same as Normalizer().normalize(mol)
RDKit
Std stuff.
Definition: Atom.h:30
RDKIT_MOLSTANDARDIZE_EXPORT
#define RDKIT_MOLSTANDARDIZE_EXPORT
Definition: export.h:437
RDKit::MolStandardize::defaultCleanupParameters
const RDKIT_MOLSTANDARDIZE_EXPORT CleanupParameters defaultCleanupParameters
Definition: Fragment.h:25
RDKit::MolStandardize::TransformCatalog
RDCatalog::HierarchCatalog< TransformCatalogEntry, TransformCatalogParams, int > TransformCatalog
Definition: Normalize.h:34
export.h