Loading...
Searching...
No Matches
SmilesParseOps.h
Go to the documentation of this file.
//
// Copyright (C) 2001-2022 Greg Landrum 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 <string_view>
#include <RDGeneral/export.h>
#ifndef RD_SMILESPARSEOPS_H
#define RD_SMILESPARSEOPS_H
#include <GraphMol/Bond.h>
namespace RDKit {
class RWMol;
class Atom;
class QueryBond;
} // namespace RDKit
namespace SmilesParseOps {
RDKIT_SMILESPARSE_EXPORT void CheckRingClosureBranchStatus(RDKit::Atom *atom,
RDKit::RWMol *mp);
RDKIT_SMILESPARSE_EXPORT void ReportParseError(const char *message,
bool throwIt = true);
RDKIT_SMILESPARSE_EXPORT void CleanupAfterParseError(RDKit::RWMol *mol);
// This uses SMARTS semantics: unspecified bonds are treated as
// aromatic or single.
RDKIT_SMILESPARSE_EXPORT void AddFragToMol(
RDKit::RWMol *mol, RDKit::RWMol *frag,
RDKit::Bond::BondType bondOrder = RDKit::Bond::UNSPECIFIED,
RDKit::Bond::BondDir bondDir = RDKit::Bond::NONE);
RDKIT_SMILESPARSE_EXPORT RDKit::Bond::BondType GetUnspecifiedBondType(
const RDKit::RWMol *mol, const RDKit::Atom *atom1,
const RDKit::Atom *atom2);
RDKIT_SMILESPARSE_EXPORT void CheckChiralitySpecifications(RDKit::RWMol *mol,
bool strict);
RDKIT_SMILESPARSE_EXPORT void CloseMolRings(RDKit::RWMol *mol,
bool toleratePartials);
RDKIT_SMILESPARSE_EXPORT void SetUnspecifiedBondTypes(RDKit::RWMol *mol);
RDKIT_SMILESPARSE_EXPORT void AdjustAtomChiralityFlags(RDKit::RWMol *mol);
RDKIT_SMILESPARSE_EXPORT void CleanupAfterParsing(RDKit::RWMol *mol);
RDKIT_SMILESPARSE_EXPORT void parseCXExtensions(
RDKit::RWMol &mol, const std::string &extText,
std::string::const_iterator &pos, unsigned int startAtomIdx = 0,
unsigned int startBondIdx = 0);
inline void parseCXExtensions(RDKit::RWMol &mol, const std::string &extText,
unsigned int startAtomIdx,
unsigned int startBondIdx) {
auto iter = extText.begin();
parseCXExtensions(mol, extText, iter, startAtomIdx, startBondIdx);
};
//! removes formal charge, isotope, etc. Primarily useful for QueryAtoms
RDKIT_SMILESPARSE_EXPORT void ClearAtomChemicalProps(RDKit::Atom *atom);
//! returns whether or not the combination of tag and permutation provided are
//! legal
RDKIT_SMILESPARSE_EXPORT bool checkChiralPermutation(int chiralTag,
int permutation);
//! this is a bit of a hack to try and get nicer "SMILES" from
//! a SMARTS molecule
RDKIT_SMILESPARSE_EXPORT RDKit::QueryBond *getUnspecifiedQueryBond(
const RDKit::Atom *a1, const RDKit::Atom *a2);
namespace detail {
constexpr auto _needsDetectBondStereo = "_needsDetectBondStereo";
constexpr auto _needsDetectAtomStereo = "_needsDetectAtomStereo";
void printSyntaxErrorMessage(std::string_view input,
std::string_view err_message,
unsigned int bad_token_position);
} // namespace detail
} // namespace SmilesParseOps
#endif
Bond.h
RDKit::Atom
The class for representing atoms.
Definition Atom.h:75
RDKit::Bond::BondType
BondType
the type of Bond
Definition Bond.h:56
RDKit::Bond::UNSPECIFIED
@ UNSPECIFIED
Definition Bond.h:57
RDKit::Bond::BondDir
BondDir
the bond's direction (for chirality)
Definition Bond.h:83
RDKit::Bond::NONE
@ NONE
no special style
Definition Bond.h:84
RDKit::QueryBond
Class for storing Bond queries.
Definition QueryBond.h:28
RDKit::RWMol
RWMol is a molecule class that is intended to be edited.
Definition RWMol.h:32
export.h
RDKIT_SMILESPARSE_EXPORT
#define RDKIT_SMILESPARSE_EXPORT
Definition export.h:505
RDKit
Std stuff.
Definition Abbreviations.h:19
SmilesParseOps::detail::printSyntaxErrorMessage
void printSyntaxErrorMessage(std::string_view input, std::string_view err_message, unsigned int bad_token_position)
SmilesParseOps::detail::_needsDetectBondStereo
constexpr auto _needsDetectBondStereo
Definition SmilesParseOps.h:68
SmilesParseOps::detail::_needsDetectAtomStereo
constexpr auto _needsDetectAtomStereo
Definition SmilesParseOps.h:69
SmilesParseOps
Definition SmilesParseOps.h:22
SmilesParseOps::CheckChiralitySpecifications
RDKIT_SMILESPARSE_EXPORT void CheckChiralitySpecifications(RDKit::RWMol *mol, bool strict)
SmilesParseOps::CloseMolRings
RDKIT_SMILESPARSE_EXPORT void CloseMolRings(RDKit::RWMol *mol, bool toleratePartials)
SmilesParseOps::getUnspecifiedQueryBond
RDKIT_SMILESPARSE_EXPORT RDKit::QueryBond * getUnspecifiedQueryBond(const RDKit::Atom *a1, const RDKit::Atom *a2)
SmilesParseOps::checkChiralPermutation
RDKIT_SMILESPARSE_EXPORT bool checkChiralPermutation(int chiralTag, int permutation)
SmilesParseOps::ClearAtomChemicalProps
RDKIT_SMILESPARSE_EXPORT void ClearAtomChemicalProps(RDKit::Atom *atom)
removes formal charge, isotope, etc. Primarily useful for QueryAtoms
SmilesParseOps::parseCXExtensions
RDKIT_SMILESPARSE_EXPORT void parseCXExtensions(RDKit::RWMol &mol, const std::string &extText, std::string::const_iterator &pos, unsigned int startAtomIdx=0, unsigned int startBondIdx=0)
SmilesParseOps::ReportParseError
RDKIT_SMILESPARSE_EXPORT void ReportParseError(const char *message, bool throwIt=true)
SmilesParseOps::SetUnspecifiedBondTypes
RDKIT_SMILESPARSE_EXPORT void SetUnspecifiedBondTypes(RDKit::RWMol *mol)
SmilesParseOps::AddFragToMol
RDKIT_SMILESPARSE_EXPORT void AddFragToMol(RDKit::RWMol *mol, RDKit::RWMol *frag, RDKit::Bond::BondType bondOrder=RDKit::Bond::UNSPECIFIED, RDKit::Bond::BondDir bondDir=RDKit::Bond::NONE)
SmilesParseOps::CleanupAfterParseError
RDKIT_SMILESPARSE_EXPORT void CleanupAfterParseError(RDKit::RWMol *mol)
SmilesParseOps::AdjustAtomChiralityFlags
RDKIT_SMILESPARSE_EXPORT void AdjustAtomChiralityFlags(RDKit::RWMol *mol)
SmilesParseOps::CheckRingClosureBranchStatus
RDKIT_SMILESPARSE_EXPORT void CheckRingClosureBranchStatus(RDKit::Atom *atom, RDKit::RWMol *mp)
SmilesParseOps::GetUnspecifiedBondType
RDKIT_SMILESPARSE_EXPORT RDKit::Bond::BondType GetUnspecifiedBondType(const RDKit::RWMol *mol, const RDKit::Atom *atom1, const RDKit::Atom *atom2)
SmilesParseOps::CleanupAfterParsing
RDKIT_SMILESPARSE_EXPORT void CleanupAfterParsing(RDKit::RWMol *mol)