Molecule Styling¶
OE3DMolStyle¶
An OEMolBase has a default style without the addition of an OE3DMolStyle. The OE3DMolStyle class gives a multitude of customization options for the OEMolBase, from coloring to labeling. Outside of OEMolBase, OE3DMolStyle can be applied to an OEAtomBase and an OEConfBase. There is a hierarchy when applying OE3DMolStyle to each one of these classes: OEMolBase -> OEConfBase -> OEAtomBase.
Atom Labeling¶
Preset labels can be applied using SetAtomLabelType. Custom labels can be applied to specific atoms utilizing SetAtomLabelText. SetAtomLabelType takes in OEAtomLabelScheme. The example below depicts the B-Factor above each one of the respective atoms in the molecule.
OEMolBase mol;
OE3DMolStyle molSty;
molSty.SetAtomLabelType(OEAtomLabelScheme::BFactor);
OESetStyle(mol1, molSty);
Styling and Typing¶
There are multiple styling and typing options for an OE3DMolStyle. OEAtomStyle can be set using SetAtomStyle. This allows for customization of the visibility of the atoms in a molecule, which ranges from hidden atoms to CPK atom styling. In the example below the atoms are set to display as Ball and Stick.
OEMolBase mol;
OE3DMolStyle molSty;
molSty.SetAtomStyle(OEAtomStyle::BallAndStick);
OESetStyle(mol1, molSty);
OEProteinStyle can be set utilizing SetProteinStyle. This allows for customization of the protein from hidden to ribbon. The example below set the protein style to CAlpha, which depicts the protein with edges at the CAlphas.
OEMolBase mol;
OE3DMolStyle molSty;
molSty.SetProteinStyle(OEProteinStyle::CAlpha);
OESetStyle(mol1, molSty);
OEContourStyle can be set utilizing SetContourStyle. This allows for customization of the contour from hidden to solid. SetGridType takes in the OEStyleGridType constant to specify the type of the grid being depicted. The example below set the grid style to mesh and the drid type to electrostatic. This will depict the grid in mesh form for better visibility of the other components of the molecule.
OEMolBase mol;
OE3DMolStyle molSty;
molSty.SetContourStyle(OEContourStyle::Mesh);
molSty.SetGridType(OEStyleGridType::Electrostatic);
OESetStyle(mol1, molSty);
SetSurfaceStyle utilizes OEChem_OESurfaceStyle to depict the surface by mesh, point, and solid. OESurfaceType allows for surface typing when set by SetSurfaceType. The example below style a molecular surface to be depicted in points.
OEMolBase mol;
OE3DMolStyle molSty;
molSty.SetSurfaceStyle(OESurfaceStyle::Points);
molSty.SetSurfaceType(OESurfaceType::Molecular);
OESetStyle(mol1, molSty);
Hydrogen visibility is customizable by utilizing OEHydrogenVisibility in SetHydrogenVisibility. This allows for all hydrogen, polar hydrogen, and hidden hydrogen depictions. In the example below sets up an OE3DMolStyle to only depict the polar hydrogens in the molecule.
OEMolBase mol;
OE3DMolStyle molSty;
molSty.SetHydrogenVisibility(OEHydrogenVisibility::Polar);
OESetStyle(mol1, molSty);
Atom to atom interactions is depicted using arrows from one atom to another. By default this is set to off. SetInteractionStyle utilizes OEInteractionStyle to toggle between intermolecular hydrogen bond interaction depiction, intramolecular hydrogen bond interaction depiction, and no bond interaction depiction. In this example we set the the interaction style to intramolecular hydrogen bond depiction.
OEMolBase mol;
OE3DMolStyle molSty;
molSty.SetInteractionStyle(OEInteractionStyle::IntramolecularHBonds);
OESetStyle(mol1, molSty);
Colorer¶
Multple aspects of the molecule can be colored when OE3DMolStyle takes advantage of OEMolStyleColorer. There are preset color schemes for all parts of the molecule from atoms to protein, but custom colors can also be added for better personalization of the molecule.
OEAtomColorScheme provides multple preset atom color schemes when specified in the construction of an OEMolStyleColorer. SetAtomColorer takes in the OEMolStyleColorer. Atoms are colored by element by default, but this allows for coloring by b factor, residues, formal charge, and other aspects of the atoms and/or molecule. The labels of an atom can also be colored when an OEMolStyleColorer with a default color and/or custom colors by atom name or atomic number. The color of a grid can also be set with a default color specified in an OEMolStyleColorer. The OEMolStyleColorer with the default color can be set to the OE3DMolStyle with SetGridContourColorer.
OESurfaceColorScheme provides customization of surfaces with preset color schemes. These color schemes are applied similarly to how atom color schemes are applied but by utilizing SetSurfaceColorer. When a color scheme isn’t specified the surface is colored by the default color, by default the surface is colored blue.
Proteins can be colored utilizing a color scheme from OEProteinColorScheme but it can also colored with a constant from OEAtomColorScheme. The OEMolStyleColorer utilized for the protein can be set to the OE3DMolStyle with SetProteinColorer. The example below adds the different coloring options to the molecule. The protein is colored by residue. The atoms are colored by element, with a default color of white, but the OEMolStyleColorer also overwrites preset colors of certain atoms by atomic number. The grid is colored pink and the surface is colored by surface potential.
OEMolBase mol;
OE3DMolStyle molSty;
OEMolStyleColorer protCol(OEAtomColorScheme::Residue);
OEMolStyleColorer atomCol(OEAtomColorScheme::Element, OEWhite);
OEMolStyleColorer gridCol(OEPink);
OEMolStyleColorer surfCol(OESurfaceColorScheme::SurfacePotential);
atomCol.AddColor(6, OEGreen);
atomCol.AddColor(7, OERed);
atomCol.AddColor(8, OEBlue);
molSty.SetAtomColorer(atomCol);
molSty.SetProteinColorer(protCol);
molSty.SetGridContourColorer(gridCol);
molSty.SetSurfaceColorer(surfCol);
OESetStyle(mol1, molSty);
See also
basicStyle example
bFactorStyle example
styleHierarchy example