RDKit
Open-source cheminformatics and machine learning.
SmilesWrite.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2002-2017 Greg Landrum and Rational Discovery LLC
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 #include <RDGeneral/export.h>
11 #ifndef _RD_SMILESWRITE_H
12 #define _RD_SMILESWRITE_H
13 
14 #include <string>
15 #include <vector>
16 #include <memory>
17 
18 namespace RDKit {
19 class Atom;
20 class Bond;
21 class ROMol;
22 namespace SmilesWrite {
23 
24 //! \brief returns the cxsmiles data for a molecule
25 RDKIT_SMILESPARSE_EXPORT std::string getCXExtensions(const ROMol &mol);
26 
27 
28 //! \brief returns true if the atom number is in the SMILES organic subset
29 RDKIT_SMILESPARSE_EXPORT bool inOrganicSubset(int atomicNumber);
30 
31 //! \brief returns the SMILES for an atom
32 /*!
33  \param atom : the atom to work with
34  \param doKekule : we're doing kekulized smiles (e.g. don't use
35  lower case for the atom label)
36  \param bondIn : the bond we came into the atom on (used for
37  chirality calculation
38  \param allHsExplicit : if true, hydrogen counts will be provided for every
39  atom.
40  \param isomericSmiles : if true, isomeric SMILES will be generated
41 */
42 RDKIT_SMILESPARSE_EXPORT std::string GetAtomSmiles(const Atom *atom,
43  bool doKekule = false,
44  const Bond *bondIn = 0,
45  bool allHsExplicit = false,
46  bool isomericSmiles = true);
47 
48 //! \brief returns the SMILES for a bond
49 /*!
50  \param bond : the bond to work with
51  \param atomToLeftIdx : the index of the atom preceding \c bond
52  in the SMILES
53  \param doKekule : we're doing kekulized smiles (e.g. write out
54  bond orders for aromatic bonds)
55  \param allBondsExplicit : if true, symbols will be included for all bonds.
56 */
58  const Bond *bond, int atomToLeftIdx = -1, bool doKekule = false,
59  bool allBondsExplicit = false);
60 } // namespace SmilesWrite
61 
62 //! \brief returns canonical SMILES for a molecule
63 /*!
64  \param mol : the molecule in question.
65  \param doIsomericSmiles : include stereochemistry and isotope information
66  in the SMILES
67  \param doKekule : do Kekule smiles (i.e. don't use aromatic bonds)
68  \param rootedAtAtom : make sure the SMILES starts at the specified atom.
69  The resulting SMILES is not, of course, canonical.
70  \param canonical : if false, no attempt will be made to canonicalize the
71  SMILES
72  \param allBondsExplicit : if true, symbols will be included for all bonds.
73  \param allHsExplicit : if true, hydrogen counts will be provided for every
74  atom.
75  */
77  const ROMol &mol, bool doIsomericSmiles = true, bool doKekule = false,
78  int rootedAtAtom = -1, bool canonical = true, bool allBondsExplicit = false,
79  bool allHsExplicit = false, bool doRandom = false);
80 
81 //! \brief returns canonical SMILES for part of a molecule
82 /*!
83  \param mol : the molecule in question.
84  \param atomsToUse : indices of the atoms in the fragment
85  \param bondsToUse : indices of the bonds in the fragment. If this is not
86  provided,
87  all bonds between the atoms in atomsToUse will be included
88  \param atomSymbols : symbols to use for the atoms in the output SMILES
89  \param bondSymbols : sybmols to use for the bonds in the output SMILES
90  \param doIsomericSmiles : include stereochemistry and isotope information
91  in the SMILES
92  \param doKekule : do Kekule smiles (i.e. don't use aromatic bonds)
93  \param rootedAtAtom : make sure the SMILES starts at the specified atom.
94  The resulting SMILES is not, of course, canonical.
95  \param canonical : if false, no attempt will be made to canonicalize the
96  SMILES
97  \param allBondsExplicit : if true, symbols will be included for all bonds.
98  \param allHsExplicit : if true, hydrogen counts will be provided for every
99  atom.
100 
101  \b NOTE: the bondSymbols are *not* currently used in the canonicalization.
102 
103  */
105  const ROMol &mol, const std::vector<int> &atomsToUse,
106  const std::vector<int> *bondsToUse = 0,
107  const std::vector<std::string> *atomSymbols = 0,
108  const std::vector<std::string> *bondSymbols = 0,
109  bool doIsomericSmiles = true, bool doKekule = false, int rootedAtAtom = -1,
110  bool canonical = true, bool allBondsExplicit = false,
111  bool allHsExplicit = false);
112 
113 
114 //! \brief returns canonical CXSMILES for a molecule
115 /*!
116  \param mol : the molecule in question.
117  \param doIsomericSmiles : include stereochemistry and isotope information
118  in the SMILES
119  \param doKekule : do Kekule smiles (i.e. don't use aromatic bonds)
120  \param rootedAtAtom : make sure the SMILES starts at the specified atom.
121  The resulting SMILES is not, of course, canonical.
122  \param canonical : if false, no attempt will be made to canonicalize the
123  SMILES
124  \param allBondsExplicit : if true, symbols will be included for all bonds.
125  \param allHsExplicit : if true, hydrogen counts will be provided for every
126  atom.
127  */
129  const ROMol &mol, bool doIsomericSmiles = true, bool doKekule = false,
130  int rootedAtAtom = -1, bool canonical = true, bool allBondsExplicit = false,
131  bool allHsExplicit = false, bool doRandom = false);
132 
133 //! \brief returns canonical CXSMILES for part of a molecule
134 /*!
135  \param mol : the molecule in question.
136  \param atomsToUse : indices of the atoms in the fragment
137  \param bondsToUse : indices of the bonds in the fragment. If this is not
138  provided,
139  all bonds between the atoms in atomsToUse will be included
140  \param atomSymbols : symbols to use for the atoms in the output SMILES
141  \param bondSymbols : sybmols to use for the bonds in the output SMILES
142  \param doIsomericSmiles : include stereochemistry and isotope information
143  in the SMILES
144  \param doKekule : do Kekule smiles (i.e. don't use aromatic bonds)
145  \param rootedAtAtom : make sure the SMILES starts at the specified atom.
146  The resulting SMILES is not, of course, canonical.
147  \param canonical : if false, no attempt will be made to canonicalize the
148  SMILES
149  \param allBondsExplicit : if true, symbols will be included for all bonds.
150  \param allHsExplicit : if true, hydrogen counts will be provided for every
151  atom.
152 
153  \b NOTE: the bondSymbols are *not* currently used in the canonicalization.
154 
155  */
157  const ROMol &mol, const std::vector<int> &atomsToUse,
158  const std::vector<int> *bondsToUse = 0,
159  const std::vector<std::string> *atomSymbols = 0,
160  const std::vector<std::string> *bondSymbols = 0,
161  bool doIsomericSmiles = true, bool doKekule = false, int rootedAtAtom = -1,
162  bool canonical = true, bool allBondsExplicit = false,
163  bool allHsExplicit = false);
164 
165 } // namespace RDKit
166 #endif
RDKIT_SMILESPARSE_EXPORT std::string MolFragmentToCXSmiles(const ROMol &mol, const std::vector< int > &atomsToUse, const std::vector< int > *bondsToUse=0, const std::vector< std::string > *atomSymbols=0, const std::vector< std::string > *bondSymbols=0, bool doIsomericSmiles=true, bool doKekule=false, int rootedAtAtom=-1, bool canonical=true, bool allBondsExplicit=false, bool allHsExplicit=false)
returns canonical CXSMILES for part of a molecule
RDKIT_SMILESPARSE_EXPORT bool inOrganicSubset(int atomicNumber)
returns true if the atom number is in the SMILES organic subset
RDKIT_SMILESPARSE_EXPORT std::string getCXExtensions(const ROMol &mol)
returns the cxsmiles data for a molecule
RDKIT_SMILESPARSE_EXPORT std::string MolToSmiles(const ROMol &mol, bool doIsomericSmiles=true, bool doKekule=false, int rootedAtAtom=-1, bool canonical=true, bool allBondsExplicit=false, bool allHsExplicit=false, bool doRandom=false)
returns canonical SMILES for a molecule
RDKIT_SMILESPARSE_EXPORT std::string GetBondSmiles(const Bond *bond, int atomToLeftIdx=-1, bool doKekule=false, bool allBondsExplicit=false)
returns the SMILES for a bond
RDKIT_SMILESPARSE_EXPORT std::string GetAtomSmiles(const Atom *atom, bool doKekule=false, const Bond *bondIn=0, bool allHsExplicit=false, bool isomericSmiles=true)
returns the SMILES for an atom
RDKIT_SMILESPARSE_EXPORT std::string MolToCXSmiles(const ROMol &mol, bool doIsomericSmiles=true, bool doKekule=false, int rootedAtAtom=-1, bool canonical=true, bool allBondsExplicit=false, bool allHsExplicit=false, bool doRandom=false)
returns canonical CXSMILES for a molecule
#define RDKIT_SMILESPARSE_EXPORT
Definition: export.h:619
Std stuff.
Definition: Atom.h:30
class for representing a bond
Definition: Bond.h:47
RDKIT_SMILESPARSE_EXPORT std::string MolFragmentToSmiles(const ROMol &mol, const std::vector< int > &atomsToUse, const std::vector< int > *bondsToUse=0, const std::vector< std::string > *atomSymbols=0, const std::vector< std::string > *bondSymbols=0, bool doIsomericSmiles=true, bool doKekule=false, int rootedAtAtom=-1, bool canonical=true, bool allBondsExplicit=false, bool allHsExplicit=false)
returns canonical SMILES for part of a molecule
The class for representing atoms.
Definition: Atom.h:69