11#ifndef RD_MOLSUPPLIER_H
12#define RD_MOLSUPPLIER_H
28#ifdef RDK_BUILD_MAEPARSER_SUPPORT
29namespace schrodinger {
41namespace FileParsers {
71 virtual std::unique_ptr<RWMol>
next() = 0;
78 dp_inStream =
nullptr;
91 std::istream *dp_inStream =
nullptr;
93 bool df_owner =
false;
103 std::ifstream *strm =
104 new std::ifstream(filename.c_str(), std::ios_base::binary);
105 if ((!(*strm)) || strm->bad()) {
106 std::ostringstream errout;
107 errout <<
"Bad input file " << filename;
113 if (strm->bad() || strm->eof()) {
114 std::ostringstream errout;
115 errout <<
"Invalid input file " << filename;
119 return static_cast<std::istream *
>(strm);
134 std::istream *inStream,
bool takeOwnership =
true,
141 std::unique_ptr<RWMol>
next()
override;
156 bool df_processPropertyLists =
true;
157 bool df_eofHitOnRead =
false;
186 const std::string &fileName,
190 std::istream *inStream,
bool takeOwnership =
true,
196 std::unique_ptr<RWMol>
next()
override;
224 void checkForEnd()
override;
227 std::vector<std::streampos> d_molpos;
282 const std::string &fileName,
286 std::istream *inStream,
bool takeOwnership =
true,
294 std::unique_ptr<RWMol>
next()
override;
306 std::unique_ptr<RWMol> processLine(std::string inLine);
307 void processTitleLine();
308 std::string nextLine();
309 long int skipComments();
317 std::vector<std::streampos>
319 std::vector<int> d_lineNums;
366 const std::string &fileName,
369 std::istream *inStream,
bool takeOwnership =
true,
377 std::unique_ptr<RWMol>
next()
override;
389 bool advanceToNextRecord();
391 std::unique_ptr<RWMol> parseMol(std::string inLine);
397 std::vector<std::streampos>
414 std::unique_ptr<RWMol>
next()
override;
420#ifdef RDK_BUILD_MAEPARSER_SUPPORT
422 bool sanitize =
true;
423 bool removeHs =
true;
436 explicit MaeMolSupplier(
437 std::shared_ptr<std::istream> inStream,
438 const MaeMolSupplierParams ¶ms = MaeMolSupplierParams());
440 explicit MaeMolSupplier(
441 std::istream *inStream,
bool takeOwnership =
true,
442 const MaeMolSupplierParams ¶ms = MaeMolSupplierParams());
444 explicit MaeMolSupplier(
445 const std::string &fname,
446 const MaeMolSupplierParams ¶ms = MaeMolSupplierParams());
448 ~MaeMolSupplier()
override {}
450 void init()
override;
451 void reset()
override;
452 std::unique_ptr<RWMol> next()
override;
453 bool atEnd()
override;
454 void moveTo(
unsigned int idx);
455 std::unique_ptr<RWMol> operator[](
unsigned int idx);
456 unsigned int length();
458 void close()
override { dp_sInStream.reset(); }
460 void setData(
const std::string &text,
461 const MaeMolSupplierParams ¶ms = MaeMolSupplierParams());
464 void moveToNextBlock();
467 MaeMolSupplierParams d_params;
468 std::shared_ptr<schrodinger::mae::Reader> d_reader;
469 std::shared_ptr<schrodinger::mae::Block> d_next_struct;
470 std::shared_ptr<std::istream> dp_sInStream;
471 std::string d_stored_exc;
Defines the primary molecule class ROMol as well as associated typedefs.
used by various file parsing classes to indicate a bad file
ForwardSDMolSupplier(std::istream *inStream, bool takeOwnership=true, const MolFileParserParams ¶ms=MolFileParserParams())
bool getProcessPropertyLists() const
void setProcessPropertyLists(bool val)
~ForwardSDMolSupplier() override
std::unique_ptr< RWMol > _next()
MolFileParserParams d_params
virtual void checkForEnd()
bool getEOFHitOnRead() const
virtual void readMolProps(ROMol &)
std::unique_ptr< RWMol > next() override
std::istream * openAndCheckStream(const std::string &filename)
virtual std::unique_ptr< RWMol > next()=0
Deprecated, will be removed in 2024.09 release.
PDBMolSupplier(std::istream *inStream, bool takeOwnership=true, const PDBParserParams ¶ms=PDBParserParams())
std::unique_ptr< RWMol > next() override
PDBMolSupplier(const std::string &fname, const PDBParserParams ¶ms=PDBParserParams())
~PDBMolSupplier() override
void moveTo(unsigned int idx)
void setStreamIndices(const std::vector< std::streampos > &locs)
~SDMolSupplier() override
void setData(const std::string &text)
std::unique_ptr< RWMol > next() override
SDMolSupplier(std::istream *inStream, bool takeOwnership=true, const MolFileParserParams ¶ms=MolFileParserParams())
std::string getItemText(unsigned int idx)
returns the text block for a particular item
void setData(const std::string &text, const MolFileParserParams ¶ms)
SDMolSupplier(const std::string &fileName, const MolFileParserParams ¶ms=MolFileParserParams())
std::unique_ptr< RWMol > operator[](unsigned int idx)
lazy file parser for Smiles tables
~SmilesMolSupplier() override
std::string getItemText(unsigned int idx)
returns the text block for a particular item
std::unique_ptr< RWMol > next() override
SmilesMolSupplier(std::istream *inStream, bool takeOwnership=true, const SmilesMolSupplierParams ¶ms=SmilesMolSupplierParams())
std::unique_ptr< RWMol > operator[](unsigned int idx)
SmilesMolSupplier(const std::string &fileName, const SmilesMolSupplierParams ¶ms=SmilesMolSupplierParams())
void moveTo(unsigned int idx)
void setData(const std::string &text, const SmilesMolSupplierParams ¶ms=SmilesMolSupplierParams())
lazy file parser for TDT files
std::unique_ptr< RWMol > operator[](unsigned int idx)
~TDTMolSupplier() override
void setData(const std::string &text, const TDTMolSupplierParams ¶ms=TDTMolSupplierParams())
TDTMolSupplier(const std::string &fileName, const TDTMolSupplierParams ¶ms=TDTMolSupplierParams())
std::string getItemText(unsigned int idx)
returns the text block for a particular item
TDTMolSupplier(std::istream *inStream, bool takeOwnership=true, const TDTMolSupplierParams ¶ms=TDTMolSupplierParams())
void moveTo(unsigned int idx)
std::unique_ptr< RWMol > next() override
#define RDKIT_FILEPARSERS_EXPORT
RDKIT_FILEPARSERS_EXPORT std::string strip(const std::string &orig)
std::vector< std::string > STR_VECT
bool rdvalue_is(const RDValue_cast_t)
v2::SmilesParse::SmilesParserParams parseParameters
v2::SmilesParse::SmilesParserParams parseParameters