10#ifndef RD_MOLSUPPLIER_v1_H
11#define RD_MOLSUPPLIER_v1_H
54 return dp_supplier->atEnd();
60 return dp_supplier->next().release();
93 bool takeOwnership =
true,
bool sanitize =
true,
95 bool strictParsing =
false) {
101 inStream, takeOwnership, params));
109 ->setProcessPropertyLists(val);
114 ->getProcessPropertyLists();
121 return static_cast<ContainedType *
>(dp_supplier.get())->getEOFHitOnRead();
155 bool removeHs =
true,
bool strictParsing =
true) {
164 bool sanitize =
true,
bool removeHs =
true,
165 bool strictParsing =
true) {
176 static_cast<ContainedType *
>(dp_supplier.get())->moveTo(idx);
190 return static_cast<ContainedType *
>(dp_supplier.get())->getItemText(idx);
194 return static_cast<ContainedType *
>(dp_supplier.get())->length();
196 void setData(
const std::string &text,
bool sanitize =
true,
197 bool removeHs =
true) {
202 static_cast<ContainedType *
>(dp_supplier.get())->setData(text, params);
204 void setData(
const std::string &text,
bool sanitize,
bool removeHs,
205 bool strictParsing) {
210 static_cast<ContainedType *
>(dp_supplier.get())->setData(text, params);
226 static_cast<ContainedType *
>(dp_supplier.get())->setStreamIndices(locs);
266 const std::string &delimiter =
" \t",
267 int smilesColumn = 0,
int nameColumn = 1,
268 bool titleLine =
true,
bool sanitize =
true) {
278 const std::string &delimiter =
" \t",
279 int smilesColumn = 0,
int nameColumn = 1,
280 bool titleLine =
true,
bool sanitize =
true) {
288 inStream, takeOwnership, params));
292 void setData(
const std::string &text,
const std::string &delimiter =
" ",
293 int smilesColumn = 0,
int nameColumn = 1,
bool titleLine =
true,
294 bool sanitize =
true) {
302 static_cast<ContainedType *
>(dp_supplier.get())->setData(text, params);
306 static_cast<ContainedType *
>(dp_supplier.get())->moveTo(idx);
320 return static_cast<ContainedType *
>(dp_supplier.get())->getItemText(idx);
324 return static_cast<ContainedType *
>(dp_supplier.get())->length();
356 const std::string &nameRecord =
"",
int confId2D = -1,
357 int confId3D = 0,
bool sanitize =
true) {
366 const std::string &nameRecord =
"",
int confId2D = -1,
367 int confId3D = 0,
bool sanitize =
true) {
377 void setData(
const std::string &text,
const std::string &nameRecord =
"",
378 int confId2D = -1,
int confId3D = 0,
bool sanitize =
true) {
385 static_cast<ContainedType *
>(dp_supplier.get())->setData(text, params);
389 static_cast<ContainedType *
>(dp_supplier.get())->moveTo(idx);
403 return static_cast<ContainedType *
>(dp_supplier.get())->getItemText(idx);
407 return static_cast<ContainedType *
>(dp_supplier.get())->length();
411#ifdef RDK_BUILD_MAEPARSER_SUPPORT
421 using ContainedType = v2::FileParsers::MaeMolSupplier;
422 MaeMolSupplier() { dp_supplier.
reset(
new ContainedType()); }
424 explicit MaeMolSupplier(std::shared_ptr<std::istream> inStream,
425 bool sanitize =
true,
bool removeHs =
true) {
426 v2::FileParsers::MaeMolSupplierParams params;
427 params.sanitize = sanitize;
428 params.removeHs = removeHs;
429 dp_supplier.reset(
new ContainedType(inStream, params));
432 explicit MaeMolSupplier(std::istream *inStream,
bool takeOwnership =
true,
433 bool sanitize =
true,
bool removeHs =
true) {
434 v2::FileParsers::MaeMolSupplierParams params;
435 params.sanitize = sanitize;
437 dp_supplier.reset(
new ContainedType(inStream, takeOwnership, params));
440 explicit MaeMolSupplier(
const std::string &fname,
bool sanitize =
true,
441 bool removeHs =
true) {
442 v2::FileParsers::MaeMolSupplierParams params;
443 params.sanitize = sanitize;
445 dp_supplier.reset(
new ContainedType(fname, params));
447 void moveTo(
unsigned int idx) {
449 static_cast<ContainedType *
>(dp_supplier.get())->moveTo(idx);
451 RWMol *operator[](
unsigned int idx) {
453 return static_cast<ContainedType *
>(dp_supplier.get())
457 unsigned int length() {
459 return static_cast<ContainedType *
>(dp_supplier.get())->length();
462 void setData(
const std::string &text,
bool sanitize =
true,
463 bool removeHs =
true) {
465 v2::FileParsers::MaeMolSupplierParams params;
466 params.sanitize = sanitize;
468 static_cast<ContainedType *
>(dp_supplier.get())->setData(text, params);
480 explicit MultithreadedSDMolSupplier(
481 const std::string &fileName,
bool sanitize =
true,
bool removeHs =
true,
482 bool strictParsing =
true,
unsigned int numWriterThreads = 1,
483 size_t sizeInputQueue = 5,
size_t sizeOutputQueue = 5);
485 explicit MultithreadedSDMolSupplier(
486 std::istream *inStream,
bool takeOwnership =
true,
bool sanitize =
true,
487 bool removeHs =
true,
bool strictParsing =
true,
488 unsigned int numWriterThreads = 1,
size_t sizeInputQueue = 5,
489 size_t sizeOutputQueue = 5);
491 MultithreadedSDMolSupplier();
492 ~MultithreadedSDMolSupplier()
override;
493 void init()
override {}
496 bool getEnd()
const override;
497 void setProcessPropertyLists(
bool val) { df_processPropertyLists = val; }
498 bool getProcessPropertyLists()
const {
return df_processPropertyLists; }
499 bool getEOFHitOnRead()
const {
return df_eofHitOnRead; }
502 bool extractNextRecord(std::string &record,
unsigned int &lineNum,
503 unsigned int &index)
override;
504 void readMolProps(RWMol *mol, std::istringstream &inStream);
506 RWMol *processMoleculeRecord(
const std::string &record,
507 unsigned int lineNum)
override;
510 void initFromSettings(
bool takeOwnership,
bool sanitize,
bool removeHs,
511 bool strictParsing,
unsigned int numWriterThreads,
512 size_t sizeInputQueue,
size_t sizeOutputQueue);
517 bool df_sanitize =
true, df_removeHs =
true, df_strictParsing =
true;
518 bool df_processPropertyLists =
true;
519 bool df_eofHitOnRead =
false;
520 unsigned int d_currentRecordId = 1;
528 explicit MultithreadedSmilesMolSupplier(
529 const std::string &fileName,
const std::string &delimiter =
" \t",
530 int smilesColumn = 0,
int nameColumn = 1,
bool titleLine =
true,
531 bool sanitize =
true,
unsigned int numWriterThreads = 1,
532 size_t sizeInputQueue = 5,
size_t sizeOutputQueue = 5);
534 explicit MultithreadedSmilesMolSupplier(
535 std::istream *inStream,
bool takeOwnership =
true,
536 const std::string &delimiter =
" \t",
int smilesColumn = 0,
537 int nameColumn = 1,
bool titleLine =
true,
bool sanitize =
true,
538 unsigned int numWriterThreads = 1,
size_t sizeInputQueue = 5,
539 size_t sizeOutputQueue = 5);
540 MultithreadedSmilesMolSupplier();
541 ~MultithreadedSmilesMolSupplier()
override;
543 void init()
override {}
545 bool getEnd()
const override;
547 void processTitleLine();
549 bool extractNextRecord(std::string &record,
unsigned int &lineNum,
550 unsigned int &index)
override;
552 ROMol *processMoleculeRecord(
const std::string &record,
553 unsigned int lineNum)
override;
556 void initFromSettings(
bool takeOwnership,
const std::string &delimiter,
557 int smilesColumn,
int nameColumn,
bool titleLine,
558 bool sanitize,
unsigned int numWriterThreads,
559 size_t sizeInputQueue,
size_t sizeOutputQueue);
565 bool df_sanitize =
true;
567 bool df_title =
true;
570 unsigned int d_currentRecordId = 1;
#define PRECONDITION(expr, mess)
ForwardSDMolSupplier(std::istream *inStream, bool takeOwnership=true, bool sanitize=true, bool removeHs=true, bool strictParsing=false)
bool getProcessPropertyLists() const
void setProcessPropertyLists(bool val)
bool getEOFHitOnRead() const
~ForwardSDMolSupplier() override
std::unique_ptr< v2::FileParsers::MolSupplier > dp_supplier
ROMol * operator[](unsigned int idx)
void moveTo(unsigned int idx)
SDMolSupplier(std::istream *inStream, bool takeOwnership=true, bool sanitize=true, bool removeHs=true, bool strictParsing=true)
void setStreamIndices(const std::vector< std::streampos > &locs)
void setData(const std::string &text, bool sanitize=true, bool removeHs=true)
std::string getItemText(unsigned int idx)
returns the text block for a particular item
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)
lazy file parser for Smiles tables
SmilesMolSupplier(std::istream *inStream, bool takeOwnership=true, const std::string &delimiter=" \t", int smilesColumn=0, int nameColumn=1, bool titleLine=true, bool sanitize=true)
void moveTo(unsigned int idx)
void setData(const std::string &text, const std::string &delimiter=" ", int smilesColumn=0, int nameColumn=1, bool titleLine=true, bool sanitize=true)
ROMol * operator[](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)
std::string getItemText(unsigned int idx)
returns the text block for a particular item
lazy file parser for TDT files
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)
ROMol * operator[](unsigned int idx)
void setData(const std::string &text, 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 moveTo(unsigned int idx)
lazy file parser for Smiles tables
lazy file parser for TDT files
#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
std::vector< std::string > STR_VECT
bool rdvalue_is(const RDValue_cast_t)
v2::SmilesParse::SmilesParserParams parseParameters
v2::SmilesParse::SmilesParserParams parseParameters