InteractiveMolecule#
- class trident_chemwidgets.InteractiveMolecule(**kwargs: Any)[source]#
Bases:
DOMWidget
Plot an interactive molecule where the user can view properties associated with each constituent atom.
A drawing of the target molecule will be displayed to the left of the cell output, with a card displayed on the right. The user can click any atom in the structure and the details associated with that atom will be displayed in the card to the right.
- Parameters
Examples
>>> import trident_chemwidgets as tcw >>> atom_data = ... # Atom data in a list of dicts or pd.DataFrame >>> imol = tcw.InteractiveMolecule('CCCCC', data=atom_data) >>> imol # Plot the actual widget on the notebook/lab
Input data structure#
The input for this widget can either be a list of dictionaries, with each dictionary containing the features of the atoms, or it can be a Pandas DataFrame. In either case, the ordering of the dictionaries in the list or the rows in the dataframe must match the standard ordering used by RDKit.
If you are using a standard RDKit-based featurizer, as is common in many ML for chemistry packages (e.g. DeepChem), this ordering should be the default.
We cannot guarantee ordering for all featurizers/applications, so it is always a good idea to double check your atom ordering against that generated with the GetAtoms
function in RDKit.
Interaction features#
Atom information#
Click within the circle surrounding each atom in the structure to display the data associated with that atom.