OE2DMolDisplay
class OE2DMolDisplay : public OEMolDisplayBase
This class represents OE2DMolDisplay that stores the depiction information (such as atom coordinates, molecule scaling, representation styles etc.) of a molecule. See Figure: OEDepict TK molecule display class hierarchy.
OEDepict TK molecule display class hierarchy
See also
OE2DMolDisplayOptions class
OE2DAtomDisplay class
OE2DBondDisplay class
The following methods are publicly inherited from OEMolDisplayBase:
Constructors
OE2DMolDisplay(arg2: Union[OEGraphMol,OEMol,OEQMol]) -> OE2DMolDisplay
Initializes an OE2DMolDisplay object using default display options.
- mol
The molecule for which display information is stored in the OE2DMolDisplay object.
See also
OE2DMolDisplayOptions.Constructorsmethod for the list of default display optionsOE2DMolDisplay.IsValidmethod
OE2DMolDisplay(arg2: Union[OEGraphMol,OEMol,OEQMol],
arg3: OE2DMolDisplayOptions) -> OE2DMolDisplay
Initializes an OE2DMolDisplay object using the given display options.
- mol
The molecule for which display information is stored in the OE2DMolDisplay object.
- opts
The OE2DMolDisplayOptions object that stores properties that determine the styles of the molecule depiction.
Warning
An OE2DMolDisplay object does not make a copy of the OEMolBase object from which it is initialized but only stores its pointer. Therefore, the user responsibility is to not let the molecule go out of scope, before the corresponding OE2DMolDisplay object.
Changing the OEMolBase object from which OE2DMolDisplay object is initialized has no effect on the display itself after initialization. However, the OE2DMolDisplay object become invalid if the molecule graph is modified (atoms or bonds added or deleted).
Note
A warning is thrown when an OE2DMolDisplay object is initialized with a molecule with 3D coordinates.
An OE2DMolDisplay object is considered invalid and an error is thrown when it is initialized:
with an empty molecule (i.e. molecule with no atoms)
with a molecule that has neither 2D nor 3D coordinates
See also:
OE2DMolDisplay.IsValidmethod
OE2DMolDisplay(rhs: OE2DMolDisplay) -> OE2DMolDisplay
Copy constructor.
CreateCopy
CreateCopy() -> OEBase
Deep copy constructor that returns a copy of the object. The memory for the returned OE2DMolDisplay object is dynamically allocated and owned by the caller.
GetAtomDisplay
GetAtomDisplay(atom: OEAtomBase) -> OE2DAtomDisplay
Returns the pointer of the OE2DAtomDisplay object that stores the depiction information of the given atom.
GetAtomDisplay(atom: OEAtomBase) -> OE2DAtomDisplay
Returns the const pointer of the OE2DAtomDisplay object that stores the depiction information of the given atom.
Note
The OE2DMolDisplay.GetAtomDisplay methods
returns a zero pointer if the given atom does not correspond to any
display atom stored in the OE2DMolDisplay object.
It is a good programming practice to check the returned pointer
before using it. See code snippet below.
adisp = disp.GetAtomDisplay(atom)
if adisp is not None and adisp.IsVisible():
# do something
pass
See also
OE2DAtomDisplay class
GetAtomDisplays
GetAtomDisplays() -> Iterable[OE2DAtomDisplay]
Returns an iterator over all OE2DAtomDisplay objects stored in the OE2DMolDisplay object.
GetAtomDisplays(pred: OEUnaryAtomPred) -> Iterable[OE2DAtomDisplay]
Returns an iterator over only those OE2DAtomDisplay objects for which the corresponding atom passes the given predicate. For example, the following code snippet shows how to access the atom displays of oxygen atoms:
for adisp in disp.GetAtomDisplays(oechem.OEHasAtomicNum(oechem.OEElemNo_O)):
if adisp.IsVisible():
# do something
pass
See also
OE2DAtomDisplay class
Listing 4example in the Customizing Molecule Depiction section
GetBondDisplay
GetBondDisplay(bond: OEBondBase) -> OE2DBondDisplay
Returns the pointer of the OE2DBondDisplay object, that stores the depiction information of the given bond.
GetBondDisplay(bond: OEBondBase) -> OE2DBondDisplay
Returns the const pointer of the OE2DBondDisplay object, that stores the depiction information of the given bond.
See also
OE2DBondDisplay class
Note
The OE2DMolDisplay.GetBondDisplay methods
returns a zero pointer if the given bond does not correspond to any
display bond stored in the OE2DMolDisplay object.
It is a good programming practice to check the returned pointer
before using it. See code snippet below.
bdisp = disp.GetBondDisplay(bond)
if bdisp is not None and bdisp.IsVisible():
# do something
pass
See also
OE2DBondDisplay class
GetBondDisplays
GetBondDisplays() -> Iterable[OE2DBondDisplay]
Returns an iterator over all OE2DBondDisplay objects stored in the OE2DMolDisplay object.
GetBondDisplays(pred: OEUnaryBondPred) -> Iterable[OE2DBondDisplay]
See also
OE2DBondDisplay class
Returns an iterator over only those OE2DBondDisplay objects for which the corresponding bond passes the given predicate. For example, the following code snippet shows how to access the bond displays of aromatic bonds:
for bdisp in disp.GetBondDisplays(oechem.OEIsAromaticBond()):
if bdisp.IsVisible():
# do something
pass
See also
OE2DBondDisplay class
Listing 4example in the Customizing Molecule Depiction section
GetDataType
GetDataType() -> void
This function is used to perform run-time type identification.
See also
OEBase.GetDataTypemethod in the OEChem TK manual
GetHeight
GetHeight() -> float
Returns the height of the displayed molecule.
See also
OE2DMolDisplay.GetScalemethodOE2DMolDisplay.GetWidthmethod
GetLayer
GetLayer(position: int, idx: int = 0) -> OEImage
Provides access to the layers of the OE2DMolDisplay
object.
Currently, an OE2DMolDisplay object has two layers
(one OELayerPosition_Above and
one OELayerPosition_Below ) that allows
drawing of objects over or underneath the molecular structure, respectively.
- position
This value has to be from the
OELayerPositionnamespace.- idx
This parameter is currently not used.
See also
OEImage class
OELayerPositionnamespace
GetOptions
GetOptions() -> OE2DMolDisplayOptions
Returns the options used to initialized the OE2DMolDisplay object.
See also
OE2DMolDisplayOptions class
GetScale
GetScale() -> float
Returns the scaling factor of the displayed molecule.
See also
OE2DMolDisplay.GetHeightmethodOE2DMolDisplay.GetWidthmethod
GetWidth
GetWidth() -> float
Returns the width of the displayed molecule.
See also
OE2DMolDisplay.GetHeightmethodOE2DMolDisplay.GetScalemethod
IsDataType
IsDataType(arg2: void) -> bool
Returns whether type is the same as the instance this method is called on.
See also
OEBase.IsDataTypemethod in the OEChem TK manual
IsValid
IsValid() -> bool
Returns whether the OE2DMolDisplay object was initialized successfully. If initialization was attempted with an empty molecule or a molecule with no coordinates (neither 2D nor 3D), then this method returns false. An OE2DMolDisplay object becomes invalid if the molecule, from which it was initialized, is modified. For example, atom or bonds added to or deleted from the molecule.
Hint
It is highly recommend to check whether a molecule display is valid after initialization.