11#ifndef RD_FILEPARSERS_H
12#define RD_FILEPARSERS_H
23#include <boost/shared_ptr.hpp>
30 :
public std::exception {
38 const char *
what() const noexcept
override {
return _msg.c_str(); }
66 bool strictParsing = true);
72 bool strictParsing = true);
86 bool strictParsing = true);
100 bool removeHs = true,
101 bool strictParsing = true);
115 bool includeStereo = true,
117 bool kekulize = true,
118 bool forceV3000 = false);
128inline std::
string MolToV3KMolBlock(const
ROMol &mol,
bool includeStereo = true,
129 int confId = -1,
bool kekulize = true) {
130 return MolToMolBlock(mol, includeStereo, confId, kekulize,
true);
146 const ROMol &mol,
const std::string &fName,
bool includeStereo =
true,
147 int confId = -1,
bool kekulize =
true,
bool forceV3000 =
false);
159 bool includeStereo =
true,
int confId = -1,
160 bool kekulize =
true) {
161 MolToMolFile(mol, fName, includeStereo, confId, kekulize,
true);
166 bool kekulize =
true);
169 const std::string &fName,
171 bool kekulize =
true);
177 const std::string &fName,
202 bool sanitize =
true,
203 bool skipFirstConf =
false);
221 bool sanitize =
true,
222 bool skipFirstConf =
false);
225 const ROMol &mol,
const std::string &partialChargeProp =
"_GasteigerCharge",
226 bool writeFirstConfTwice =
false);
228 const ROMol &mol,
const std::string &fName,
229 const std::string &partialChargeProp =
"_GasteigerCharge",
230 bool writeFirstConfTwice =
false);
252 bool sanitize =
true,
253 bool removeHs =
true,
255 bool cleanupSubstructures =
true);
268 std::istream *inStream,
bool sanitize =
true,
bool removeHs =
true,
269 Mol2Type variant = CORINA,
bool cleanupSubstructures =
true);
272 std::istream &inStream,
bool sanitize =
true,
bool removeHs =
true,
273 Mol2Type variant = CORINA,
bool cleanupSubstructures =
true);
286 const std::string &molBlock,
bool sanitize =
true,
bool removeHs =
true,
287 Mol2Type variant = CORINA,
bool cleanupSubstructures =
true);
302 bool sanitize =
true,
303 bool removeHs =
true,
304 unsigned int flavor = 0,
305 bool proximityBonding =
true);
308 bool sanitize =
true,
309 bool removeHs =
true,
310 unsigned int flavor = 0,
311 bool proximityBonding =
true);
313 std::istream *inStream,
bool sanitize =
true,
bool removeHs =
true,
314 unsigned int flavor = 0,
bool proximityBonding =
true);
316 std::istream &inStream,
bool sanitize =
true,
bool removeHs =
true,
317 unsigned int flavor = 0,
bool proximityBonding =
true);
319 bool sanitize =
true,
320 bool removeHs =
true,
321 unsigned int flavor = 0,
322 bool proximityBonding =
true);
338 unsigned int flavor = 0);
353 const std::string &fname,
355 unsigned int flavor = 0);
367 bool sanitize =
true,
368 bool removeHs =
true);
372 bool sanitize =
true,
373 bool removeHs =
true);
375inline std::unique_ptr<RDKit::RWMol>
operator"" _ctab(
const char *text,
377 std::string data(text, len);
378 RWMol *ptr =
nullptr;
384 return std::unique_ptr<RWMol>(ptr);
386inline std::unique_ptr<RDKit::RWMol>
operator"" _mol2(
const char *text,
388 std::string data(text, len);
389 RWMol *ptr =
nullptr;
395 return std::unique_ptr<RWMol>(ptr);
398inline std::unique_ptr<RDKit::RWMol>
operator"" _pdb(
const char *text,
400 std::string data(text, len);
401 RWMol *ptr =
nullptr;
407 return std::unique_ptr<RWMol>(ptr);
pulls in the core RDKit functionality
MolFileUnhandledFeatureException(const char *msg)
construct with an error message
MolFileUnhandledFeatureException(const std::string msg)
construct with an error message
~MolFileUnhandledFeatureException() noexcept override=default
const char * what() const noexcept override
get the error message
class for flagging sanitization errors
RWMol is a molecule class that is intended to be edited.
#define RDKIT_FILEPARSERS_EXPORT
RDKIT_FILEPARSERS_EXPORT RWMol * PDBFileToMol(const std::string &fname, bool sanitize=true, bool removeHs=true, unsigned int flavor=0, bool proximityBonding=true)
RDKIT_FILEPARSERS_EXPORT std::string strip(const std::string &orig)
RDKIT_FILEPARSERS_EXPORT void MolToMolFile(const ROMol &mol, const std::string &fName, bool includeStereo=true, int confId=-1, bool kekulize=true, bool forceV3000=false)
RDKIT_FILEPARSERS_EXPORT std::string MolToPDBBlock(const ROMol &mol, int confId=-1, unsigned int flavor=0)
RDKIT_FILEPARSERS_EXPORT RWMol * Mol2FileToMol(const std::string &fName, bool sanitize=true, bool removeHs=true, Mol2Type variant=CORINA, bool cleanupSubstructures=true)
bool rdvalue_is(const RDValue_cast_t)
RDKIT_FILEPARSERS_EXPORT std::string MolToXYZBlock(const ROMol &mol, int confId=-1)
RDKIT_FILEPARSERS_EXPORT RWMol * PDBBlockToMol(const char *str, bool sanitize=true, bool removeHs=true, unsigned int flavor=0, bool proximityBonding=true)
RDKIT_FILEPARSERS_EXPORT void MolToXYZFile(const ROMol &mol, const std::string &fName, int confId=-1)
RDKIT_FILEPARSERS_EXPORT RWMol * MolBlockToMol(const std::string &molBlock, bool sanitize=true, bool removeHs=true, bool strictParsing=true)
RDKIT_FILEPARSERS_EXPORT std::string MolToTPLText(const ROMol &mol, const std::string &partialChargeProp="_GasteigerCharge", bool writeFirstConfTwice=false)
RDKIT_FILEPARSERS_EXPORT void MolToPDBFile(const ROMol &mol, const std::string &fname, int confId=-1, unsigned int flavor=0)
RDKIT_FILEPARSERS_EXPORT void MolToCMLFile(const ROMol &mol, const std::string &fName, int confId=-1, bool kekulize=true)
RDKIT_FILEPARSERS_EXPORT RWMol * RDKitSVGToMol(const std::string &svg, bool sanitize=true, bool removeHs=true)
RDKIT_FILEPARSERS_EXPORT RWMol * TPLDataStreamToMol(std::istream *inStream, unsigned int &line, bool sanitize=true, bool skipFirstConf=false)
translate TPL data (BioCad format) into a multi-conf molecule
void MolToV3KMolFile(const ROMol &mol, const std::string &fName, bool includeStereo=true, int confId=-1, bool kekulize=true)
RDKIT_FILEPARSERS_EXPORT RWMol * XYZBlockToMol(const std::string &xyzBlock)
RDKIT_FILEPARSERS_EXPORT RWMol * XYZDataStreamToMol(std::istream &inStream)
RDKIT_FILEPARSERS_EXPORT std::string MolToMolBlock(const ROMol &mol, bool includeStereo=true, int confId=-1, bool kekulize=true, bool forceV3000=false)
RDKIT_FILEPARSERS_EXPORT RWMol * Mol2DataStreamToMol(std::istream *inStream, bool sanitize=true, bool removeHs=true, Mol2Type variant=CORINA, bool cleanupSubstructures=true)
RDKIT_FILEPARSERS_EXPORT RWMol * XYZFileToMol(const std::string &fName)
RDKIT_FILEPARSERS_EXPORT std::string MolToCMLBlock(const ROMol &mol, int confId=-1, bool kekulize=true)
@ CORINA
supports output from Corina and some dbtranslate output
RDKIT_FILEPARSERS_EXPORT void MolToTPLFile(const ROMol &mol, const std::string &fName, const std::string &partialChargeProp="_GasteigerCharge", bool writeFirstConfTwice=false)
RDKIT_FILEPARSERS_EXPORT RWMol * Mol2BlockToMol(const std::string &molBlock, bool sanitize=true, bool removeHs=true, Mol2Type variant=CORINA, bool cleanupSubstructures=true)
RDKIT_FILEPARSERS_EXPORT RWMol * TPLFileToMol(const std::string &fName, bool sanitize=true, bool skipFirstConf=false)
construct a multi-conf molecule from a TPL (BioCad format) file
const int MOLFILE_MAXLINE
std::vector< RWMOL_SPTR > RWMOL_SPTR_VECT
RDKIT_FILEPARSERS_EXPORT RWMol * PDBDataStreamToMol(std::istream *inStream, bool sanitize=true, bool removeHs=true, unsigned int flavor=0, bool proximityBonding=true)
boost::shared_ptr< RWMol > RWMOL_SPTR