RDKit
Open-source cheminformatics and machine learning.
SmilesWrite.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2002-2012 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 #ifndef _RD_SMILESWRITE_H
11 #define _RD_SMILESWRITE_H
12 
13 #include <string>
14 #include <vector>
15 
16 namespace RDKit {
17 class Atom;
18 class Bond;
19 class ROMol;
20 namespace SmilesWrite {
21 //! \brief returns true if the atom number is in the SMILES organic subset
22 bool inOrganicSubset(int atomicNumber);
23 
24 //! \brief returns the SMILES for an atom
25 /*!
26  \param atom : the atom to work with
27  \param doKekule : we're doing kekulized smiles (e.g. don't use
28  lower case for the atom label)
29  \param bondIn : the bond we came into the atom on (used for
30  chirality calculation
31  \param allHsExplicit : if true, hydrogen counts will be provided for every
32  atom.
33 */
34 std::string GetAtomSmiles(const Atom *atom, bool doKekule = false,
35  const Bond *bondIn = 0, bool allHsExplicit = false);
36 
37 //! \brief returns the SMILES for a bond
38 /*!
39  \param bond : the bond to work with
40  \param atomToLeftIdx : the index of the atom preceding \c bond
41  in the SMILES
42  \param doKekule : we're doing kekulized smiles (e.g. write out
43  bond orders for aromatic bonds)
44  \param allBondsExplicit : if true, symbols will be included for all bonds.
45 */
46 std::string GetBondSmiles(const Bond *bond, int atomToLeftIdx = -1,
47  bool doKekule = false, bool allBondsExplicit = false);
48 }
49 
50 //! \brief returns canonical SMILES for a molecule
51 /*!
52  \param mol : the molecule in question.
53  \param doIsomericSmiles : include stereochemistry and isotope information
54  in the SMILES
55  \param doKekule : do Kekule smiles (i.e. don't use aromatic bonds)
56  \param rootedAtAtom : make sure the SMILES starts at the specified atom.
57  The resulting SMILES is not, of course, canonical.
58  \param canonical : if false, no attempt will be made to canonicalize the
59  SMILES
60  \param allBondsExplicit : if true, symbols will be included for all bonds.
61  \param allHsExplicit : if true, hydrogen counts will be provided for every
62  atom.
63  */
64 std::string MolToSmiles(const ROMol &mol, bool doIsomericSmiles = false,
65  bool doKekule = false, int rootedAtAtom = -1,
66  bool canonical = true, bool allBondsExplicit = false,
67  bool allHsExplicit = false);
68 
69 //! \brief returns canonical SMILES for part of a molecule
70 /*!
71  \param mol : the molecule in question.
72  \param atomsToUse : indices of the atoms in the fragment
73  \param bondsToUse : indices of the bonds in the fragment. If this is not
74  provided,
75  all bonds between the atoms in atomsToUse will be included
76  \param atomSymbols : symbols to use for the atoms in the output SMILES
77  \param bondSymbols : sybmols to use for the bonds in the output SMILES
78  \param doIsomericSmiles : include stereochemistry and isotope information
79  in the SMILES
80  \param doKekule : do Kekule smiles (i.e. don't use aromatic bonds)
81  \param rootedAtAtom : make sure the SMILES starts at the specified atom.
82  The resulting SMILES is not, of course, canonical.
83  \param canonical : if false, no attempt will be made to canonicalize the
84  SMILES
85  \param allBondsExplicit : if true, symbols will be included for all bonds.
86  \param allHsExplicit : if true, hydrogen counts will be provided for every
87  atom.
88 
89  \b NOTE: the bondSymbols are *not* currently used in the canonicalization.
90 
91  */
92 std::string MolFragmentToSmiles(const ROMol &mol,
93  const std::vector<int> &atomsToUse,
94  const std::vector<int> *bondsToUse = 0,
95  const std::vector<std::string> *atomSymbols = 0,
96  const std::vector<std::string> *bondSymbols = 0,
97  bool doIsomericSmiles = false,
98  bool doKekule = false, int rootedAtAtom = -1,
99  bool canonical = true,
100  bool allBondsExplicit = false,
101  bool allHsExplicit = false);
102 }
103 #endif
std::string MolToSmiles(const ROMol &mol, bool doIsomericSmiles=false, bool doKekule=false, int rootedAtAtom=-1, bool canonical=true, bool allBondsExplicit=false, bool allHsExplicit=false)
returns canonical SMILES for a molecule
std::string GetBondSmiles(const Bond *bond, int atomToLeftIdx=-1, bool doKekule=false, bool allBondsExplicit=false)
returns the SMILES for a bond
ROMol is a molecule class that is intended to have a fixed topology.
Definition: ROMol.h:103
std::string GetAtomSmiles(const Atom *atom, bool doKekule=false, const Bond *bondIn=0, bool allHsExplicit=false)
returns the SMILES for an atom
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:29
bool inOrganicSubset(int atomicNumber)
returns true if the atom number is in the SMILES organic subset
class for representing a bond
Definition: Bond.h:47
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=false, 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:68