shnitsel.vis.datasheet.figures.structure#
Functions#
|
Helper function to plot an rdkit.Mol object as a 2D structural representation |
|
Helper function to plot an rdkit.Mol object as a 2D structural representation using vector graphics |
|
Helper function to split an inchi string across |
|
Plot function to create a 2d structure representation of a molecule mol using rdkit and create a graph with |
|
Function to plot the most extreme pca combinations as structure plots. |
Module Contents#
- mol_to_png(mol, width=320, height=240)#
Helper function to plot an rdkit.Mol object as a 2D structural representation
- Parameters:
- Returns:
The drawn structure of the mol molecule in 2D as a sequence of bytes.
- Return type:
- mol_to_svg(mol, width=320, height=240)#
Helper function to plot an rdkit.Mol object as a 2D structural representation using vector graphics
- Parameters:
- Returns:
The drawn structure of the mol molecule in 2D as a sequence of bytes.
- Return type:
- format_inchi(inchi, max_line_length=30)#
Helper function to split an inchi string across multiple lines to not overlap other plots in the DataSheet pages.
- plot_structure(mol, name='', smiles=None, inchi=None, fig=None, ax=None)#
Plot function to create a 2d structure representation of a molecule mol using rdkit and create a graph with a 2d image representation into fig or ax with at least one of the two needing to be provided.
- Parameters:
mol (rdChem.Mol) – The RDKit molecule object to visualize.
name (str, optional) – The name of the structure. Would be used as a plot title if not empty. Defaults to ‘’.
smiles (str | None, optional) – Smiles strings to include in the x-axis label. Defaults to None.
inchi (str | None, optional) – InChI strings to include in the x-axis label. Defaults to None.
fig (Figure | SubFigure | None, optional) – Figure to plot the graphic into if ax not provided. Defaults to None.
ax (Axes | None, optional) – Axis to plot the graphic into. Defaults to None, meaning they will be created from fig.
- Returns:
The axes the graphic was plotted to.
- Return type:
Axes
- plot_pca_structure(frames, pca_data, fig=None, axs=None)#
Function to plot the most extreme pca combinations as structure plots.
- Parameters:
frames (Frames | xr.Dataset) – The raw input data to use for extracting the positional data and structure.
pca_data (xr.DataArray) – PCA decomposition data.
fig (Figure | SubFigure, optional) – Figure to create axes into. If axs are provided, this can be left empty.
axs (dict[tuple[int,str],Axes] | None, optional) – Axes to plot the extrema to. One row per pca, one column for ‘min’ or ‘max’. Defaults to None.
- Returns:
The axes the extrema have been plotted to.
- Return type: