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