Skip to contents

R Shiny wrapper for Mol* (/’molstar/) - A visualization toolkit of large-scale molecular data

Based on Mol* (/’molstar/) and powered by shiny.react

We created a R Shiny wrapper based on shiny.react and molstar-react (node.js library) that gives all the powerful tools of Mol* open-source toolkit for visualization and analysis of large-scale molecular data.

This package exports three new components that can be used in a Shiny application.

  • Molstar creates a Molstar visualization of a protein using an URL to a valid filetype supported by Molstar or a “Protein Data Bank” id (pdbId). See more below for available databases to find a valid pdbId.
  • AlphaFoldMolstar similar to the Molstar component, but uses the UniProt id in the AlphaFold database to display the protein.
  • AlphaFoldDetails creates a component that retrieves details of an AlphaFold protein id (title, download links and a Predict Aligned Error image)

How to find a valid id or url?

A valid pdbId can be found in public databases such as:

The uniProtId can be found in any of the AlphaFold databases:

Getting started

To install the package, run:

remotes::install_github("Appsilon/shiny.molstar")

Take a look at basic example app to start working with shiny.molstar.

To learn about the Mol* language, follow the Viewer documentation.

Examples

A good way to learn more is to look at the examples. Once you install the library, you can run them with shiny.molstar::runExample function.

shiny.molstar::runExample("FullPage")
shiny.molstar::runExample("Minimal")
shiny.molstar::runExample("AlphaFold")
shiny.molstar::runExample("AlphaFoldDetails")

Full page example

Creating a full page viewer on a sample molecule (example also available at inst/examples/FullPage.R)

library(shiny)
library(shiny.molstar)

shinyApp(
  ui = tagList(
    tags$style(HTML("html, body { margin: 0; }")),
    Molstar(
      pdbId = "1LOL",
      useInterface = TRUE,
      showControls = TRUE,
      showAxis = TRUE
    )
  ),
  server = function(input, output) {
  }
)

Full page example

Using AlphaFold database and details

Running an example from the package (located at inst/examples/AlphaFoldDetails.R).

You can click on the button on the bottom of the example to get the minimal code to reproduce the same Shiny application (unstyled and without the footer).

shiny.molstar::runExample("AlphaFoldDetails")

AlphaFold with details

Appsilon

Appsilon is a Posit (formerly RStudio) Full Service Certified Partner.
Learn more at appsilon.com.

Get in touch opensource@appsilon.com

Explore the Rhinoverse - a family of R packages built around Rhino!

We are hiring!