OEMolRecord¶
Attention
This API is currently available in C++ and Python.
class OEMolRecord
The OEMolRecord class is a subclass of OERecord, with additional convenience methods for handling molecules. All public methods from OERecord are inherited. This class has a “primary” molecule field, to which several convenience methods apply.
Constructors¶
OEMolRecord()
The default constructor initializes the record object to an empty record with no fields or values.
OEMolRecord(const OERecord &rhs)
Copy constructor. OEMolRecords can be constructed from OERecords, and vice versa, without any loss of data.
GetPrimaryMolField¶
bool GetPrimaryMolField(const std::string defName="Molecule",
OEFieldMeta meta=OEFieldMeta()) const
Retrieves the primary molecule field from the record. If no primary molecule field exists, this will return a field of type Types::Chem::Molecule with the name “Molecule”.
- defName
The name to be used for the molecule field if a primary molecule field doesn’t already exist ont he record.
- meta
An optional OEFieldMeta object specifying metadata for the field.
See also
GetMol¶
OEChem::OEMol GetMol(OEFieldBase field=OEFieldBase())
Retrieves a molecule from the record. If no field is specified, the record’s primary molecule is returned. If no primary molecule exists, an default-constructed (empty) OEMol is returned.
- field
The field to retrieve the molecule from. If this is omitted, the record’s primary molecule will be returned.
See also
HasMol¶
bool HasMol(const OEFieldBase field=OEFieldBase())
Returns true if the record has a molecule in the specified field, or a primary molecule if no field is supplied.
- field
The field to check for the presence of a molecule. If this is omitted, the record’s primary molecule will be used.
See also
SetMol¶
bool SetMol(const OEChem::OEMol &mol, OEFieldBase field=OEFieldBase(), OEFieldMeta meta=OEFieldMeta()) const
Sets a molecule on the record using the specified field. If no field is supplied, the primary molecule is set.
- mol
The molecule to be copied to the record.
- field
The field to store the molecule on. If this is omitted, the molecule will be stored as the record’s primary molecule.
- meta
Optional metadata to store on the field.
See also
OEFieldBase class
OEFieldMeta class
GetMolPointer¶
OEChem::OEMol* GetMolPointer(OEFieldBase field=OEFieldBase())
Returns a pointer to the molecule from the specified field on the record, or to the primary molecule if no field is supplied. If no such molecule exists on the record, a null pointer is returned.
- field
The field from which the molecule pointer is obtained. If this argument is omitted, a pointer to the primary molecule is returned.
See also
OEMolRecord::HasMol
methodOEFieldBase class
Note
This method will return a pointer to the actual molecule on the record, so any modifications to this molecule will affect the record contents. Accessing this pointer after the record has been destroyed will have undefined results.
SetMolReference¶
bool SetMolReference(OEChem::OEMol &mol, OEFieldBase field=OEFieldBase(), OEFieldMeta meta=OEFieldMeta())
This method puts a pointer to the passed OEMol onto the record, in the specified field. If no field is provided, the record’s primary molecule is set. While the SetMol method places a copy of the passed molecule onto the record, this method avoids creating a copy, and may in some cases improve performance.
- mol
The molecule to be placed on the record.
- field
The field to store the molecule in. If this is omitted the molecule will be stored in the record’s primary molecule field.
- meta
Optional metadata to be stored on the field.
See also
OEMolRecord::SetMol
methodOEMolRecord::GetMolPointer
methodOEFieldBase class
OEFieldMeta class
GetConfRecord¶
OERecord GetConfRecord(const OEChem::OEConfBase *conf) const
Returns a record for the provided conformer. OEMolRecord provides a mechanism for storing a record of data for each conformer. If the passed conformer doesn’t already have a record associated with it, this will return an empty OERecord.
- conf
The conformer the record will be associated with.
SetConfRecord¶
OERecord SetConfRecord(const OEChem::OEConfBase *conf, OERecord &childRecord)
This method associates data on a record with a conformer. The
conformer’s parent molecule must be stored in a field on the parent
record after this method is called, or stored using the
OEMolRecord::SetMolReference
method.
Otherwise, the conformer data will be lost during serialization.
- childRecord
A record containing data for the conformer.