Add cynliders between the given points. Will match starting point/s with ending point/s to create a line between each point. Styling options can be supplied as one option, or a vector of length equal to the number of lines.

m_add_cylinder(
  id,
  start,
  end,
  radius = 0.1,
  fromCap = 1,
  toCap = 1,
  dashed = FALSE,
  color = "black",
  alpha = FALSE,
  wireframe = FALSE,
  hidden = FALSE,
  spec = m_shape_spec()
)

Arguments

id

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

start

Starting position (or list() of positions) of line. Can be a single position or list() of positions. Format either m_sel() or m_vector3().

end

Ending position (or list() of positions) of line. Can be a single position or list() of positions. Format either m_sel() or m_vector3().

radius

Radius of cylinder.

fromCap

Cap at start of cylinder. 0 for none, 1 for flat, 2 for rounded.

toCap

Cap at end of cylinder. 0 for none, 1 for flat, 2 for rounded.

dashed

Boolean, dashed style cylinder instead of solid.

color

Color value for cylinders. Either 1 or vector of colors equal in length to start.

alpha

Alpha value for transparency.

wireframe

Logical, display as wireframe.

hidden

Logical, whether or not to hide the cylinder.

spec

Additional shape specifications defined with m_shape_spec().

Examples

## Add a cylinder between residue 1 & 2 of Chain "A"
r3dmol() %>%
  m_add_model(pdb_6zsl) %>%
  m_zoom_to(sel = m_sel(resi = 1)) %>%
  m_add_cylinder(
    start = m_sel(resi = 1, chain = "A"),
    end = m_sel(resi = 2, chain = "A"),
    dashed = TRUE,
    radius = 0.1
  )
# Add two cylinders. # Blue cylinder is between residues 1 & 2 # Green cylinder is between residues 3 & 4 r3dmol() %>% m_add_model(pdb_6zsl) %>% m_zoom_to(sel = m_sel(resi = 1:4, chain = "A")) %>% m_add_cylinder( start = list( m_sel(resi = 1, chain = "A"), m_sel(resi = 3, chain = "A") ), end = list( m_sel(resi = 2, chain = "A"), m_sel(resi = 4, chain = "A") ), dashed = TRUE, radius = 0.1, color = c("blue", "green") ) %>% m_add_res_labels(m_sel(resi = 1:4, chain = "A"))
# The same scene achieved with m_multi_resi_sel() r3dmol() %>% m_add_model(pdb_6zsl) %>% m_zoom_to(sel = m_sel(resi = 1:4, chain = "A")) %>% m_add_cylinder( start = m_multi_resi_sel(resi = c(1, 3), chain = "A"), end = list( m_sel(resi = 2, chain = "A"), m_sel(resi = 4, chain = "A") ), dashed = TRUE, radius = 0.1, color = c("blue", "green") ) %>% m_add_res_labels(m_sel(resi = 1:4, chain = "A"))