11#ifndef RD_FILEPARSERS_H
12#define RD_FILEPARSERS_H
24#include <boost/shared_ptr.hpp>
31namespace FileParsers {
33 :
public std::exception {
41 const char *
what() const noexcept
override {
return _msg.c_str(); }
51 bool strictParsing =
true;
53 bool expandAttachmentPoints =
55 bool parsingSCSRMol =
false;
81 bool includeLeavingGroups =
89 std::istream &inStream,
unsigned int &line,
92 const std::string &molBlock,
95 const std::string &fName,
99 std::istream &inStream,
unsigned int &line,
103 const std::string &molBlock,
107 const std::string &fName,
133 bool sanitize =
true,
bool removeHs =
true,
134 bool strictParsing =
true) {
139 return v2::FileParsers::MolFromMolDataStream(*inStream, line, ps).release();
143 bool sanitize =
true,
bool removeHs =
true,
144 bool strictParsing =
true) {
158 bool removeHs =
true,
bool strictParsing =
true) {
163 return v2::FileParsers::MolFromMolBlock(molBlock, ps).release();
177 bool removeHs =
true,
bool strictParsing =
true) {
182 return v2::FileParsers::MolFromMolFile(fName, ps).release();
191namespace FileParsers {
193 bool sanitize =
true;
198 std::istream &inStream,
unsigned int &line,
201 const std::string &fName,
225 bool sanitize =
true,
226 bool skipFirstConf =
false) {
230 return v2::FileParsers::MolFromTPLDataStream(*inStream, line, ps).release();
249 bool skipFirstConf =
false) {
253 return v2::FileParsers::MolFromTPLFile(fName, ps).release();
258namespace FileParsers {
269 bool sanitize =
true;
270 bool removeHs =
true;
272 bool cleanupSubstructures =
277 std::istream &inStream,
280 const std::string &molBlock,
283 const std::string &fName,
304 bool removeHs =
true,
305 Mol2Type variant = Mol2Type::CORINA,
306 bool cleanupSubstructures =
true) {
312 return v2::FileParsers::MolFromMol2File(fName, ps).release();
326 bool removeHs =
true,
327 Mol2Type variant = Mol2Type::CORINA,
328 bool cleanupSubstructures =
true) {
334 return v2::FileParsers::MolFromMol2DataStream(inStream, ps).release();
338 bool removeHs =
true,
339 Mol2Type variant = Mol2Type::CORINA,
340 bool cleanupSubstructures =
true) {
342 cleanupSubstructures);
356 bool removeHs =
true,
357 Mol2Type variant = Mol2Type::CORINA,
358 bool cleanupSubstructures =
true) {
364 return v2::FileParsers::MolFromMol2Block(molBlock, ps).release();
369namespace FileParsers {
372 std::istream &inStream);
378 const std::string &xyzBlock);
384 const std::string &fName);
389 return v2::FileParsers::MolFromXYZDataStream(inStream).release();
396 return v2::FileParsers::MolFromXYZBlock(xyzBlock).release();
403 return v2::FileParsers::MolFromXYZFile(fName).release();
409namespace FileParsers {
411 bool sanitize =
true;
412 bool removeHs =
true;
413 bool proximityBonding =
true;
415 unsigned int flavor = 0;
421 const std::string &fname,
431 bool removeHs =
true,
unsigned int flavor = 0,
432 bool proximityBonding =
true) {
438 return v2::FileParsers::MolFromPDBBlock(str, ps).release();
441 bool removeHs =
true,
unsigned int flavor = 0,
442 bool proximityBonding =
true) {
443 return PDBBlockToMol(std::string(str), sanitize, removeHs, flavor,
447 bool removeHs =
true,
unsigned int flavor = 0,
448 bool proximityBonding =
true) {
454 return v2::FileParsers::MolFromPDBFile(fname, ps).release();
457 bool removeHs =
true,
unsigned int flavor = 0,
458 bool proximityBonding =
true) {
464 return v2::FileParsers::MolFromPDBDataStream(inStream, ps).release();
467 bool removeHs =
true,
unsigned int flavor = 0,
468 bool proximityBonding =
true) {
484 bool sanitize =
true,
485 bool removeHs =
true);
489 bool sanitize =
true,
490 bool removeHs =
true);
492inline std::unique_ptr<RDKit::RWMol>
operator"" _ctab(
const char *text,
494 std::string data(text,
len);
501inline std::unique_ptr<RDKit::RWMol>
operator"" _mol2(
const char *text,
503 std::string data(text,
len);
511inline std::unique_ptr<RDKit::RWMol>
operator"" _pdb(
const char *text,
513 std::string data(text,
len);
pulls in the core RDKit functionality
class for flagging sanitization errors
RWMol is a molecule class that is intended to be edited.
const char * what() const noexcept override
get the error message
MolFileUnhandledFeatureException(const std::string msg)
construct with an error message
~MolFileUnhandledFeatureException() noexcept override=default
MolFileUnhandledFeatureException(const char *msg)
construct with an error message
#define RDKIT_FILEPARSERS_EXPORT
RWMol * Mol2BlockToMol(const std::string &molBlock, bool sanitize=true, bool removeHs=true, Mol2Type variant=Mol2Type::CORINA, bool cleanupSubstructures=true)
RWMol * XYZFileToMol(const std::string &fName)
RWMol * Mol2FileToMol(const std::string &fName, bool sanitize=true, bool removeHs=true, Mol2Type variant=Mol2Type::CORINA, bool cleanupSubstructures=true)
RWMol * MolFileToMol(const std::string &fName, bool sanitize=true, bool removeHs=true, bool strictParsing=true)
RWMol * Mol2DataStreamToMol(std::istream &inStream, bool sanitize=true, bool removeHs=true, Mol2Type variant=Mol2Type::CORINA, bool cleanupSubstructures=true)
RWMol * MolBlockToMol(const std::string &molBlock, bool sanitize=true, bool removeHs=true, bool strictParsing=true)
RWMol * PDBDataStreamToMol(std::istream &inStream, bool sanitize=true, bool removeHs=true, unsigned int flavor=0, bool proximityBonding=true)
RWMol * MolDataStreamToMol(std::istream *inStream, unsigned int &line, bool sanitize=true, bool removeHs=true, bool strictParsing=true)
RWMol * TPLFileToMol(const std::string &fName, bool sanitize=true, bool skipFirstConf=false)
construct a multi-conf molecule from a TPL (BioCad format) file
RWMol * PDBFileToMol(const std::string &fname, bool sanitize=true, bool removeHs=true, unsigned int flavor=0, bool proximityBonding=true)
RWMol * XYZDataStreamToMol(std::istream &inStream)
RWMol * TPLDataStreamToMol(std::istream *inStream, unsigned int &line, bool sanitize=true, bool skipFirstConf=false)
translate TPL data (BioCad format) into a multi-conf molecule
RWMol * XYZBlockToMol(const std::string &xyzBlock)
RWMol * PDBBlockToMol(const std::string &str, bool sanitize=true, bool removeHs=true, unsigned int flavor=0, bool proximityBonding=true)
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RWMol > MolFromTPLFile(const std::string &fName, const TPLParserParams ¶ms=TPLParserParams())
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RWMol > MolFromPDBFile(const std::string &fname, const PDBParserParams ¶ms=PDBParserParams())
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RWMol > MolFromPDBDataStream(std::istream &inStream, const PDBParserParams ¶ms=PDBParserParams())
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RDKit::RWMol > MolFromSCSRDataStream(std::istream &inStream, unsigned int &line, const MolFileParserParams &molFileParserParams=MolFileParserParams(), const MolFromSCSRParams &molFromSCSRParams=MolFromSCSRParams())
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RWMol > MolFromXYZFile(const std::string &fName)
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RWMol > MolFromXYZBlock(const std::string &xyzBlock)
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RWMol > MolFromMolFile(const std::string &fName, const MolFileParserParams ¶ms=MolFileParserParams())
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RWMol > MolFromMol2DataStream(std::istream &inStream, const Mol2ParserParams ¶ms=Mol2ParserParams())
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RWMol > MolFromPDBBlock(const std::string &str, const PDBParserParams ¶ms=PDBParserParams())
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RWMol > MolFromMol2File(const std::string &fName, const Mol2ParserParams ¶ms=Mol2ParserParams())
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RWMol > MolFromXYZDataStream(std::istream &inStream)
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RDKit::RWMol > MolFromSCSRFile(const std::string &fName, const MolFileParserParams &molFileParserParams=MolFileParserParams(), const MolFromSCSRParams &molFromSCSRParams=MolFromSCSRParams())
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RDKit::RWMol > MolFromSCSRBlock(const std::string &molBlock, const MolFileParserParams &molFileParserParams=MolFileParserParams(), const MolFromSCSRParams &molFromSCSRParams=MolFromSCSRParams())
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RWMol > MolFromMolBlock(const std::string &molBlock, const MolFileParserParams ¶ms=MolFileParserParams())
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RWMol > MolFromMol2Block(const std::string &molBlock, const Mol2ParserParams ¶ms=Mol2ParserParams())
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RWMol > MolFromMolDataStream(std::istream &inStream, unsigned int &line, const MolFileParserParams ¶ms=MolFileParserParams())
@ CORINA
supports output from Corina and some dbtranslate output
RDKIT_FILEPARSERS_EXPORT std::unique_ptr< RWMol > MolFromTPLDataStream(std::istream &inStream, unsigned int &line, const TPLParserParams ¶ms=TPLParserParams())
RDKIT_FILEPARSERS_EXPORT std::string strip(const std::string &orig)
bool rdvalue_is(const RDValue_cast_t)
RDKIT_FILEPARSERS_EXPORT RWMol * RDKitSVGToMol(const std::string &svg, bool sanitize=true, bool removeHs=true)
bool cleanupSubstructures