OEMolRecord

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.

get_primary_mol_field

get_primary_mol_field(def_name: str="Molecule",
                      meta: OEFieldMeta=None) -> object

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”.

def_name

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

get_mol

get_mol(field: OEFieldBase) -> OEMol

Retrieves a molecule from the record. If no field is specified, the record’s primary molecule is returned. If no primary molecule exists, None is returned.

field

The field to retrieve the molecule from. If this is omitted, the record’s primary molecule will be returned.

See also

has_mol

has_mol(field: OEFieldBase=None) -> bool

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

set_mol

set_mol(mol: OEMol, field: OEFieldBase=None, meta: OEFieldMeta=None) -> bool

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

get_mol_reference

get_mol_reference(field: OEFieldBase=None) -> OEMol

Returns a reference 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, None 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

Note

This method will return a reference to the actual molecule on the record, so any modifications to this molecule will affect the record contents.

set_mol_reference

set_mol_reference(mol: OEMol, field: OEFieldBase=None, meta: OEFieldMeta=None) -> bool

This method puts a reference 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.

get_conf_record

get_conf_record(conf: OEConfBase) -> OERecord

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.

set_conf_record

set_conf_record(conf: OEConfBase, child_record: OERecord) -> null

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.set_mol_reference method. Otherwise, the conformer data will be lost during serialization.

child_record

A record containing data for the conformer.