12 #ifndef _RD_MOLWRITERS_H_
13 #define _RD_MOLWRITERS_H_
58 SmilesWriter(
const std::string &fileName,
const std::string &delimiter =
" ",
59 const std::string &nameHeader =
"Name",
60 bool includeHeader =
true,
bool isomericSmiles =
true,
61 bool kekuleSmiles =
false);
64 std::string nameHeader =
"Name",
bool includeHeader =
true,
65 bool takeOwnership =
false,
bool isomericSmiles =
true,
66 bool kekuleSmiles =
false);
84 if (dp_ostream->good()) dp_ostream->setstate(std::ios::badbit);
85 }
catch (
const std::runtime_error &) {
103 unsigned int numMols()
const override {
return d_molid; }
107 void init(
const std::string &delimiter,
const std::string &nameHeader,
108 bool includeHeader,
bool isomericSmiles,
bool kekuleSmiles);
111 void dumpHeader()
const;
113 std::ostream *dp_ostream;
115 bool df_includeHeader;
116 unsigned int d_molid;
118 std::string d_nameHeader;
120 bool df_isomericSmiles;
121 bool df_kekuleSmiles;
139 SDWriter(std::ostream *outStream,
bool takeOwnership =
false);
149 bool kekulize =
true,
bool force_V3000 =
false,
150 int molid = -1,
STR_VECT *propNames =
nullptr);
162 if (dp_ostream->good()) dp_ostream->setstate(std::ios::badbit);
163 }
catch (
const std::runtime_error &) {
177 dp_ostream =
nullptr;
181 unsigned int numMols()
const override {
return d_molid; }
190 void writeProperty(
const ROMol &mol,
const std::string &name);
192 std::ostream *dp_ostream;
194 unsigned int d_molid;
215 TDTWriter(std::ostream *outStream,
bool takeOwnership =
false);
233 if (dp_ostream->good()) dp_ostream->setstate(std::ios::badbit);
234 }
catch (
const std::runtime_error &) {
244 *dp_ostream <<
"|\n";
252 dp_ostream =
nullptr;
256 unsigned int numMols()
const override {
return d_molid; }
268 void writeProperty(
const ROMol &mol,
const std::string &name);
270 std::ostream *dp_ostream;
272 unsigned int d_molid;
284 PDBWriter(
const std::string &fileName,
unsigned int flavor = 0);
285 PDBWriter(std::ostream *outStream,
bool takeOwnership =
false,
286 unsigned int flavor = 0);
301 if (dp_ostream->good()) dp_ostream->setstate(std::ios::badbit);
302 }
catch (
const std::runtime_error &) {
316 dp_ostream =
nullptr;
320 unsigned int numMols()
const override {
return d_count; }
323 std::ostream *dp_ostream;
324 unsigned int d_flavor;
325 unsigned int d_count;
#define PRECONDITION(expr, mess)
Defines the primary molecule class ROMol as well as associated typedefs.
virtual void write(const ROMol &mol, int confId=defaultConfId)=0
virtual void setProps(const STR_VECT &propNames)=0
virtual unsigned int numMols() const =0
PDBWriter(const std::string &fileName, unsigned int flavor=0)
void write(const ROMol &mol, int confId=defaultConfId) override
write a new molecule to the file
void flush() override
flush the ostream
PDBWriter(std::ostream *outStream, bool takeOwnership=false, unsigned int flavor=0)
void setProps(const STR_VECT &) override
unsigned int numMols() const override
get the number of molecules written so far
void close() override
close our stream (the writer cannot be used again)
bool getForceV3000() const
unsigned int numMols() const override
get the number of molecules written so far
SDWriter(std::ostream *outStream, bool takeOwnership=false)
void flush() override
flush the ostream
void setProps(const STR_VECT &propNames) override
set a vector of property names that are need to be written out for each molecule
void write(const ROMol &mol, int confId=defaultConfId) override
write a new molecule to the file
static std::string getText(const ROMol &mol, int confId=defaultConfId, bool kekulize=true, bool force_V3000=false, int molid=-1, STR_VECT *propNames=nullptr)
return the text that would be written to the file
void close() override
close our stream (the writer cannot be used again)
void setForceV3000(bool val)
SDWriter(const std::string &fileName)
void setKekulize(bool val)
unsigned int numMols() const override
get the number of molecules written so far
SmilesWriter(const std::string &fileName, const std::string &delimiter=" ", const std::string &nameHeader="Name", bool includeHeader=true, bool isomericSmiles=true, bool kekuleSmiles=false)
void write(const ROMol &mol, int confId=defaultConfId) override
write a new molecule to the file
SmilesWriter(std::ostream *outStream, std::string delimiter=" ", std::string nameHeader="Name", bool includeHeader=true, bool takeOwnership=false, bool isomericSmiles=true, bool kekuleSmiles=false)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setProps(const STR_VECT &propNames) override
set a vector of property names that are need to be written out for each molecule
void close() override
close our stream (the writer cannot be used again)
void flush() override
flush the ostream
void setNumDigits(unsigned int numDigits)
void setWrite2D(bool state=true)
void setProps(const STR_VECT &propNames) override
set a vector of property names that are need to be written out for each molecule
unsigned int numMols() const override
get the number of molecules written so far
unsigned int getNumDigits() const
TDTWriter(std::ostream *outStream, bool takeOwnership=false)
void close() override
close our stream (the writer cannot be used again)
TDTWriter(const std::string &fileName)
void write(const ROMol &mol, int confId=defaultConfId) override
write a new molecule to the file
void setWriteNames(bool state=true)
void flush() override
flush the ostream
bool getWriteNames() const
#define RDKIT_FILEPARSERS_EXPORT
std::vector< std::string > STR_VECT