RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
MultithreadedSmilesMolSupplier.h
Go to the documentation of this file.
1//
2// Copyright (C) 2020 Shrey Aryan
3//
4// @@ All Rights Reserved @@
5// This file is part of the RDKit.
6// The contents are covered by the terms of the BSD license
7// which is included in the file license.txt, found at the root
8// of the RDKit source tree.
9//
10#ifdef RDK_BUILD_THREADSAFE_SSS
11#ifndef MULTITHREADED_SMILES_MOL_SUPPLIER
12#define MULTITHREADED_SMILES_MOL_SUPPLIER
14namespace RDKit {
15//! This class is still a bit experimental and the public API may change
16//! in future releases.
19 public:
20 explicit MultithreadedSmilesMolSupplier(
21 const std::string &fileName, const std::string &delimiter = " \t",
22 int smilesColumn = 0, int nameColumn = 1, bool titleLine = true,
23 bool sanitize = true, unsigned int numWriterThreads = 1,
24 size_t sizeInputQueue = 5, size_t sizeOutputQueue = 5);
25
26 explicit MultithreadedSmilesMolSupplier(
27 std::istream *inStream, bool takeOwnership = true,
28 const std::string &delimiter = " \t", int smilesColumn = 0,
29 int nameColumn = 1, bool titleLine = true, bool sanitize = true,
30 unsigned int numWriterThreads = 1, size_t sizeInputQueue = 5,
31 size_t sizeOutputQueue = 5);
32 MultithreadedSmilesMolSupplier();
33 ~MultithreadedSmilesMolSupplier() override;
34
35 void init() override {}
36 //! returns df_end
37 bool getEnd() const override;
38 //! reads and processes the title line
39 void processTitleLine();
40 //! reads next record and returns whether or not EOF was hit
41 bool extractNextRecord(std::string &record, unsigned int &lineNum,
42 unsigned int &index) override;
43 //! parses the record and returns the resulting molecule
44 ROMol *processMoleculeRecord(const std::string &record,
45 unsigned int lineNum) override;
46
47 private:
48 void initFromSettings(bool takeOwnership, const std::string &delimiter,
49 int smilesColumn, int nameColumn, bool titleLine,
50 bool sanitize, unsigned int numWriterThreads,
51 size_t sizeInputQueue, size_t sizeOutputQueue);
52
53 private:
54 bool df_end = false; //!< have we reached the end of the file?
55 int d_line = 0; //!< line number we are currently on
56 std::string d_delim; //!< the delimiter string
57 bool df_sanitize = true; //!< sanitize molecules before returning them?
58 STR_VECT d_props; //!< vector of property names
59 bool df_title = true; //!< do we have a title line?
60 int d_smi = 0; //!< column id for the smile string
61 int d_name = 1; //!< column id for the name
62 unsigned int d_currentRecordId = 1; //!< current record id
63};
64} // namespace RDKit
65#endif
66#endif
#define RDKIT_FILEPARSERS_EXPORT
Definition export.h:161
Std stuff.
std::vector< std::string > STR_VECT
Definition Dict.h:29
bool rdvalue_is(const RDValue_cast_t)