RDKit
Open-source cheminformatics and machine learning.
Toggle main menu visibility
Loading...
Searching...
No Matches
MacroAtomInfo.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2026 Schrödinger 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
/*! \file MacroAtomInfo.h
11
12
\brief Defines atom-level macro atom information
13
14
*/
15
#ifndef RD_MACROATOMINFO_H
16
#define RD_MACROATOMINFO_H
17
18
#include <
RDGeneral/export.h
>
19
20
#include <memory>
21
#include <string>
22
#include <utility>
23
24
namespace
RDKit
{
25
26
//! Format-neutral classes of monomer that a macro atom can represent.
27
/*!
28
These are broad semantic categories, not the class vocabularies used by
29
SCSR, HELM, PDB, or another external format. Format parsers and writers are
30
responsible for mapping their own classifications to and from these values.
31
Such mappings may require additional format-specific context and should fail
32
rather than guess when the available information is ambiguous.
33
34
A regular enum is used here because MonomerClass appears in public MacroMol
35
method signatures. RDKit's BETTER_ENUM macro can expand to different C++
36
types depending on per-source-file preprocessor settings, which can cause
37
link errors in shared-library and unity builds.
38
*/
39
enum
MonomerClass
:
int
{
40
//! An amino-acid monomer, without encoding chirality, modification, or
41
//! crosslink status.
42
AminoAcid
,
43
//! A nucleic-acid monomer, without distinguishing DNA, RNA, base, sugar, or
44
//! phosphate classifications.
45
NucleicAcid
,
46
//! A non-biopolymer chemical monomer.
47
Chemical
,
48
//! A recognized monomer that does not belong to another neutral category.
49
Other
50
};
51
52
//! Converts a monomer class to its canonical format-neutral RDKit name.
53
/*!
54
The returned name is not a mapping to an external format's class vocabulary.
55
*/
56
RDKIT_GRAPHMOL_EXPORT
const
char
*
monomerClassToString
(
57
MonomerClass
monomerClass);
58
59
//! Converts a canonical format-neutral RDKit name to its monomer class.
60
/*!
61
\throws ValueErrorException if monomerClass is not a canonical name. External
62
format adapters must validate and map their own class vocabulary
63
instead of passing arbitrary values to this function.
64
*/
65
RDKIT_GRAPHMOL_EXPORT
MonomerClass
66
monomerClassFromString
(
const
std::string &monomerClass);
67
68
//! Captures atom-level information for macro atoms.
69
/*!
70
Macro atom information is owned by an Atom and stores the macro atom's
71
display symbol and monomer class.
72
*/
73
class
RDKIT_GRAPHMOL_EXPORT
MacroAtomInfo
{
74
public
:
75
virtual
~MacroAtomInfo
() =
default
;
76
77
MacroAtomInfo
() =
default
;
78
79
//! Construct macro atom information.
80
/*!
81
\param symbol the symbol used to identify the monomer
82
\param monomerClass the class of monomer the macro atom represents
83
*/
84
MacroAtomInfo
(std::string
symbol
,
85
MonomerClass
monomerClass =
MonomerClass::Other
)
86
: d_symbol(std::move(
symbol
)), d_monomerClass(monomerClass) {}
87
MacroAtomInfo
(
const
MacroAtomInfo
&other) =
default
;
88
89
//! Returns the macro atom symbol.
90
const
std::string &
getSymbol
()
const
{
return
d_symbol; }
91
92
//! Sets the macro atom symbol.
93
/*!
94
\param symbol the symbol used to identify the monomer
95
*/
96
void
setSymbol
(
const
std::string &
symbol
) { d_symbol =
symbol
; }
97
98
//! Returns the macro atom monomer class.
99
MonomerClass
getMonomerClass
()
const
{
return
d_monomerClass; }
100
101
//! Sets the macro atom monomer class.
102
/*!
103
\param monomerClass the class of monomer the macro atom represents
104
*/
105
void
setMonomerClass
(
MonomerClass
monomerClass) {
106
d_monomerClass = monomerClass;
107
}
108
109
//! Returns a copy of this macro atom information.
110
virtual
std::unique_ptr<MacroAtomInfo>
copy
()
const
{
111
return
std::make_unique<MacroAtomInfo>(*
this
);
112
}
113
114
private
:
115
std::string d_symbol{
""
};
116
MonomerClass d_monomerClass{MonomerClass::Other};
117
};
118
}
// namespace RDKit
119
120
#endif
RDKit::MacroAtomInfo::~MacroAtomInfo
virtual ~MacroAtomInfo()=default
RDKit::MacroAtomInfo::getSymbol
const std::string & getSymbol() const
Returns the macro atom symbol.
Definition
MacroAtomInfo.h:90
RDKit::MacroAtomInfo::MacroAtomInfo
MacroAtomInfo(const MacroAtomInfo &other)=default
RDKit::MacroAtomInfo::MacroAtomInfo
MacroAtomInfo()=default
RDKit::MacroAtomInfo::MacroAtomInfo
MacroAtomInfo(std::string symbol, MonomerClass monomerClass=MonomerClass::Other)
Construct macro atom information.
Definition
MacroAtomInfo.h:84
RDKit::MacroAtomInfo::setSymbol
void setSymbol(const std::string &symbol)
Sets the macro atom symbol.
Definition
MacroAtomInfo.h:96
RDKit::MacroAtomInfo::copy
virtual std::unique_ptr< MacroAtomInfo > copy() const
Returns a copy of this macro atom information.
Definition
MacroAtomInfo.h:110
RDKit::MacroAtomInfo::getMonomerClass
MonomerClass getMonomerClass() const
Returns the macro atom monomer class.
Definition
MacroAtomInfo.h:99
RDKit::MacroAtomInfo::setMonomerClass
void setMonomerClass(MonomerClass monomerClass)
Sets the macro atom monomer class.
Definition
MacroAtomInfo.h:105
export.h
RDKIT_GRAPHMOL_EXPORT
#define RDKIT_GRAPHMOL_EXPORT
Definition
export.h:321
symbol
static const char * symbol[119]
Definition
mf.h:257
RDKit
Std stuff.
Definition
Abbreviations.h:19
RDKit::monomerClassToString
RDKIT_GRAPHMOL_EXPORT const char * monomerClassToString(MonomerClass monomerClass)
Converts a monomer class to its canonical format-neutral RDKit name.
RDKit::monomerClassFromString
RDKIT_GRAPHMOL_EXPORT MonomerClass monomerClassFromString(const std::string &monomerClass)
Converts a canonical format-neutral RDKit name to its monomer class.
RDKit::MonomerClass
MonomerClass
Format-neutral classes of monomer that a macro atom can represent.
Definition
MacroAtomInfo.h:39
RDKit::Other
@ Other
A recognized monomer that does not belong to another neutral category.
Definition
MacroAtomInfo.h:49
RDKit::NucleicAcid
@ NucleicAcid
Definition
MacroAtomInfo.h:45
RDKit::Chemical
@ Chemical
A non-biopolymer chemical monomer.
Definition
MacroAtomInfo.h:47
RDKit::AminoAcid
@ AminoAcid
Definition
MacroAtomInfo.h:42
GraphMol
MacroAtomInfo.h
Generated on
for RDKit by
1.17.0