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;
112 if (strm->bad() || strm->eof()) {
113 std::ostringstream errout;
114 errout <<
"Invalid input file " << filename;
118 return static_cast<std::istream *
>(strm);
133 std::istream *inStream,
bool takeOwnership =
true,
140 std::unique_ptr<RWMol>
next()
override;
155 bool df_processPropertyLists =
true;
156 bool df_eofHitOnRead =
false;
185 const std::string &fileName,
189 std::istream *inStream,
bool takeOwnership =
true,
195 std::unique_ptr<RWMol>
next()
override;
223 void checkForEnd()
override;
226 std::vector<std::streampos> d_molpos;
281 const std::string &fileName,
285 std::istream *inStream,
bool takeOwnership =
true,
293 std::unique_ptr<RWMol>
next()
override;
305 std::unique_ptr<RWMol> processLine(std::string inLine);
306 void processTitleLine();
307 std::string nextLine();
308 long int skipComments();
316 std::vector<std::streampos>
318 std::vector<int> d_lineNums;
365 const std::string &fileName,
368 std::istream *inStream,
bool takeOwnership =
true,
376 std::unique_ptr<RWMol>
next()
override;
388 bool advanceToNextRecord();
390 std::unique_ptr<RWMol> parseMol(std::string inLine);
396 std::vector<std::streampos>
401#ifdef RDK_BUILD_MAEPARSER_SUPPORT
403 bool sanitize =
true;
404 bool removeHs =
true;
417 explicit MaeMolSupplier(
418 std::shared_ptr<std::istream> inStream,
419 const MaeMolSupplierParams ¶ms = MaeMolSupplierParams());
421 explicit MaeMolSupplier(
422 std::istream *inStream,
bool takeOwnership =
true,
423 const MaeMolSupplierParams ¶ms = MaeMolSupplierParams());
425 explicit MaeMolSupplier(
426 const std::string &fname,
427 const MaeMolSupplierParams ¶ms = MaeMolSupplierParams());
429 ~MaeMolSupplier()
override {}
431 void init()
override;
432 void reset()
override;
433 std::unique_ptr<RWMol> next()
override;
434 bool atEnd()
override;
435 void moveTo(
unsigned int idx);
436 std::unique_ptr<RWMol> operator[](
unsigned int idx);
437 unsigned int length();
439 void close()
override { dp_sInStream.reset(); }
441 void setData(
const std::string &text,
442 const MaeMolSupplierParams ¶ms = MaeMolSupplierParams());
445 void moveToNextBlock();
448 MaeMolSupplierParams d_params;
449 std::shared_ptr<schrodinger::mae::Reader> d_reader;
450 std::shared_ptr<schrodinger::mae::Block> d_next_struct;
451 std::shared_ptr<std::istream> dp_sInStream;
452 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
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