Add a button for adding a surface

m_button_add_surface(
  id,
  label = "Surface",
  type = "VDW",
  style = m_style_surface(),
  atomsel = m_sel(),
  allsel = NULL,
  removeSurface = TRUE,
  removeLabel = "Clear Surfaces"
)

Arguments

id

R3dmol id or a r3dmol object (the output from r3dmol()).

label

String for button label.

type

Surface type ('VDW', 'MS', 'SAS', or 'SES')

style

Optional style specification for surface material created with m_style_surface() to alter color and opacity.

atomsel

Show surface for atoms in this selection.

allsel

Use different atoms to calculate the surface than to display it. May be a larger selection than atomsel.

removeSurface

Logical, whether to also create a button that will remove all surfaces from the viewer.

removeLabel

String for clear surface button label.

Value

R3dmol id or a r3dmol object (the output from r3dmol())

Examples

# Add buttons to add and clear surface representations
r3dmol() %>%
  m_add_model(data = pdb_1j72, format = "pdb") %>%
  m_zoom_to() %>%
  m_set_style(m_style_cartoon()) %>%
  m_button_add_surface(
    style = m_style_surface(opacity = 0.4),
    atomsel = m_sel(resi = 70:110)
  ) %>%
  m_button_add_surface(
    style = m_style_surface(opacity = 1),
    atomsel = m_sel(resi = 70:110, invert = TRUE),
    label = "Rest of Protein",
    removeSurface = FALSE
  )