Molecule streams, which were introduced in
Section 4.1, can read both single and
multi-conformer molecules from any file format. Many of the file
formats supported by OEChem are inherently a single conformer format
(SDF and MOL2 , for example). However, a common
practice is to store multiple conformers in these files. OEChem
supports a rather advanced mechanism for recovering these
separate conformers into a single, multi-conformer
OEMol . Note that this does not apply to file
formats where conformers are stored together. For example, all
molecules in an old OEBinary file are multi-conformer
molecules. New OEBinary (.oeb) files store either single
conformer or multi-conformer molecules explicitly, so the file itself
determines how to deal with conformers. Additionally, file formats
that have no notion of conformers (i.e. SMILES
files) are also unaffected by this feature.
In early versions of OEChem, the default behavior for reading into an
OEMol was to attempt to combine conformers of the
same molecules together into a single OEMol. This is no longer
the default, but is instead something controlled by the programmer.
oemolistream s have a method,
SetConfTest , that sets a functor that is
used to compare the graphs of incoming molecules in order
to determine whether to combine them. These functors are instances of
OEConfTest . Several predefined versions
include:
OEConfTest combines subsequent connection tables
into a multi-conformer molecule if they:
No changes are made to the connection table.
The constructor for OEIsomericConfTest has a default argument for
whether or not to compare titles. If the constructor is called with no
arguments
or with the argument true, the titles will be required to be the same.
Otherwise, the titles will not be compared. In the latter instance, each
conformer will have the individual title of its original connection table
and the multi-conformer molecule will reflect the title of the active
conformer.
OEConfTest combines subsequent connection
tables into a multi-conformer molecule if they:
This conformer test sets all fully specified isomeric values to
UNDEFINED.
The constructor for OEAbsoluteConfTest has a default argument for whether
or not to compare titles. If the constructor is called with no arguments
or with the argument true, the titles will be required to be the same.
Otherwise, the titles will not be compared. In the latter instance, each
conformer will have the individual title of its original connection table
and the multi-conformer molecule will reflect the title of the active
conformer.
OEConfTest combines subsequent connection tables
into a multi-conformer molecule if they:
This conformer test puts all of the molecules in their canonical atom
order. In addition, all fully specified isomeric values are set to
UNDEFINED.
Listing 7.3 will attempt to read multi-conformer molecules
from an input file based on
OEAbsoluteConfTest . Note that
creating the instance of OEAbsoluteConfTest with the default
constructor argument (0 or false), which allows conformers to be
combined when they have different titles. This is very useful when
dealing with files created by programs that modify molecule titles to
indicate conformer number (i.e. acetsali_1, acetsali_2,
acetsali_3). The resulting multi-conformer molecule will have the
title associated with the first connection table read from the file.
oemolistream ifs = new oemolistream("mcdrugs.sdf");
ifs.SetConfTest(new OEIsomericConfTest());
OEMol mol = new OEMol();
while (oechem.OEReadMolecule(ifs,mol)) {
OESystem.out.println("Mol: "+mol.GetTitle()+" nconfs: "+mol.NumConfs());
}