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 =
57 std::istream &inStream,
unsigned int &line,
60 const std::string &molBlock,
63 const std::string &fName,
88 bool sanitize =
true,
bool removeHs =
true,
89 bool strictParsing =
true) {
94 return v2::FileParsers::MolFromMolDataStream(*inStream, line, ps).release();
98 bool sanitize =
true,
bool removeHs =
true,
99 bool strictParsing =
true) {
113 bool removeHs =
true,
bool strictParsing =
true) {
118 return v2::FileParsers::MolFromMolBlock(molBlock, ps).release();
132 bool removeHs =
true,
bool strictParsing =
true) {
137 return v2::FileParsers::MolFromMolFile(fName, ps).release();
146namespace FileParsers {
148 bool sanitize =
true;
153 std::istream &inStream,
unsigned int &line,
156 const std::string &fName,
180 bool sanitize =
true,
181 bool skipFirstConf =
false) {
185 return v2::FileParsers::MolFromTPLDataStream(*inStream, line, ps).release();
204 bool skipFirstConf =
false) {
208 return v2::FileParsers::MolFromTPLFile(fName, ps).release();
213namespace FileParsers {
224 bool sanitize =
true;
225 bool removeHs =
true;
227 bool cleanupSubstructures =
232 std::istream &inStream,
235 const std::string &molBlock,
238 const std::string &fName,
259 bool removeHs =
true,
260 Mol2Type variant = Mol2Type::CORINA,
261 bool cleanupSubstructures =
true) {
267 return v2::FileParsers::MolFromMol2File(fName, ps).release();
281 bool removeHs =
true,
282 Mol2Type variant = Mol2Type::CORINA,
283 bool cleanupSubstructures =
true) {
289 return v2::FileParsers::MolFromMol2DataStream(inStream, ps).release();
293 bool removeHs =
true,
294 Mol2Type variant = Mol2Type::CORINA,
295 bool cleanupSubstructures =
true) {
297 cleanupSubstructures);
311 bool removeHs =
true,
312 Mol2Type variant = Mol2Type::CORINA,
313 bool cleanupSubstructures =
true) {
319 return v2::FileParsers::MolFromMol2Block(molBlock, ps).release();
324namespace FileParsers {
327 std::istream &inStream);
333 const std::string &xyzBlock);
339 const std::string &fName);
344 return v2::FileParsers::MolFromXYZDataStream(inStream).release();
351 return v2::FileParsers::MolFromXYZBlock(xyzBlock).release();
358 return v2::FileParsers::MolFromXYZFile(fName).release();
364namespace FileParsers {
366 bool sanitize =
true;
367 bool removeHs =
true;
368 bool proximityBonding =
true;
370 unsigned int flavor = 0;
376 const std::string &fname,
386 bool removeHs =
true,
unsigned int flavor = 0,
387 bool proximityBonding =
true) {
393 return v2::FileParsers::MolFromPDBBlock(str, ps).release();
396 bool removeHs =
true,
unsigned int flavor = 0,
397 bool proximityBonding =
true) {
398 return PDBBlockToMol(std::string(str), sanitize, removeHs, flavor,
402 bool removeHs =
true,
unsigned int flavor = 0,
403 bool proximityBonding =
true) {
409 return v2::FileParsers::MolFromPDBFile(fname, ps).release();
412 bool removeHs =
true,
unsigned int flavor = 0,
413 bool proximityBonding =
true) {
419 return v2::FileParsers::MolFromPDBDataStream(inStream, ps).release();
422 bool removeHs =
true,
unsigned int flavor = 0,
423 bool proximityBonding =
true) {
439 bool sanitize =
true,
440 bool removeHs =
true);
444 bool sanitize =
true,
445 bool removeHs =
true);
447inline std::unique_ptr<RDKit::RWMol>
operator"" _ctab(
const char *text,
449 std::string data(text,
len);
456inline std::unique_ptr<RDKit::RWMol>
operator"" _mol2(
const char *text,
458 std::string data(text,
len);
466inline std::unique_ptr<RDKit::RWMol>
operator"" _pdb(
const char *text,
468 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< 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< 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