struct_widget

Get nglview protein structure widgets.

dms_struct.struct_widget.colored_struct(*, pdb, prop_df, chain_col='chain', site_col='site', color_col='color', representation='cartoon', highlight_col=None, highlight_representation='spacefill', show_other=False, other_color='#FFFFFF', orientation=None)[source]

Create widget showing a colored structure.

Parameters
  • pdb (str) – Existing PDB file, or ID to be downloaded from PDB.

  • prop_df (pandas DataFrame) – Data on sites to show and how to color them. You are responsible for ensuring that chaing / site labels are consistent with those in pdb, no automatic checks of this are performed.

  • chain_col (str) – Column in prop_df with PDB chain ID.

  • site_col (str) – Column in prop_df with PDB site numbers.

  • color_col (str) – Column in prop_df with color for each site.

  • representation (str or list) –

    Protein representation (e.g., ‘cartoon’, ‘surface’, ‘spacefill’, or other nglview representation; or a list of such representations.

  • highlight_col (str or None) – Optional column of boolean values in prop_df indicating sites to also draw in highlight_representation.

  • highlight_representation (str) – Additional representation for sites specified in highlight_col.

  • show_other (False or str) – Show selections not listed as sites in prop_df? If so, specify those selections. Can be ‘all’, ‘protein’, or other selection string (see here).

  • other_color (str) – Color for any sites not in prop_df but shown via show_other.

  • orientation (None or list of 16 numbers) – Orientation to show the structure, can be obtained via the _camera_orientation property of a structure widget (https://github.com/arose/nglview/issues/785#issuecomment-487409212).

Returns

The widget can be shown in a Jupyter notebook.

Return type

nglview.widget.NGLWidget