11#ifndef RD_MOLSUPPLIER_H
12#define RD_MOLSUPPLIER_H
27#ifdef RDK_BUILD_MAEPARSER_SUPPORT
28namespace schrodinger {
70 virtual std::unique_ptr<RWMol>
next() = 0;
102 std::ifstream *strm =
103 new std::ifstream(filename.c_str(), std::ios_base::binary);
104 if ((!(*strm)) || strm->bad()) {
105 std::ostringstream errout;
106 errout <<
"Bad input file " << filename;
111 if (strm->bad() || strm->eof()) {
112 std::ostringstream errout;
113 errout <<
"Invalid input file " << filename;
117 return static_cast<std::istream *
>(strm);
132 std::istream *inStream,
bool takeOwnership =
true,
139 std::unique_ptr<RWMol>
next()
override;
184 const std::string &fileName,
188 std::istream *inStream,
bool takeOwnership =
true,
194 std::unique_ptr<RWMol>
next()
override;
222 void checkForEnd()
override;
223 void peekCheckForEnd(
char* bufPtr,
char* bufEnd, std::streampos molStartPos);
224 void buildIndexTo(
unsigned int targetIdx);
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>
402#ifdef RDK_BUILD_MAEPARSER_SUPPORT
403struct MaeMolSupplierParams {
404 bool sanitize =
true;
405 bool removeHs =
true;
418 explicit MaeMolSupplier(
419 std::shared_ptr<std::istream> inStream,
420 const MaeMolSupplierParams ¶ms = MaeMolSupplierParams());
422 explicit MaeMolSupplier(
423 std::istream *inStream,
bool takeOwnership =
true,
424 const MaeMolSupplierParams ¶ms = MaeMolSupplierParams());
426 explicit MaeMolSupplier(
427 const std::string &fname,
428 const MaeMolSupplierParams ¶ms = MaeMolSupplierParams());
430 ~MaeMolSupplier()
override {}
432 void init()
override;
433 void reset()
override;
434 std::unique_ptr<RWMol> next()
override;
435 bool atEnd()
override;
436 void moveTo(
unsigned int idx);
437 std::unique_ptr<RWMol> operator[](
unsigned int idx);
438 unsigned int length();
440 void close()
override { dp_sInStream.reset(); }
442 void setData(
const std::string &text,
443 const MaeMolSupplierParams ¶ms = MaeMolSupplierParams());
446 void moveToNextBlock();
449 MaeMolSupplierParams d_params;
450 std::shared_ptr<schrodinger::mae::Reader> d_reader;
451 std::shared_ptr<schrodinger::mae::Block> d_next_struct;
452 std::shared_ptr<std::istream> dp_sInStream;
453 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
bool df_processPropertyLists
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
std::istream * dp_inStream
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)
~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())
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
v2::SmilesParse::SmilesParserParams parseParameters
v2::SmilesParse::SmilesParserParams parseParameters