11 #ifndef RD_MOLSUPPLIER_H
12 #define RD_MOLSUPPLIER_H
25 #ifdef RDK_BUILD_MAEPARSER_SUPPORT
26 namespace schrodinger {
73 dp_inStream =
nullptr;
86 std::istream *dp_inStream =
nullptr;
88 bool df_owner =
false;
99 new std::ifstream(filename.c_str(), std::ios_base::binary);
100 if ((!(*strm)) || strm->bad()) {
101 std::ostringstream errout;
102 errout <<
"Bad input file " << filename;
108 if (strm->bad() || strm->eof()) {
109 std::ostringstream errout;
110 errout <<
"Invalid input file " << filename;
114 return static_cast<std::istream *
>(strm);
129 bool takeOwnership =
true,
bool sanitize =
true,
131 bool strictParsing =
false);
151 bool df_sanitize =
true, df_removeHs =
true, df_strictParsing =
true;
152 bool df_processPropertyLists =
true;
153 bool df_eofHitOnRead =
false;
183 bool removeHs =
true,
bool strictParsing =
true);
186 bool sanitize =
true,
bool removeHs =
true,
187 bool strictParsing =
true);
202 void setData(
const std::string &text,
bool sanitize =
true,
222 void checkForEnd()
override;
223 void setDataCommon(
const std::string &text,
bool sanitize,
bool removeHs);
226 std::vector<std::streampos> d_molpos;
264 const std::string &delimiter =
" \t",
265 int smilesColumn = 0,
int nameColumn = 1,
266 bool titleLine =
true,
bool sanitize =
true);
269 const std::string &delimiter =
" \t",
270 int smilesColumn = 0,
int nameColumn = 1,
271 bool titleLine =
true,
bool sanitize =
true);
274 void setData(
const std::string &text,
const std::string &delimiter =
" ",
275 int smilesColumn = 0,
int nameColumn = 1,
bool titleLine =
true,
276 bool sanitize =
true);
291 ROMol *processLine(std::string inLine);
292 void processTitleLine();
293 std::string nextLine();
294 long int skipComments();
301 std::vector<std::streampos>
303 std::vector<int> d_lineNums;
305 bool df_sanitize =
true;
307 bool df_title =
true;
339 const std::string &nameRecord =
"",
int confId2D = -1,
340 int confId3D = 0,
bool sanitize =
true);
342 const std::string &nameRecord =
"",
int confId2D = -1,
343 int confId3D = 0,
bool sanitize =
true);
346 void setData(
const std::string &text,
const std::string &nameRecord =
"",
347 int confId2D = -1,
int confId3D = 0,
bool sanitize =
true);
362 bool advanceToNextRecord();
364 ROMol *parseMol(std::string inLine);
372 std::vector<std::streampos>
374 bool df_sanitize =
true;
375 std::string d_nameProp =
383 bool sanitize =
true,
bool removeHs =
true,
384 unsigned int flavor = 0,
385 bool proximityBonding =
true);
387 bool removeHs =
true,
unsigned int flavor = 0,
388 bool proximityBonding =
true);
401 #ifdef RDK_BUILD_MAEPARSER_SUPPORT
411 MaeMolSupplier() { init(); }
413 explicit MaeMolSupplier(std::shared_ptr<std::istream> inStream,
414 bool sanitize =
true,
bool removeHs =
true);
416 explicit MaeMolSupplier(std::istream *inStream,
bool takeOwnership =
true,
417 bool sanitize =
true,
bool removeHs =
true);
419 explicit MaeMolSupplier(
const std::string &fname,
bool sanitize =
true,
422 ~MaeMolSupplier()
override {}
424 void init()
override;
425 void reset()
override;
426 ROMol *next()
override;
427 bool atEnd()
override;
429 void close()
override { dp_sInStream.reset(); }
432 void moveToNextBlock();
435 bool df_sanitize, df_removeHs;
436 std::shared_ptr<schrodinger::mae::Reader> d_reader;
437 std::shared_ptr<schrodinger::mae::Block> d_next_struct;
438 std::shared_ptr<std::istream> dp_sInStream;
439 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)
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
ROMol * operator[](unsigned int idx)
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)
ROMol * operator[](unsigned int idx)
SmilesMolSupplier(std::istream *inStream, bool takeOwnership=true, const std::string &delimiter=" \t", int smilesColumn=0, int nameColumn=1, bool titleLine=true, bool sanitize=true)
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
~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)
ROMol * operator[](unsigned int idx)
void setData(const std::string &text, const std::string &nameRecord="", int confId2D=-1, int confId3D=0, bool sanitize=true)
#define RDKIT_FILEPARSERS_EXPORT
RDKIT_GRAPHMOL_EXPORT ROMol * removeHs(const ROMol &mol, bool implicitOnly=false, bool updateExplicitCount=false, bool sanitize=true)
returns a copy of a molecule with hydrogens removed
RDKIT_FILEPARSERS_EXPORT std::string strip(const std::string &orig)
std::vector< std::string > STR_VECT