schrodinger.livedesign.draw module¶
- class schrodinger.livedesign.draw.Format(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
enum.Enum
- PNG = 1¶
- SVG = 2¶
- class schrodinger.livedesign.draw.AromaticBondDisplay(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
enum.Enum
- KEKULE = 1¶
- AROMATIC = 2¶
- class schrodinger.livedesign.draw.ImageGenOptions(img_format: schrodinger.livedesign.draw.Format = Format.SVG, aromatic_bond_display: schrodinger.livedesign.draw.AromaticBondDisplay = AromaticBondDisplay.KEKULE, background_color: str = '#ffffff', width: int = 400, height: int = 400, show_stereo_annotation: bool = True, show_simplified_stereo_annotation: bool = True, show_wiggly_bonds: bool = False, show_terminal_methyl: bool = False, highlight_atoms: Optional[List[int]] = None, highlight_bonds: Optional[List[int]] = None, highlight_atom_colors: Optional[List[Dict]] = None, highlight_bond_colors: Optional[List[Dict]] = None)¶
Bases:
NamedTuple
- Variables
img_format – image format to be returned
aromatic_bond_display – how aromatic bonds should be drawn
background_color – background color as #RRGGBB or #RRGGBBAA
width – width of the image
height – height of the image
show_stereo_annotation – whether to label stereochemistry
show_simplified_stereo_annotation – whether to use molecular labels
show_wiggly_bonds – whether to render wiggly bonds instead of crossed
show_terminal_methyl – whether to render terminal methyl groups
highlight_atoms – indices of atoms to highlight
highlight_bonds – indices of bonds to highlight
highlight_atom_colors – colors to assign to each atom highlight
highlight_bond_colors – colors to assign to each bond highlight
- img_format: schrodinger.livedesign.draw.Format¶
Alias for field number 0
- aromatic_bond_display: schrodinger.livedesign.draw.AromaticBondDisplay¶
Alias for field number 1
- background_color: str¶
Alias for field number 2
- width: int¶
Alias for field number 3
- height: int¶
Alias for field number 4
- show_stereo_annotation: bool¶
Alias for field number 5
- show_simplified_stereo_annotation: bool¶
Alias for field number 6
- show_wiggly_bonds: bool¶
Alias for field number 7
- show_terminal_methyl: bool¶
Alias for field number 8
- schrodinger.livedesign.draw.set_rgroup_highlight(match_mol: rdkit.Chem.rdchem.Mol, rgroup_decomp: Dict[str, rdkit.Chem.rdchem.Mol], options: Optional[schrodinger.livedesign.draw.ImageGenOptions] = None) schrodinger.livedesign.draw.ImageGenOptions ¶
Sets the highlighting to use for each atom and bond according to which of the rgroups or core the atom/bond belongs to.
- Parameters
mol – molecule to highlight rgroup decoposition of
rgroup_decomp – core and rgroups from rgroup decomposition
options – image generation options to update
- Returns
options with updated atoms/bonds to highlight
- schrodinger.livedesign.draw.set_highlight(mol: rdkit.Chem.rdchem.Mol, highlight_mol: rdkit.Chem.rdchem.Mol, substructure_options: Optional[schrodinger.rdkit.substructure.QueryOptions] = None, options: Optional[schrodinger.livedesign.draw.ImageGenOptions] = None) schrodinger.livedesign.draw.ImageGenOptions ¶
Sets the atoms and bonds that match a specified highlight core.
- Parameters
mol – query molecule
highlight_mol – core to highlight matches of
substructure_options – substructure matching options
options – image generation options to update
- Returns
options with updated atoms/bonds to highlight
- schrodinger.livedesign.draw.RRGGBBAA_to_QColor(hex_color: str) PyQt6.QtGui.QColor ¶
Converts #RRGGBBAA to a QColor object, which interprets hex colors as #AARRGGBB (see SHARED-10154). This function also accepts #RRGGBB
- schrodinger.livedesign.draw.assign_highlight_options(draw_opts: schrodinger.livedesign.draw.ImageGenOptions, sk_opts: schrodinger.ui._sketcher.RenderOptions)¶
Maps the colors set on the ImageGenOptions object to a RenderOptions object
- schrodinger.livedesign.draw.draw_image(mol: Union[rdkit.Chem.rdchem.Mol, rdkit.Chem.rdChemReactions.ChemicalReaction], options: Optional[schrodinger.livedesign.draw.ImageGenOptions] = None) bytes ¶
Generates an image from an RDKit molecule or reaction
- Parameters
mol – molecule or reaction to get image of
options – image generation options
- Returns
generated image as a string (SVG) or as bytes (PNG)