m_add_model {r3dmol}R Documentation

Create and add model to viewer

Description

Create and add model to viewer, given molecular data and its format. If multi-model file is provided, use m_add_models adding atom data to the viewer as separate models.

Usage

m_add_model(
  id,
  data,
  format = c("pdb", "sdf", "xyz", "pqr", "mol2", "cif"),
  keepH = FALSE,
  options = list()
)

m_add_models(id, data, format = c("pdb", "sdf", "xyz", "pqr", "mol2", "cif"))

Arguments

id

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

data

Path of input data path or a vector of data.

format

Input format ('pdb', 'sdf', 'xyz', 'pqr', or 'mol2').

keepH

Default to FALSE, whether to keep or strip hydrogens from imported model.

options

Format dependent options. Attributes depend on the input file format.

Value

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

Examples

library(r3dmol)

# Single-model file with m_add_model() function
r3dmol() %>%
  m_add_model(data = pdb_6zsl, format = "pdb")

# Multi-model file with m_add_models() function
r3dmol() %>%
  m_add_models(data = sdf_multiple, "sdf") %>%
  m_zoom_to()

# Multi-model file with m_add_model() function
r3dmol() %>%
  m_add_model(data = sdf_multiple, "sdf") %>%
  m_zoom_to()

# Add model and keep hydrogens.
## Not run: 
r3dmol() %>%
  m_add_model(m_fetch_pdb("5D8V"), keepH = TRUE) %>%
  m_set_style(m_style_sphere()) %>%
  m_zoom_to() %>%
  m_spin()

## End(Not run)

[Package r3dmol version 0.1.2 Index]