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);
191 return static_cast<ContainedType *
>(dp_supplier.get())->getItemText(idx);
195 return static_cast<ContainedType *
>(dp_supplier.get())->length();
197 void setData(
const std::string &text,
bool sanitize =
true,
198 bool removeHs =
true) {
203 static_cast<ContainedType *
>(dp_supplier.get())->setData(text, params);
205 void setData(
const std::string &text,
bool sanitize,
bool removeHs,
206 bool strictParsing) {
211 static_cast<ContainedType *
>(dp_supplier.get())->setData(text, params);
227 static_cast<ContainedType *
>(dp_supplier.get())->setStreamIndices(locs);
267 const std::string &delimiter =
" \t",
268 int smilesColumn = 0,
int nameColumn = 1,
269 bool titleLine =
true,
bool sanitize =
true) {
279 const std::string &delimiter =
" \t",
280 int smilesColumn = 0,
int nameColumn = 1,
281 bool titleLine =
true,
bool sanitize =
true) {
289 inStream, takeOwnership, params));
293 void setData(
const std::string &text,
const std::string &delimiter =
" ",
294 int smilesColumn = 0,
int nameColumn = 1,
bool titleLine =
true,
295 bool sanitize =
true) {
303 static_cast<ContainedType *
>(dp_supplier.get())->setData(text, params);
307 static_cast<ContainedType *
>(dp_supplier.get())->moveTo(idx);
322 return static_cast<ContainedType *
>(dp_supplier.get())->getItemText(idx);
326 return static_cast<ContainedType *
>(dp_supplier.get())->length();
358 const std::string &nameRecord =
"",
int confId2D = -1,
359 int confId3D = 0,
bool sanitize =
true) {
368 const std::string &nameRecord =
"",
int confId2D = -1,
369 int confId3D = 0,
bool sanitize =
true) {
379 void setData(
const std::string &text,
const std::string &nameRecord =
"",
380 int confId2D = -1,
int confId3D = 0,
bool sanitize =
true) {
387 static_cast<ContainedType *
>(dp_supplier.get())->setData(text, params);
391 static_cast<ContainedType *
>(dp_supplier.get())->moveTo(idx);
406 return static_cast<ContainedType *
>(dp_supplier.get())->getItemText(idx);
410 return static_cast<ContainedType *
>(dp_supplier.get())->length();
418 bool sanitize =
true,
bool removeHs =
true,
419 unsigned int flavor = 0,
420 bool proximityBonding =
true) {
430 bool removeHs =
true,
unsigned int flavor = 0,
431 bool proximityBonding =
true) {
441#ifdef RDK_BUILD_MAEPARSER_SUPPORT
451 using ContainedType = v2::FileParsers::MaeMolSupplier;
452 MaeMolSupplier() { dp_supplier.
reset(
new ContainedType()); }
454 explicit MaeMolSupplier(std::shared_ptr<std::istream> inStream,
455 bool sanitize =
true,
bool removeHs =
true) {
456 v2::FileParsers::MaeMolSupplierParams params;
457 params.sanitize = sanitize;
458 params.removeHs = removeHs;
459 dp_supplier.reset(
new ContainedType(inStream, params));
462 explicit MaeMolSupplier(std::istream *inStream,
bool takeOwnership =
true,
463 bool sanitize =
true,
bool removeHs =
true) {
464 v2::FileParsers::MaeMolSupplierParams params;
465 params.sanitize = sanitize;
467 dp_supplier.reset(
new ContainedType(inStream, takeOwnership, params));
470 explicit MaeMolSupplier(
const std::string &fname,
bool sanitize =
true,
471 bool removeHs =
true) {
472 v2::FileParsers::MaeMolSupplierParams params;
473 params.sanitize = sanitize;
475 dp_supplier.reset(
new ContainedType(fname, params));
477 void moveTo(
unsigned int idx) {
479 static_cast<ContainedType *
>(dp_supplier.get())->moveTo(idx);
481 RWMol *operator[](
unsigned int idx) {
483 return static_cast<ContainedType *
>(dp_supplier.get())
488 unsigned int length() {
490 return static_cast<ContainedType *
>(dp_supplier.get())->length();
493 void setData(
const std::string &text,
bool sanitize =
true,
494 bool removeHs =
true) {
496 v2::FileParsers::MaeMolSupplierParams params;
497 params.sanitize = sanitize;
499 static_cast<ContainedType *
>(dp_supplier.get())->setData(text, params);
511 explicit MultithreadedSDMolSupplier(
512 const std::string &fileName,
bool sanitize =
true,
bool removeHs =
true,
513 bool strictParsing =
true,
unsigned int numWriterThreads = 1,
514 size_t sizeInputQueue = 5,
size_t sizeOutputQueue = 5);
516 explicit MultithreadedSDMolSupplier(
517 std::istream *inStream,
bool takeOwnership =
true,
bool sanitize =
true,
518 bool removeHs =
true,
bool strictParsing =
true,
519 unsigned int numWriterThreads = 1,
size_t sizeInputQueue = 5,
520 size_t sizeOutputQueue = 5);
522 MultithreadedSDMolSupplier();
523 ~MultithreadedSDMolSupplier()
override;
524 void init()
override {}
527 bool getEnd()
const override;
528 void setProcessPropertyLists(
bool val) { df_processPropertyLists = val; }
529 bool getProcessPropertyLists()
const {
return df_processPropertyLists; }
530 bool getEOFHitOnRead()
const {
return df_eofHitOnRead; }
533 bool extractNextRecord(std::string &record,
unsigned int &lineNum,
534 unsigned int &index)
override;
535 void readMolProps(RWMol *mol, std::istringstream &inStream);
537 RWMol *processMoleculeRecord(
const std::string &record,
538 unsigned int lineNum)
override;
541 void initFromSettings(
bool takeOwnership,
bool sanitize,
bool removeHs,
542 bool strictParsing,
unsigned int numWriterThreads,
543 size_t sizeInputQueue,
size_t sizeOutputQueue);
548 bool df_sanitize =
true, df_removeHs =
true, df_strictParsing =
true;
549 bool df_processPropertyLists =
true;
550 bool df_eofHitOnRead =
false;
551 unsigned int d_currentRecordId = 1;
559 explicit MultithreadedSmilesMolSupplier(
560 const std::string &fileName,
const std::string &delimiter =
" \t",
561 int smilesColumn = 0,
int nameColumn = 1,
bool titleLine =
true,
562 bool sanitize =
true,
unsigned int numWriterThreads = 1,
563 size_t sizeInputQueue = 5,
size_t sizeOutputQueue = 5);
565 explicit MultithreadedSmilesMolSupplier(
566 std::istream *inStream,
bool takeOwnership =
true,
567 const std::string &delimiter =
" \t",
int smilesColumn = 0,
568 int nameColumn = 1,
bool titleLine =
true,
bool sanitize =
true,
569 unsigned int numWriterThreads = 1,
size_t sizeInputQueue = 5,
570 size_t sizeOutputQueue = 5);
571 MultithreadedSmilesMolSupplier();
572 ~MultithreadedSmilesMolSupplier()
override;
574 void init()
override {}
576 bool getEnd()
const override;
578 void processTitleLine();
580 bool extractNextRecord(std::string &record,
unsigned int &lineNum,
581 unsigned int &index)
override;
583 ROMol *processMoleculeRecord(
const std::string &record,
584 unsigned int lineNum)
override;
587 void initFromSettings(
bool takeOwnership,
const std::string &delimiter,
588 int smilesColumn,
int nameColumn,
bool titleLine,
589 bool sanitize,
unsigned int numWriterThreads,
590 size_t sizeInputQueue,
size_t sizeOutputQueue);
596 bool df_sanitize =
true;
598 bool df_title =
true;
601 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
Deprecated, will be removed in 2024.09 release.
PDBMolSupplier(const std::string &fname, bool sanitize=true, bool removeHs=true, unsigned int flavor=0, bool proximityBonding=true)
PDBMolSupplier(std::istream *inStream, bool takeOwnership=true, bool sanitize=true, bool removeHs=true, unsigned int flavor=0, bool proximityBonding=true)
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)
Deprecated, will be removed in 2024.09 release.
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