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 &) {
101 unsigned int numMols()
const {
return d_molid; };
105 void init(
const std::string &delimiter,
const std::string &nameHeader,
106 bool includeHeader,
bool isomericSmiles,
bool kekuleSmiles);
109 void dumpHeader()
const;
111 std::ostream *dp_ostream;
113 bool df_includeHeader;
114 unsigned int d_molid;
116 std::string d_nameHeader;
118 bool df_isomericSmiles;
119 bool df_kekuleSmiles;
137 SDWriter(std::ostream *outStream,
bool takeOwnership =
false);
147 bool kekulize =
true,
bool force_V3000 =
false,
148 int molid = -1,
STR_VECT *propNames =
nullptr);
160 if (dp_ostream->good()) dp_ostream->setstate(std::ios::badbit);
161 }
catch (
const std::runtime_error &) {
173 dp_ostream =
nullptr;
177 unsigned int numMols()
const {
return d_molid; };
186 void writeProperty(
const ROMol &mol,
const std::string &name);
188 std::ostream *dp_ostream;
190 unsigned int d_molid;
211 TDTWriter(std::ostream *outStream,
bool takeOwnership =
false);
229 if (dp_ostream->good()) dp_ostream->setstate(std::ios::badbit);
230 }
catch (
const std::runtime_error &) {
238 if (dp_ostream && d_molid > 0) {
239 *dp_ostream <<
"|\n";
246 dp_ostream =
nullptr;
250 unsigned int numMols()
const {
return d_molid; };
258 void setNumDigits(
unsigned int numDigits) { d_numDigits = numDigits; };
262 void writeProperty(
const ROMol &mol,
const std::string &name);
264 std::ostream *dp_ostream;
266 unsigned int d_molid;
278 PDBWriter(
const std::string &fileName,
unsigned int flavor = 0);
279 PDBWriter(std::ostream *outStream,
bool takeOwnership =
false,
280 unsigned int flavor = 0);
295 if (dp_ostream->good()) dp_ostream->setstate(std::ios::badbit);
296 }
catch (
const std::runtime_error &) {
308 dp_ostream =
nullptr;
312 unsigned int numMols()
const {
return d_count; };
315 std::ostream *dp_ostream;
316 unsigned int d_flavor;
317 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
void write(const ROMol &mol, int confId=defaultConfId)
write a new molecule to the file
PDBWriter(const std::string &fileName, unsigned int flavor=0)
PDBWriter(std::ostream *outStream, bool takeOwnership=false, unsigned int flavor=0)
void setProps(const STR_VECT &)
void close()
close our stream (the writer cannot be used again)
void flush()
flush the ostream
unsigned int numMols() const
get the number of molecules written so far
unsigned int numMols() const
get the number of molecules written so far
bool getForceV3000() const
SDWriter(std::ostream *outStream, bool takeOwnership=false)
void write(const ROMol &mol, int confId=defaultConfId)
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 setForceV3000(bool val)
void setProps(const STR_VECT &propNames)
set a vector of property names that are need to be written out for each molecule
SDWriter(const std::string &fileName)
void flush()
flush the ostream
void close()
close our stream (the writer cannot be used again)
void setKekulize(bool val)
unsigned int numMols() const
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 setProps(const STR_VECT &propNames)
set a vector of property names that are need to be written out for each molecule
void close()
close our stream (the writer cannot be used again)
void flush()
flush the ostream
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 write(const ROMol &mol, int confId=defaultConfId)
write a new molecule to the file
void setNumDigits(unsigned int numDigits)
void flush()
flush the ostream
void setWrite2D(bool state=true)
unsigned int getNumDigits() const
void close()
close our stream (the writer cannot be used again)
TDTWriter(std::ostream *outStream, bool takeOwnership=false)
TDTWriter(const std::string &fileName)
void write(const ROMol &mol, int confId=defaultConfId)
write a new molecule to the file
void setWriteNames(bool state=true)
void setProps(const STR_VECT &propNames)
set a vector of property names that are need to be written out for each molecule
bool getWriteNames() const
unsigned int numMols() const
get the number of molecules written so far
#define RDKIT_FILEPARSERS_EXPORT
std::vector< std::string > STR_VECT