Subsections
4.1 Stored Properties of Molecules
Molecules in OEChem are represented by
OEMolBases . In addition to keeping track of
the atoms and bonds that constitute a molecule, the OEMolBase
is also used to store global information about the molecule. The
stored (read-write) properties of a molecule are listed below:
Table 4.1:
Stored properties of molecules
| Property Name |
Type |
Set Method |
Get Method |
| Dimension |
unsigned int |
SetDimension |
GetDimension |
| Energy |
float |
SetEnergy |
GetEnergy |
| Rxn |
bool |
SetRxn |
IsRxn |
| Title |
const char* |
SetTitle |
GetTitle |
|
The ``Dimension'' property is an unsigned integer representing the
dimensionality of the co-ordinates. This has the default value zero,
for unknown or no coordinates, 2 for 2-dimensional co-ordinates (such
as depictions) and 3 for 3-dimensional co-ordinates. This property is
typically set by the file format reader indicating the dimensionality
of the input file (0 for SMILES , 3 for MOL2 and 2 or 3 for MDL SD files etc...)
The ``Energy'' property is a float representing the energy of the
structure (in unspecified units). This has the default value zero.
Higher values indicate higher energies and therefore less-favorable or
more-strained structures.
The ``Rxn'' property is a boolean representing whether this molecule
represents a reaction or not. The default value is false. A true
value indicates that the molecule represents a reaction, while false
indicates the molecule is a simple connection table (and the ``Role''
property of each atom is OERxnRole::None.
The ``Title'' property is a string used to represent the name of the
molecule. The default value is an empty string. This field may be used
to store a registry number or other identifier, instead of a common name.
The string is typically trimmed of white space by most file format
readers.
The following code uses the OEMolBase::GetTitle
method to
list the names of the molecules in a file. The input file is read
from standard-in and the list of identifiers (molecule names) are
written to standard-out.
1 #include "openeye.h"
2 #include "oechem.h"
3 #include "oeplatform.h"
4
5 using namespace OEChem;
6 using namespace OEPlatform;
7
8 int main()
9 {
10 OEGraphMol mol;
11 oemolistream ims;
12
13 while (OEReadMolecule(ims, mol))
14 oeout << mol.GetTitle() << oeendl;
15
16 return 0;
17 }
Listing:4.1 Printing Molecule Titles
Much more data can be stored in generic data containers associated
with the molecules. The most common is SD file tagged data. There are
several convenience methods for dealing with SD file tagged data since
it is so common. See Section 4.3.