11 #ifndef RD_MOLSUPPLIER_H
12 #define RD_MOLSUPPLIER_H
25 #ifdef RDK_BUILD_MAEPARSER_SUPPORT
26 namespace schrodinger {
78 std::istream *dp_inStream =
nullptr;
80 bool df_owner =
false;
91 new std::ifstream(filename.c_str(), std::ios_base::binary);
92 if ((!(*strm)) || strm->bad()) {
93 std::ostringstream errout;
94 errout <<
"Bad input file " << filename;
100 if (strm->bad() || strm->eof()) {
101 std::ostringstream errout;
102 errout <<
"Invalid input file " << filename;
106 return static_cast<std::istream *
>(strm);
121 bool takeOwnership =
true,
bool sanitize =
true,
123 bool strictParsing =
false);
126 if (df_owner && dp_inStream) {
129 dp_inStream =
nullptr;
149 bool df_sanitize =
true, df_removeHs =
true, df_strictParsing =
true;
150 bool df_processPropertyLists =
true;
151 bool df_eofHitOnRead =
false;
181 bool removeHs =
true,
bool strictParsing =
true);
184 bool sanitize =
true,
bool removeHs =
true,
185 bool strictParsing =
true);
200 void setData(
const std::string &text,
bool sanitize =
true,
221 void setDataCommon(
const std::string &text,
bool sanitize,
bool removeHs);
224 std::vector<std::streampos> d_molpos;
262 const std::string &delimiter =
" \t",
263 int smilesColumn = 0,
int nameColumn = 1,
264 bool titleLine =
true,
bool sanitize =
true);
267 const std::string &delimiter =
" \t",
268 int smilesColumn = 0,
int nameColumn = 1,
269 bool titleLine =
true,
bool sanitize =
true);
272 void setData(
const std::string &text,
const std::string &delimiter =
" ",
273 int smilesColumn = 0,
int nameColumn = 1,
bool titleLine =
true,
274 bool sanitize =
true);
289 ROMol *processLine(std::string inLine);
290 void processTitleLine();
291 std::string nextLine();
292 long int skipComments();
299 std::vector<std::streampos>
301 std::vector<int> d_lineNums;
303 bool df_sanitize =
true;
305 bool df_title =
true;
337 const std::string &nameRecord =
"",
int confId2D = -1,
338 int confId3D = 0,
bool sanitize =
true);
340 const std::string &nameRecord =
"",
int confId2D = -1,
341 int confId3D = 0,
bool sanitize =
true);
344 void setData(
const std::string &text,
const std::string &nameRecord =
"",
345 int confId2D = -1,
int confId3D = 0,
bool sanitize =
true);
360 bool advanceToNextRecord();
362 ROMol *parseMol(std::string inLine);
370 std::vector<std::streampos>
372 bool df_sanitize =
true;
373 std::string d_nameProp =
381 bool sanitize =
true,
bool removeHs =
true,
382 unsigned int flavor = 0,
383 bool proximityBonding =
true);
385 bool removeHs =
true,
unsigned int flavor = 0,
386 bool proximityBonding =
true);
389 if (df_owner && dp_inStream)
delete dp_inStream;
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 virtual ~MaeMolSupplier(){
427 virtual void reset();
428 virtual ROMol *next();
429 virtual bool atEnd();
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 *)
void setProcessPropertyLists(bool val)
virtual void checkForEnd()
ForwardSDMolSupplier(std::istream *inStream, bool takeOwnership=true, bool sanitize=true, bool removeHs=true, bool strictParsing=false)
virtual ~ForwardSDMolSupplier()
bool getEOFHitOnRead() const
bool getProcessPropertyLists() const
std::istream * openAndCheckStream(const std::string &filename)
lazy file parser for PDB files
PDBMolSupplier(std::istream *inStream, bool takeOwnership=true, bool sanitize=true, bool removeHs=true, unsigned int flavor=0, bool proximityBonding=true)
virtual ~PDBMolSupplier()
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)
ROMol * operator[](unsigned int idx)
lazy file parser for Smiles tables
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(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