Loading...
Searching...
No Matches
Fragment.h
Go to the documentation of this file.
//
// 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.
//
#include <RDGeneral/export.h>
#ifndef RD_FRAGMENT_REMOVER_H
#define RD_FRAGMENT_REMOVER_H
#include <Catalogs/Catalog.h>
#include <GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogEntry.h>
#include <GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogParams.h>
#include <GraphMol/MolStandardize/MolStandardize.h>
namespace RDKit {
class ROMol;
namespace MolStandardize {
RDKIT_MOLSTANDARDIZE_EXPORT extern const CleanupParameters
defaultCleanupParameters;
typedef RDCatalog::HierarchCatalog<FragmentCatalogEntry, FragmentCatalogParams,
int>
FragmentCatalog;
class RDKIT_MOLSTANDARDIZE_EXPORT FragmentRemover {
public:
FragmentRemover();
FragmentRemover(const std::string fragmentFile, bool leave_last,
bool skip_if_all_match = false);
FragmentRemover(std::istream &fragmentStream, bool leave_last,
bool skip_if_all_match = false);
FragmentRemover(const std::vector<std::pair<std::string, std::string>> &data,
bool leave_last, bool skip_if_all_match = false);
~FragmentRemover();
//! making FragmentRemover objects non-copyable
FragmentRemover(const FragmentRemover &other) = delete;
FragmentRemover &operator=(FragmentRemover const &) = delete;
ROMol *remove(const ROMol &mol);
void removeInPlace(RWMol &mol);
private:
// Setting leave_last to True will ensure at least one fragment
// is left in the molecule, even if it is matched by a
// FragmentPattern
bool LEAVE_LAST;
// If set, this causes the original molecule to be returned
// if every fragment in it matches the salt list
bool SKIP_IF_ALL_MATCH;
FragmentCatalog *d_fcat;
}; // class FragmentRemover
// caller owns the returned pointer
inline FragmentRemover *fragmentRemoverFromParams(
const CleanupParameters &params, bool leave_last = true,
bool skip_if_all_match = false) {
if (params.fragmentData.empty()) {
return new FragmentRemover(params.fragmentFile, leave_last,
skip_if_all_match);
} else {
return new FragmentRemover(params.fragmentData, leave_last,
skip_if_all_match);
}
}
class RDKIT_MOLSTANDARDIZE_EXPORT LargestFragmentChooser {
public:
// LargestFragmentChooser() {}
LargestFragmentChooser(bool preferOrganic = false)
: preferOrganic(preferOrganic) {}
LargestFragmentChooser(const CleanupParameters &params)
: preferOrganic(params.preferOrganic),
useAtomCount(params.largestFragmentChooserUseAtomCount),
countHeavyAtomsOnly(params.largestFragmentChooserCountHeavyAtomsOnly) {}
LargestFragmentChooser(const LargestFragmentChooser &other);
~LargestFragmentChooser() = default;
ROMol *choose(const ROMol &mol) const;
void chooseInPlace(RWMol &mol) const;
struct Largest {
Largest();
Largest(std::string &smiles, boost::shared_ptr<ROMol> fragment,
unsigned int &numatoms, double &weight, bool &organic);
std::string Smiles;
boost::shared_ptr<ROMol> Fragment;
unsigned int NumAtoms{0};
double Weight{0};
bool Organic{false};
};
private:
bool preferOrganic;
bool useAtomCount{true};
bool countHeavyAtomsOnly{false};
}; // class LargestFragmentChooser
} // namespace MolStandardize
} // namespace RDKit
#endif
Catalog.h
FragmentCatalogEntry.h
FragmentCatalogParams.h
MolStandardize.h
Defines the CleanupParameters and some convenience functions.
RDCatalog::HierarchCatalog
A Catalog with a hierarchical structure.
Definition Catalog.h:135
RDKit::MolStandardize::FragmentCatalogEntry
Definition FragmentCatalogEntry.h:24
RDKit::MolStandardize::FragmentCatalogParams
Definition FragmentCatalogParams.h:26
RDKit::MolStandardize::FragmentRemover
Definition Fragment.h:31
RDKit::MolStandardize::FragmentRemover::operator=
FragmentRemover & operator=(FragmentRemover const &)=delete
RDKit::MolStandardize::FragmentRemover::FragmentRemover
FragmentRemover(std::istream &fragmentStream, bool leave_last, bool skip_if_all_match=false)
RDKit::MolStandardize::FragmentRemover::removeInPlace
void removeInPlace(RWMol &mol)
RDKit::MolStandardize::FragmentRemover::FragmentRemover
FragmentRemover(const std::string fragmentFile, bool leave_last, bool skip_if_all_match=false)
RDKit::MolStandardize::FragmentRemover::FragmentRemover
FragmentRemover()
RDKit::MolStandardize::FragmentRemover::FragmentRemover
FragmentRemover(const FragmentRemover &other)=delete
making FragmentRemover objects non-copyable
RDKit::MolStandardize::FragmentRemover::FragmentRemover
FragmentRemover(const std::vector< std::pair< std::string, std::string > > &data, bool leave_last, bool skip_if_all_match=false)
RDKit::MolStandardize::FragmentRemover::~FragmentRemover
~FragmentRemover()
RDKit::MolStandardize::FragmentRemover::remove
ROMol * remove(const ROMol &mol)
RDKit::MolStandardize::LargestFragmentChooser::~LargestFragmentChooser
~LargestFragmentChooser()=default
RDKit::MolStandardize::LargestFragmentChooser::LargestFragmentChooser
LargestFragmentChooser(bool preferOrganic=false)
Definition Fragment.h:77
RDKit::MolStandardize::LargestFragmentChooser::LargestFragmentChooser
LargestFragmentChooser(const CleanupParameters &params)
Definition Fragment.h:79
RDKit::MolStandardize::LargestFragmentChooser::LargestFragmentChooser
LargestFragmentChooser(const LargestFragmentChooser &other)
RDKit::MolStandardize::LargestFragmentChooser::choose
ROMol * choose(const ROMol &mol) const
RDKit::MolStandardize::LargestFragmentChooser::chooseInPlace
void chooseInPlace(RWMol &mol) const
RDKit::ROMol
Definition ROMol.h:199
RDKit::RWMol
RWMol is a molecule class that is intended to be edited.
Definition RWMol.h:32
export.h
RDKIT_MOLSTANDARDIZE_EXPORT
#define RDKIT_MOLSTANDARDIZE_EXPORT
Definition export.h:369
RDKit::MolStandardize
Definition AcidBaseCatalogEntry.h:22
RDKit::MolStandardize::fragmentRemoverFromParams
FragmentRemover * fragmentRemoverFromParams(const CleanupParameters &params, bool leave_last=true, bool skip_if_all_match=false)
Definition Fragment.h:62
RDKit::MolStandardize::defaultCleanupParameters
RDKIT_MOLSTANDARDIZE_EXPORT const CleanupParameters defaultCleanupParameters
Definition Fragment.h:25
RDKit::MolStandardize::FragmentCatalog
RDCatalog::HierarchCatalog< FragmentCatalogEntry, FragmentCatalogParams, int > FragmentCatalog
Definition Fragment.h:29
RDKit
Std stuff.
Definition Abbreviations.h:19
RDKit::MolStandardize::CleanupParameters
Definition MolStandardize.h:41
RDKit::MolStandardize::CleanupParameters::fragmentFile
std::string fragmentFile
Definition MolStandardize.h:50
RDKit::MolStandardize::CleanupParameters::fragmentData
std::vector< std::pair< std::string, std::string > > fragmentData
Definition MolStandardize.h:81
RDKit::MolStandardize::LargestFragmentChooser::Largest::Largest
Largest()
RDKit::MolStandardize::LargestFragmentChooser::Largest::Largest
Largest(std::string &smiles, boost::shared_ptr< ROMol > fragment, unsigned int &numatoms, double &weight, bool &organic)
RDKit::MolStandardize::LargestFragmentChooser::Largest::Smiles
std::string Smiles
Definition Fragment.h:92
RDKit::MolStandardize::LargestFragmentChooser::Largest::Weight
double Weight
Definition Fragment.h:95
RDKit::MolStandardize::LargestFragmentChooser::Largest::Fragment
boost::shared_ptr< ROMol > Fragment
Definition Fragment.h:93
RDKit::MolStandardize::LargestFragmentChooser::Largest::NumAtoms
unsigned int NumAtoms
Definition Fragment.h:94
RDKit::MolStandardize::LargestFragmentChooser::Largest::Organic
bool Organic
Definition Fragment.h:96