datamol.viz
¶
Vizualize molecule in 2D or 3D¶
Generate an image out of a molecule or a list of molecules.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mols |
Union[List[dm.Mol], dm.Mol]
|
One or a list of molecules. |
required |
legends |
Union[List[Union[str, None]], str, None]
|
A string or a list of string as legend for every molecules. |
None
|
n_cols |
int
|
Number of molecules per column. |
4
|
use_svg |
bool
|
Whether to ouput an SVG (or a PNG). |
True
|
mol_size |
Union[Tuple[int, int], int]
|
A int or a tuple of int defining the size per molecule. |
(300, 300)
|
highlight_atom |
Optional[List[List[int]]]
|
the atoms to highlight. |
None
|
highlight_bond |
Optional[List[List[int]]]
|
The bonds to highlight. |
None
|
outfile |
Optional[str]
|
Path where to save the image (local or remote path). |
None
|
max_mols |
int
|
The maximum number of molecules to display. |
32
|
copy |
bool
|
Whether to copy the molecules or not. |
True
|
indices |
bool
|
Whether to draw the atom indices. |
False
|
bond_indices |
bool
|
Whether to draw the bond indices. |
False
|
bond_line_width |
int
|
The width of the bond lines. |
2
|
legend_fontsize |
int
|
Font size for the legend. |
16
|
kekulize |
bool
|
Run kekulization routine on molecules. Skipped if fails. |
True
|
align |
Union[dm.Mol, str, bool]
|
Whether to align the 2D coordinates of the molecules.
- If set to True, align all molecules with |
False
|
**kwargs |
Any
|
Additional arguments to pass to the drawing function. See RDKit
documentation related to |
{}
|
Source code in datamol/viz/_viz.py
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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
Visualize the conformer(s) of a molecule.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Chem.rdchem.Mol
|
a molecule. |
required |
conf_id |
int
|
The ID of the conformer to show. -1 shows
the first conformer. Only works if |
-1
|
n_confs |
Union[int, List[int]]
|
Can be a number of conformers to shows or a list of conformer indices. When None, only the first conformer is displayed. When -1, show all conformers. |
None
|
align_conf |
bool
|
Whether to align conformers together. |
True
|
n_cols |
int
|
Number of columns. Defaults to 3. |
3
|
sync_views |
bool
|
Wether to sync the multiple views. |
True
|
remove_hs |
bool
|
Wether to remove the hydrogens of the conformers. |
True
|
width |
str
|
The width of the returned view. Defaults to "auto". |
'auto'
|
Source code in datamol/viz/_conformers.py
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 104 105 106 107 108 109 |
|
Specific plotting functions¶
Source code in datamol/viz/_circle_grid.py
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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
__init__(center_mol, circle_mols, legend=None, mol_size=(200, 200), circle_margin=50, act_mapper=None)
¶
Show molecules in concentric rings, with one molecule at the center
Parameters:
Name | Type | Description | Default |
---|---|---|---|
center_mol |
Chem.rdchem.Mol
|
Molecule at center |
required |
circle_mols |
List[List[Chem.rdchem.Mol]]
|
List of molecule for each concentric circle around the center mol |
required |
mol_size |
Tuple[int, int]
|
Tuple of width and height for each molecule |
(200, 200)
|
circle_margin |
int
|
Margin between the circle layers |
50
|
act_mapper |
Optional[dict]
|
Map each molecule to a dictionary of activity |
None
|
Source code in datamol/viz/_circle_grid.py
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 |
|
Show molecules in concentric rings, with one molecule at the center
Parameters:
Name | Type | Description | Default |
---|---|---|---|
center_mol |
Chem.Mol
|
Molecule at center |
required |
circle_mols |
list of list of <Chem.Mol>
|
List of molecule for each concentric circle around the center mol |
required |
mol_size |
tuple
|
Tuple of width and height for each molecule |
(200, 200)
|
circle_margin |
int
|
Margin between the circle layers |
50
|
act_mapper |
dict
|
Map each molecule to a dictionary of activity |
None
|
Source code in datamol/viz/_circle_grid.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|