Create Interactive 3D Visualizations of Molecular Data

Create rich and fully interactive 3D visualizations of molecular data. Visualizations can be included in Shiny apps and R markdown documents, or viewed from the R console and 'RStudio' Viewer. 'r3dmol' includes an extensive API to manipulate the visualization after creation, and supports getting data out of the visualization into R. Based on the '3dmol.js' and the 'htmlwidgets' R package.


r3dmol

CRANstatus Codecov testcoverage R buildstatus Lifecycle:experimental Metacrandownloads

This is an R package that provides support for 3Dmol.js as a htmlwidgets.

Installation

Important: This package is still very early in its development stages. Please give the repository a star on Github if you find the package is useful. In addition, we need your feedback to improve the package, feel free to create an issue if you have any question or feature requirement. You are more than welcome to submit a PR to make any feasible improvements.

You could install the released version of r3dmol from CRAN with:

install.packages("r3dmol")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("swsoyee/r3dmol")

Example

library(r3dmol)

r3dmol(                         # Set up the initial viewer
  viewer_spec = m_viewer_spec(
    cartoonQuality = 10,
    lowerZoomLimit = 50,
    upperZoomLimit = 350
  )
) %>%
  m_add_model(                  # Add model to scene
    data = pdb_6zsl,
    format = "pdb"
  ) %>%
  m_zoom_to() %>%               # Zoom to encompass the whole scene
  m_set_style(                  # Set style of structures
    style = m_style_cartoon(
      color = "#00cc96"
    )
  ) %>%
  m_set_style(                  # Set style of specific selection
    sel = m_sel(ss = "s"),      # (selecting by secondary)
    style = m_style_cartoon(
      color = "#636efa",
      arrows = TRUE
    )
  ) %>%
  m_set_style(                  # Style the alpha helix
    sel = m_sel(ss = "h"),      # (selecting by alpha helix)
    style = m_style_cartoon(
      color = "#ff7f0e"
    )
  ) %>%
  m_rotate(                     # Rotate the scene by given angle on given axis
    angle = 90,
    axis = "y"
  ) %>%
  m_spin()                      # Animate the scene by spinning it

spin demo
You can find more demo at here.

About 3Dmol.js

Nicholas Rego, David Koes, 3Dmol.js: molecular visualization with WebGL, Bioinformatics, Volume 31, Issue 8, 15 April 2015, Pages 1322–1324,

Code of Conduct

Please note that the r3dmol project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("r3dmol")

0.1.2 by Wei Su, 6 years ago


https://github.com/swsoyee/r3dmol


Report a bug at https://github.com/swsoyee/r3dmol/issues


Browse source code at https://github.com/cran/r3dmol


Authors: Wei Su [aut, cre] , Brady Johnston [aut]


Documentation:   PDF Manual  


BSD_3_clause + file LICENSE license


Imports htmlwidgets, magrittr, methods, bio3d

Suggests knitr, rmarkdown, shiny, colourpicker, covr, testthat


Imported by HaDeX2.

Suggested by protti, rPDBapi.


See at CRAN