11#ifndef RD_SMILESPARSE_H
12#define RD_SMILESPARSE_H
25namespace SmilesParse {
30 const char *
what() const noexcept
override {
return _msg.c_str(); }
40namespace SmilesParse {
45 bool allowCXSMILES =
true;
48 bool parseName =
true;
50 bool skipCleanup =
false;
51 bool debugParse =
false;
52 std::map<std::string, std::string>
57 bool allowCXSMILES =
true;
60 bool parseName =
true;
63 bool skipCleanup =
false;
64 bool debugParse =
false;
65 std::map<std::string, std::string>
70 const std::string &smi,
71 const SmilesParserParams ¶ms = SmilesParserParams());
73 const std::string &sma,
74 const SmartsParserParams ¶ms = SmartsParserParams());
77 const std::string &smi);
79 const std::string &smi);
82 const std::string &sma);
84 const std::string &sma);
95 std::map<std::string, std::string> *replacements =
97 bool allowCXSMILES =
true;
100 bool parseName =
true;
101 bool removeHs =
true;
102 bool skipCleanup =
false;
107 std::map<std::string, std::string> *replacements =
109 bool allowCXSMILES =
true;
110 bool strictCXSMILES =
112 bool parseName =
true;
115 bool skipCleanup =
false;
120 RDKit::v2::SmilesParse::SmilesParserParams v2ps;
132 return RDKit::v2::SmilesParse::MolFromSmiles(smi, v2ps).release();
136 auto res = RDKit::v2::SmilesParse::AtomFromSmiles(smi).release();
141 return RDKit::v2::SmilesParse::BondFromSmiles(smi).release();
172 const std::string &smi,
int debugParse = 0,
bool sanitize =
true,
173 std::map<std::string, std::string> *replacements =
nullptr) {
174 RDKit::v2::SmilesParse::SmilesParserParams params;
175 params.debugParse = debugParse;
177 params.replacements = *replacements;
180 params.sanitize =
true;
181 params.removeHs =
true;
183 params.sanitize =
false;
184 params.removeHs =
false;
186 return RDKit::v2::SmilesParse::MolFromSmiles(smi, params).release();
191 RDKit::v2::SmilesParse::SmartsParserParams v2ps;
202 return RDKit::v2::SmilesParse::MolFromSmarts(sma, v2ps).release();
218 const std::string &sma,
int debugParse = 0,
bool mergeHs =
false,
219 std::map<std::string, std::string> *replacements =
nullptr) {
220 RDKit::v2::SmilesParse::SmartsParserParams ps;
221 ps.debugParse = debugParse;
222 ps.mergeHs = mergeHs;
224 ps.replacements = *replacements;
226 return RDKit::v2::SmilesParse::MolFromSmarts(sma, ps).release();
230 return RDKit::v2::SmilesParse::AtomFromSmarts(sma).release();
233 return RDKit::v2::SmilesParse::BondFromSmarts(sma).release();
237inline std::unique_ptr<RDKit::RWMol>
operator"" _smiles(
const char *text,
239 std::string smi(text, len);
241 return v2::SmilesParse::MolFromSmiles(smi);
246inline std::unique_ptr<RDKit::RWMol>
operator"" _smarts(
const char *text,
248 std::string smi(text, len);
249 return v2::SmilesParse::MolFromSmarts(smi);
The class for representing atoms.
class for representing a bond
class for flagging sanitization errors
RWMol is a molecule class that is intended to be edited.
SmilesParseException(const std::string msg)
SmilesParseException(const char *msg)
~SmilesParseException() noexcept override=default
const char * what() const noexcept override
#define RDKIT_SMILESPARSE_EXPORT
Atom * SmilesToAtom(const std::string &smi)
Bond * SmilesToBond(const std::string &smi)
RWMol * SmartsToMol(const std::string &sma, const SmartsParserParams &ps)
Bond * SmartsToBond(const std::string &sma)
RDKit::RWMol * SmilesToMol(const std::string &smi, const SmilesParserParams &ps)
Atom * SmartsToAtom(const std::string &sma)
std::map< std::string, std::string > * replacements
std::map< std::string, std::string > * replacements