11#ifndef RD_MOLSUPPLIER_H
12#define RD_MOLSUPPLIER_H
26#ifdef RDK_BUILD_MAEPARSER_SUPPORT
27namespace schrodinger {
74 dp_inStream =
nullptr;
87 std::istream *dp_inStream =
nullptr;
89 bool df_owner =
false;
100 new std::ifstream(filename.c_str(), std::ios_base::binary);
101 if ((!(*strm)) || strm->bad()) {
102 std::ostringstream errout;
103 errout <<
"Bad input file " << filename;
109 if (strm->bad() || strm->eof()) {
110 std::ostringstream errout;
111 errout <<
"Invalid input file " << filename;
115 return static_cast<std::istream *
>(strm);
130 bool takeOwnership =
true,
bool sanitize =
true,
131 bool removeHs =
true,
132 bool strictParsing =
false);
152 bool df_sanitize =
true, df_removeHs =
true, df_strictParsing =
true;
153 bool df_processPropertyLists =
true;
154 bool df_eofHitOnRead =
false;
184 bool removeHs =
true,
bool strictParsing =
true);
187 bool sanitize =
true,
bool removeHs =
true,
188 bool strictParsing =
true);
203 void setData(
const std::string &text,
bool sanitize =
true,
204 bool removeHs =
true);
205 void setData(
const std::string &text,
bool sanitize,
bool removeHs,
223 void checkForEnd()
override;
224 void setDataCommon(
const std::string &text,
bool sanitize,
bool removeHs);
227 std::vector<std::streampos> d_molpos;
265 const std::string &delimiter =
" \t",
266 int smilesColumn = 0,
int nameColumn = 1,
267 bool titleLine =
true,
bool sanitize =
true);
270 const std::string &delimiter =
" \t",
271 int smilesColumn = 0,
int nameColumn = 1,
272 bool titleLine =
true,
bool sanitize =
true);
275 void setData(
const std::string &text,
const std::string &delimiter =
" ",
276 int smilesColumn = 0,
int nameColumn = 1,
bool titleLine =
true,
277 bool sanitize =
true);
292 ROMol *processLine(std::string inLine);
293 void processTitleLine();
294 std::string nextLine();
295 long int skipComments();
302 std::vector<std::streampos>
304 std::vector<int> d_lineNums;
306 bool df_sanitize =
true;
308 bool df_title =
true;
340 const std::string &nameRecord =
"",
int confId2D = -1,
341 int confId3D = 0,
bool sanitize =
true);
343 const std::string &nameRecord =
"",
int confId2D = -1,
344 int confId3D = 0,
bool sanitize =
true);
347 void setData(
const std::string &text,
const std::string &nameRecord =
"",
348 int confId2D = -1,
int confId3D = 0,
bool sanitize =
true);
363 bool advanceToNextRecord();
365 ROMol *parseMol(std::string inLine);
373 std::vector<std::streampos>
375 bool df_sanitize =
true;
376 std::string d_nameProp =
384 bool sanitize =
true,
bool removeHs =
true,
385 unsigned int flavor = 0,
386 bool proximityBonding =
true);
388 bool removeHs =
true,
unsigned int flavor = 0,
389 bool proximityBonding =
true);
402#ifdef RDK_BUILD_MAEPARSER_SUPPORT
414 explicit MaeMolSupplier(std::shared_ptr<std::istream> inStream,
415 bool sanitize =
true,
bool removeHs =
true);
417 explicit MaeMolSupplier(std::istream *inStream,
bool takeOwnership =
true,
418 bool sanitize =
true,
bool removeHs =
true);
420 explicit MaeMolSupplier(
const std::string &fname,
bool sanitize =
true,
421 bool removeHs =
true);
423 ~MaeMolSupplier()
override {}
425 void init()
override;
426 void reset()
override;
427 ROMol *next()
override;
428 bool atEnd()
override;
429 void moveTo(
unsigned int idx);
430 ROMol *operator[](
unsigned int idx);
431 unsigned int length();
433 void close()
override { dp_sInStream.reset(); }
435 void setData(
const std::string &text,
bool sanitize =
true,
436 bool removeHs =
true);
439 void moveToNextBlock();
444 std::shared_ptr<schrodinger::mae::Reader> d_reader;
445 std::shared_ptr<schrodinger::mae::Block> d_next_struct;
446 std::shared_ptr<std::istream> dp_sInStream;
447 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
virtual void readMolProps(ROMol *)
~ForwardSDMolSupplier() override
void setProcessPropertyLists(bool val)
virtual void checkForEnd()
ForwardSDMolSupplier(std::istream *inStream, bool takeOwnership=true, bool sanitize=true, bool removeHs=true, bool strictParsing=false)
bool getEOFHitOnRead() const
bool getProcessPropertyLists() const
std::istream * openAndCheckStream(const std::string &filename)
lazy file parser for PDB files
~PDBMolSupplier() override
PDBMolSupplier(std::istream *inStream, bool takeOwnership=true, bool sanitize=true, bool removeHs=true, unsigned int flavor=0, bool proximityBonding=true)
PDBMolSupplier(const std::string &fname, bool sanitize=true, bool removeHs=true, unsigned int flavor=0, bool proximityBonding=true)
void setStreamIndices(const std::vector< std::streampos > &locs)
void setData(const std::string &text, bool sanitize=true, bool removeHs=true)
ROMol * operator[](unsigned int idx)
void setData(const std::string &text, bool sanitize, bool removeHs, bool strictParsing)
SDMolSupplier(const std::string &fileName, bool sanitize=true, bool removeHs=true, bool strictParsing=true)
std::string getItemText(unsigned int idx)
returns the text block for a particular item
SDMolSupplier(std::istream *inStream, bool takeOwnership=true, bool sanitize=true, bool removeHs=true, bool strictParsing=true)
void moveTo(unsigned int idx)
~SDMolSupplier() override
lazy file parser for Smiles tables
~SmilesMolSupplier() override
void moveTo(unsigned int idx)
SmilesMolSupplier(const std::string &fileName, const std::string &delimiter=" \t", int smilesColumn=0, int nameColumn=1, bool titleLine=true, bool sanitize=true)
SmilesMolSupplier(std::istream *inStream, bool takeOwnership=true, const std::string &delimiter=" \t", int smilesColumn=0, int nameColumn=1, bool titleLine=true, bool sanitize=true)
ROMol * operator[](unsigned int idx)
std::string getItemText(unsigned int idx)
returns the text block for a particular item
void setData(const std::string &text, const std::string &delimiter=" ", int smilesColumn=0, int nameColumn=1, bool titleLine=true, bool sanitize=true)
lazy file parser for TDT files
void moveTo(unsigned int idx)
std::string getItemText(unsigned int idx)
returns the text block for a particular item
ROMol * operator[](unsigned int idx)
~TDTMolSupplier() override
TDTMolSupplier(const std::string &fileName, const std::string &nameRecord="", int confId2D=-1, int confId3D=0, bool sanitize=true)
TDTMolSupplier(std::istream *inStream, bool takeOwnership=true, const std::string &nameRecord="", int confId2D=-1, int confId3D=0, bool sanitize=true)
void setData(const std::string &text, const std::string &nameRecord="", int confId2D=-1, int confId3D=0, bool sanitize=true)
#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)