Visualization
to_image(safe_str: str, fragments: Optional[Union[str, dm.Mol, Sequence[Union[str, dm.Mol]]]] = None, legend: Union[str, None] = None, mol_size: Union[Tuple[int, int], int] = (300, 300), use_svg: Optional[bool] = True, highlight_mode: Optional[str] = 'lasso', highlight_bond_width_multiplier: int = 12, **kwargs: Any)
¶
Display a safe string by highlighting the fragments that make it.
Parameters:
-
safe_str(str) –the safe string to display
-
fragments(Optional[Union[str, Mol, Sequence[Union[str, Mol]]]], default:None) –list of fragment to highlight on the molecules. If None, will use safe decomposition of the molecule.
-
legend(Union[str, None], default:None) –A string to use as the legend under the molecule.
-
mol_size(Union[Tuple[int, int], int], default:(300, 300)) –The size of the image to be returned
-
use_svg(Optional[bool], default:True) –Whether to return an svg or png image
-
highlight_mode(Optional[str], default:'lasso') –the highlight mode to use. One of ["lasso", "fill", "color"]. If None, no highlight will be shown
-
highlight_bond_width_multiplier(int, default:12) –the multiplier to use for the bond width when using the 'fill' mode
-
**kwargs(Any, default:{}) –Additional arguments to pass to the drawing function. See RDKit documentation related to
MolDrawOptionsfor more details at https://www.rdkit.org/docs/source/rdkit.Chem.Draw.rdMolDraw2D.html.
Source code in safe/viz.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |