 |
RDKit
Open-source cheminformatics and machine learning.
|
Go to the documentation of this file.
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 = NULL);
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;
void setWriteNames(bool state=true)
void write(const ROMol &mol, int confId=defaultConfId)
write a new molecule to the file
Defines the primary molecule class ROMol as well as associated typedefs.
PDBWriter(const std::string &fileName, unsigned int flavor=0)
void flush()
flush the ostream
unsigned int numMols() const
get the number of molecules written so far
#define RDKIT_FILEPARSERS_EXPORT
void close()
close our stream (the writer cannot be used again)
unsigned int numMols() const
get the number of molecules written so far
virtual void write(const ROMol &mol, int confId=defaultConfId)=0
void setProps(const STR_VECT &propNames)
set a vector of property names that are need to be written out for each molecule
void setProps(const STR_VECT &propNames)
set a vector of property names that are need to be written out for each molecule
unsigned int numMols() const
get the number of molecules written so far
std::vector< std::string > STR_VECT
TDTWriter(std::ostream *outStream, bool takeOwnership=false)
bool getWriteNames() const
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...
virtual unsigned int numMols() const =0
bool getForceV3000() const
virtual void setProps(const STR_VECT &propNames)=0
unsigned int numMols() const
get the number of molecules written so far
void setProps(const STR_VECT &)
void setForceV3000(bool val)
void close()
close our stream (the writer cannot be used again)
void write(const ROMol &mol, int confId=defaultConfId)
write a new molecule to the file
void write(const ROMol &mol, int confId=defaultConfId)
write a new molecule to the file
void close()
close our stream (the writer cannot be used again)
#define PRECONDITION(expr, mess)
PDBWriter(std::ostream *outStream, bool takeOwnership=false, unsigned int flavor=0)
void setKekulize(bool val)
TDTWriter(const std::string &fileName)
static std::string getText(const ROMol &mol, int confId=defaultConfId, bool kekulize=true, bool force_V3000=false, int molid=-1, STR_VECT *propNames=NULL)
return the text that would be written to the file
void setNumDigits(unsigned int numDigits)
void write(const ROMol &mol, int confId=defaultConfId)
write a new molecule to the file
SmilesWriter(const std::string &fileName, const std::string &delimiter=" ", const std::string &nameHeader="Name", bool includeHeader=true, bool isomericSmiles=true, bool kekuleSmiles=false)
void setWrite2D(bool state=true)
void flush()
flush the ostream
SDWriter(const std::string &fileName)
void flush()
flush the ostream
SDWriter(std::ostream *outStream, bool takeOwnership=false)
unsigned int getNumDigits() const