add_model: Create and add model to viewer

Description Usage Arguments Value Examples

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

1
2
3
4
5
6
7
8
9
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)

r3dmol documentation built on March 14, 2021, 5:08 p.m.