RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
SmartsWrite.h
Go to the documentation of this file.
1//
2// Copyright (C) 2004-2024 Greg Landrum and other RDKit contributors
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_SMARTSWRITE_H_012020
12#define RD_SMARTSWRITE_H_012020
13
14#include <string>
15#include <vector>
16#include "SmilesWrite.h"
17
18namespace RDKit {
19class Atom;
20class Bond;
21class ROMol;
22
23namespace SmartsWrite {
24//! returns the SMARTS for an Atom
26 const Atom *qatom, const SmilesWriteParams &params);
27
28//! returns the SMARTS for an Atom
29inline std::string GetAtomSmarts(const Atom *qatom) {
30 SmilesWriteParams params;
31 return GetAtomSmarts(qatom, params);
32};
33
34//! returns the SMARTS for a Bond
36 const Bond *qbond, const SmilesWriteParams &params, int atomToLeftIdx = -1);
37//! returns the SMARTS for a Bond
38inline std::string GetBondSmarts(const Bond *qbond, int atomToLeftIdx = -1) {
39 SmilesWriteParams params;
40 params.doIsomericSmiles = false;
41 return GetBondSmarts(qbond, params, atomToLeftIdx);
42};
43} // namespace SmartsWrite
45 const ROMol &mol, const SmilesWriteParams &params);
46
47//! returns the SMARTS for a molecule
48inline std::string MolToSmarts(const ROMol &mol, bool doIsomericSmarts = true,
49 int rootedAtAtom = -1) {
50 SmilesWriteParams params;
52 params.rootedAtAtom = rootedAtAtom;
53 return MolToSmarts(mol, params);
54};
55
57 const ROMol &mol, const SmilesWriteParams &params,
58 const std::vector<int> &atomsToUse,
59 const std::vector<int> *bondsToUse = nullptr);
60
61//! returns the CXSMARTS for a molecule
63 const ROMol &mol, const SmilesWriteParams &params);
64
66 const ROMol &mol, const SmilesWriteParams &params,
67 const std::vector<int> &atomsToUse,
68 const std::vector<int> *bondsToUse = nullptr);
69
70inline std::string MolFragmentToSmarts(
71 const ROMol &mol, const std::vector<int> &atomsToUse,
72 const std::vector<int> *bondsToUse = nullptr,
73 bool doIsomericSmarts = true) {
74 SmilesWriteParams params;
76 return MolFragmentToSmarts(mol, params, atomsToUse, bondsToUse);
77}
78
79//! returns the CXSMARTS for a molecule
80inline std::string MolToCXSmarts(const ROMol &mol,
81 bool doIsomericSmarts = true) {
82 SmilesWriteParams params;
84 return MolToCXSmarts(mol, params);
85}
86
87inline std::string MolFragmentToCXSmarts(
88 const ROMol &mol, const std::vector<int> &atomsToUse,
89 const std::vector<int> *bondsToUse = nullptr,
90 bool doIsomericSmarts = true) {
91 SmilesWriteParams params;
93 return MolFragmentToCXSmarts(mol, params, atomsToUse, bondsToUse);
94}
95}; // namespace RDKit
96
97#endif
The class for representing atoms.
Definition Atom.h:75
class for representing a bond
Definition Bond.h:47
#define RDKIT_SMILESPARSE_EXPORT
Definition export.h:505
RDKIT_SMILESPARSE_EXPORT std::string GetAtomSmarts(const Atom *qatom, const SmilesWriteParams &params)
returns the SMARTS for an Atom
RDKIT_SMILESPARSE_EXPORT std::string GetBondSmarts(const Bond *qbond, const SmilesWriteParams &params, int atomToLeftIdx=-1)
returns the SMARTS for a Bond
Std stuff.
RDKIT_SMILESPARSE_EXPORT std::string MolFragmentToCXSmarts(const ROMol &mol, const SmilesWriteParams &params, const std::vector< int > &atomsToUse, const std::vector< int > *bondsToUse=nullptr)
bool rdvalue_is(const RDValue_cast_t)
RDKIT_SMILESPARSE_EXPORT std::string MolToCXSmarts(const ROMol &mol, const SmilesWriteParams &params)
returns the CXSMARTS for a molecule
RDKIT_SMILESPARSE_EXPORT std::string MolToSmarts(const ROMol &mol, const SmilesWriteParams &params)
RDKIT_SMILESPARSE_EXPORT std::string MolFragmentToSmarts(const ROMol &mol, const SmilesWriteParams &params, const std::vector< int > &atomsToUse, const std::vector< int > *bondsToUse=nullptr)