Grouper.visualization.visualize_node module
- Grouper.visualization.visualize_node.visualize_group(node, text='', draw_numbers=False, sanitize_smiles=False, highlight_color=(1.0, 0.5, 0.5, 1.0), draw_options=None)
A method to visualize a node trace, which definies a node and what that node is connected to.
Uses RDKit and PIL to create an image of the Group Node and where is definited to be located in a molecule. Extra arguments can help tune the look of this output image.
- Parameters:
group_extension (Grouper.libraries.Libraries.GroupExtension) – The Node with chemical information (SMARTS) to parse and visualize
text (str, optional, default="Matching Subgraph") – Text to place as a legend under the graph. The color matches the highlighted portion, which indicates these atoms would actually be contained in the function group Node.
draw_numbers (bool, optional, default=False) – If True, draw the atom indices on the image.
sanitize_smiles (bool, optional, default=False) – Argument that can be passed to rdkit.Chem.MolFromSmiles. Sanitization can strip hydrogens. See https://www.rdkit.org/docs/source/rdkit.Chem.rdmolfiles.html#rdkit.Chem.rdmolfiles.SmilesParserParams
highlight_color (Tuple[float, float, float, float], optional, default=(1.0, 0.5, 0.5, 1.0)) – RGBA color to highlight the atoms in the subgraph. Default is a light red.
draw_options (dict, optional, default=None) – If False, use default options, specified in this function. Optionally, require your own, including the bond_width and highlight_radius for the drawing. Other options explained here https://greglandrum.github.io/rdkit-blog/posts/2023-05-26-drawing-options-explained.html
- Return type:
Image
Notes
This can fail if SMARTS or SMILES are definied incorrectly, or RDKit has trouble parsing them. Parsing info can be found here:
Daylight SMARTS: https://www.daylight.com/dayhtml/doc/theory/theory.smarts.html
Daylight SMILES: https://www.daylight.com/dayhtml/doc/theory/theory.smiles.html
RDKit SMARTS: https://www.rdkit.org/docs/RDKit_Book.html#smarts-support-and-extensions
RDKit SMILES: https://www.rdkit.org/docs/RDKit_Book.html#smiles-support-and-extensions
- Grouper.visualization.visualize_node.visualize_group_extension(group_extension, text='Matching Subgraph', sanitize_smiles=False, highlight_color=(1.0, 0.5, 0.5, 1.0), draw_options=None)
A method to visualize a GroupExtension, which definies a node and what that node is connected to.
Uses RDKit and PIL to create an image of the Group Node and where is definited to be located in a molecule. Extra arguments can help tune the look of this output image.
- Parameters:
group_extension (Grouper.libraries.Libraries.GroupExtension) – The Node with chemical information (SMARTS) to parse and visualize
text (str, optional, default="Matching Subgraph") – Text to place as a legend under the graph. The color matches the highlighted portion, which indicates these atoms would actually be contained in the function group Node.
sanitize_smiles (bool, optional, default=False) – Argument that can be passed to rdkit.Chem.MolFromSmiles. Sanitization can strip hydrogens. See https://www.rdkit.org/docs/source/rdkit.Chem.rdmolfiles.html#rdkit.Chem.rdmolfiles.SmilesParserParams
highlight_color (Tuple[float, float, float, float], optional, default=(1.0, 0.5, 0.5, 1.0)) – RGBA color to highlight the atoms in the subgraph. Default is a light red.
draw_options (dict, optional, default=None) – If False, use default options, specified in this function. Optionally, require your own, including the bond_width and highlight_radius for the drawing. Other options explained here https://greglandrum.github.io/rdkit-blog/posts/2023-05-26-drawing-options-explained.html
- Return type:
Image
Notes
This can fail if SMARTS or SMILES are definied incorrectly, or RDKit has trouble parsing them. Parsing info can be found here:
Daylight SMARTS: https://www.daylight.com/dayhtml/doc/theory/theory.smarts.html
Daylight SMILES: https://www.daylight.com/dayhtml/doc/theory/theory.smiles.html
RDKit SMARTS: https://www.rdkit.org/docs/RDKit_Book.html#smarts-support-and-extensions
RDKit SMILES: https://www.rdkit.org/docs/RDKit_Book.html#smiles-support-and-extensions