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 //! \brief returns true if the atom number is in the SMILES organic subset
24 RDKIT_SMILESPARSE_EXPORT bool inOrganicSubset(int atomicNumber);
25 
26 //! \brief returns the SMILES for an atom
27 /*!
28  \param atom : the atom to work with
29  \param doKekule : we're doing kekulized smiles (e.g. don't use
30  lower case for the atom label)
31  \param bondIn : the bond we came into the atom on (used for
32  chirality calculation
33  \param allHsExplicit : if true, hydrogen counts will be provided for every
34  atom.
35  \param isomericSmiles : if true, isomeric SMILES will be generated
36 */
37 RDKIT_SMILESPARSE_EXPORT std::string GetAtomSmiles(const Atom *atom,
38  bool doKekule = false,
39  const Bond *bondIn = 0,
40  bool allHsExplicit = false,
41  bool isomericSmiles = true);
42 
43 //! \brief returns the SMILES for a bond
44 /*!
45  \param bond : the bond to work with
46  \param atomToLeftIdx : the index of the atom preceding \c bond
47  in the SMILES
48  \param doKekule : we're doing kekulized smiles (e.g. write out
49  bond orders for aromatic bonds)
50  \param allBondsExplicit : if true, symbols will be included for all bonds.
51 */
53  const Bond *bond, int atomToLeftIdx = -1, bool doKekule = false,
54  bool allBondsExplicit = false);
55 } // namespace SmilesWrite
56 
57 //! \brief returns canonical SMILES for a molecule
58 /*!
59  \param mol : the molecule in question.
60  \param doIsomericSmiles : include stereochemistry and isotope information
61  in the SMILES
62  \param doKekule : do Kekule smiles (i.e. don't use aromatic bonds)
63  \param rootedAtAtom : make sure the SMILES starts at the specified atom.
64  The resulting SMILES is not, of course, canonical.
65  \param canonical : if false, no attempt will be made to canonicalize the
66  SMILES
67  \param allBondsExplicit : if true, symbols will be included for all bonds.
68  \param allHsExplicit : if true, hydrogen counts will be provided for every
69  atom.
70  */
72  const ROMol &mol, bool doIsomericSmiles = true, bool doKekule = false,
73  int rootedAtAtom = -1, bool canonical = true, bool allBondsExplicit = false,
74  bool allHsExplicit = false, bool doRandom = false);
75 
76 //! \brief returns canonical SMILES for part of a molecule
77 /*!
78  \param mol : the molecule in question.
79  \param atomsToUse : indices of the atoms in the fragment
80  \param bondsToUse : indices of the bonds in the fragment. If this is not
81  provided,
82  all bonds between the atoms in atomsToUse will be included
83  \param atomSymbols : symbols to use for the atoms in the output SMILES
84  \param bondSymbols : sybmols to use for the bonds in the output SMILES
85  \param doIsomericSmiles : include stereochemistry and isotope information
86  in the SMILES
87  \param doKekule : do Kekule smiles (i.e. don't use aromatic bonds)
88  \param rootedAtAtom : make sure the SMILES starts at the specified atom.
89  The resulting SMILES is not, of course, canonical.
90  \param canonical : if false, no attempt will be made to canonicalize the
91  SMILES
92  \param allBondsExplicit : if true, symbols will be included for all bonds.
93  \param allHsExplicit : if true, hydrogen counts will be provided for every
94  atom.
95 
96  \b NOTE: the bondSymbols are *not* currently used in the canonicalization.
97 
98  */
100  const ROMol &mol, const std::vector<int> &atomsToUse,
101  const std::vector<int> *bondsToUse = 0,
102  const std::vector<std::string> *atomSymbols = 0,
103  const std::vector<std::string> *bondSymbols = 0,
104  bool doIsomericSmiles = true, bool doKekule = false, int rootedAtAtom = -1,
105  bool canonical = true, bool allBondsExplicit = false,
106  bool allHsExplicit = false);
107 } // namespace RDKit
108 #endif
RDKIT_SMILESPARSE_EXPORT bool inOrganicSubset(int atomicNumber)
returns true if the atom number is in the SMILES organic subset
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
#define RDKIT_SMILESPARSE_EXPORT
Definition: export.h:593
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