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 atom.
32  */
33  std::string GetAtomSmiles(const Atom *atom,bool doKekule=false,
34  const Bond *bondIn=0,
35  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 SMILES
59  \param allBondsExplicit : if true, symbols will be included for all bonds.
60  \param allHsExplicit : if true, hydrogen counts will be provided for every atom.
61  */
62  std::string MolToSmiles(const ROMol &mol,bool doIsomericSmiles=false,
63  bool doKekule=false,int rootedAtAtom=-1,
64  bool canonical=true,
65  bool allBondsExplicit=false,
66  bool allHsExplicit=false);
67 
68  //! \brief returns canonical SMILES for part of a molecule
69  /*!
70  \param mol : the molecule in question.
71  \param atomsToUse : indices of the atoms in the fragment
72  \param bondsToUse : indices of the bonds in the fragment. If this is not provided,
73  all bonds between the atoms in atomsToUse will be included
74  \param atomSymbols : symbols to use for the atoms in the output SMILES
75  \param bondSymbols : sybmols to use for the bonds in the output SMILES
76  \param doIsomericSmiles : include stereochemistry and isotope information
77  in the SMILES
78  \param doKekule : do Kekule smiles (i.e. don't use aromatic bonds)
79  \param rootedAtAtom : make sure the SMILES starts at the specified atom.
80  The resulting SMILES is not, of course, canonical.
81  \param canonical : if false, no attempt will be made to canonicalize the SMILES
82  \param allBondsExplicit : if true, symbols will be included for all bonds.
83  \param allHsExplicit : if true, hydrogen counts will be provided for every atom.
84 
85  \b NOTE: the bondSymbols are *not* currently used in the canonicalization.
86 
87  */
88  std::string MolFragmentToSmiles(const ROMol &mol,
89  const std::vector<int> &atomsToUse,
90  const std::vector<int> *bondsToUse=0,
91  const std::vector<std::string> *atomSymbols=0,
92  const std::vector<std::string> *bondSymbols=0,
93  bool doIsomericSmiles=false,
94  bool doKekule=false,int rootedAtAtom=-1,
95  bool canonical=true,
96  bool allBondsExplicit=false,
97  bool allHsExplicit=false);
98 
99 }
100 #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:105
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:28
bool inOrganicSubset(int atomicNumber)
returns true if the atom number is in the SMILES organic subset
class for representing a bond
Definition: Bond.h:46
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:67