Unveiling a New Era in Molecular Visualization: Introducing shiny.molstar for Large Molecular Structures Visualization in R

[This article was first published on Tag: r - Appsilon | Enterprise R Shiny Dashboards, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
shiny_molstar for molecular protein folding visualizations blogpost

The Importance of Molecular Visualization and Analysis in Drug Discovery

Drug discovery is a process that allows scientists to identify novel drug candidates that could eventually be approved for the treatment of a disease. There is an interesting relationship between drug discovery and the visualization of large molecular structures, such as proteins, ribosomes, virus capsids, among others.

Drug discovery heavily relies on the visualization of large molecular structures. By visualizing and understanding the three-dimensional structure of these large molecules and their structural arrangements, scientists gain valuable insights into their conformation, binding sites for novel small molecules, and the exploration of molecular rationales for understanding the mechanisms of action of existing or novel drugs.

Protein Visualization and the Drug Discovery Process

The visualization of large molecular structures provides crucial knowledge for identifying potential drug targets, most of which are proteins. Structure-wise, proteins are highly complex three-dimensional structures that result from multiple intermolecular interactions.

Once scientists have found potential new drugs, such as small molecules, that specifically target a protein of interest, the ability to perform molecular visualization becomes critical for better understanding the molecular interactions that occur between the novel small molecule and its target. The study of these interactions provides the basis for the rational design of new compounds with improved potency, selectivity, and bioavailability.

Ultimately, the ability to visualize and analyze large molecular structures in drug discovery provides scientists with the capacity to make informed decisions, accelerate the drug discovery process, and increase the chances of successfully identifying novel therapeutic interventions.

Table of Contents:

This article was co-authored by Life Sciences Innovation Lead, Ismael Rodriguez and R Shiny Developer, André Veríssimo.

Introducing shiny.molstar for the Visualization of Large Molecules

The shiny.molstar R package offers powerful capabilities and a user-friendly interface that facilitates the process of visualization. It combines the visualization prowess of Molstar with the interactive and dynamic capabilities of the R and Shiny ecosystem, bringing together the best of both worlds.

Molstar is an application that is useful for visualizing 3D models of large biomolecular structures. It was published in the journal Nucleic Acid Research in 2021.

Genomics visualizations are now available in R Shiny with shiny.gosling. Explore Gosling examples in an R Shiny app.

Adding Value by Integrating Molstar with the R and Shiny Ecosystem

R Shiny

The combination of these two technologies brings numerous benefits and enhances the overall experience of visualization. Shiny’s interactive and dynamic interface gives the users the opportunity to manipulate and explore three dimensional structures in real-time. Additionally, by harnessing the power of R, a widely used programming language for data analysis, users can leverage its extensive collection of statistical and computational packages to enhance their molecular visualization workflows.


Molstar empowers users to delve deep into the intricacies of their data. With Molstar, users can interact with the structure, rotate, zoom, and focus on specific regions of interest within the molecule. It also offers advanced rendering options, allowing users to choose from multiple visualization options such as molecular surfaces, ribbons, and ball-and-stick representations.


Through shiny.molstar, researchers and scientists can combine the visual insights provided by Molstar with the analytical capabilities of R, enabling in-depth data exploration. This synergy between Molstar, R, and Shiny opens up a world of novel possibilities for advanced data analysis in the realm of molecular visualization. Collectively, these characteristics make shiny.molstar a valuable tool for researchers seeking a comprehensive solution that integrates the best of both worlds.

Working with genomics data? Follow our shiny.gosling tutorial for genomics visualizations.

How to Use shiny.molstar

The shiny.molstar package can be installed from the Github repository using the remotes package.


The package exports a function called Molstar() that inserts the molstar full or partial interface to the UI definition of the Shiny application. You can create a minimal example that showcases the full interface in Shiny using the code provided below.


  ui = basicPage(
	tags$style(HTML("html, body, .container-fluid {margin: 0; padding: 0;}")),
  	pdbId = "1LOL",
  	useInterface = TRUE,
  	showControls = TRUE,
  	showAxes = TRUE
  server = function(input, output) {

By default, the interface expands to the full page, but you can integrate it into smaller elements using CSS rules.

You can also display it as a fixed-sized element, which is highly beneficial for previewing the structure in Molstar without the complete interface.

To create a sample of the Molstar visualization without the controls, use the following code. The Molstar visualization is displayed within a div.


pdbId <- "8OJJ"

  ui = basicPage(
        class = "box",
          pdbId = pdbId,
          dimensions = c(300, 300),
          showAxes = TRUE
          "Molecular visualization of pdbID:",
            href = glue::glue("https://www.ebi.ac.uk/pdbe/entry/pdb/{pdbId}"),
  server = function(input, output) {

Beyond the Surface: Delving into Molecular Analysis

When exploring the applications of molecular analysis for large molecular structures, several interesting features are worth noting. For example, users can perform measurements between atoms, calculate angles and dihedrals, and observe how amino acid chains are interconnected and maintain a proper folded state for the molecule of interest. These capabilities provide valuable insights into the structural characteristics and dynamics of the molecule, contributing to a deeper understanding of its behavior and function.

Measuring distances between molecules or atoms is of utmost importance when studying protein-protein interactions and protein-molecule interactions. These measurements help determine whether the molecules maintain chemical bonds that keep them in a bound state. By analyzing the distances, researchers can gain insights into the strength and stability of the interactions, which is crucial for understanding the molecular mechanisms and designing effective therapeutic interventions.

Data Retrieval with shiny.molstar

In shiny.molstar, users can retrieve multiple molecules from the Protein Data Bank (PDB) by entering the corresponding PDB IDs associated with those molecules. The structures that can be retrieved encompass various experimental settings, including NMR experiments, Cryo-EM (Electron Microscopy), and X-ray crystallography.

Pharmaceutical companies and research institutions typically conduct these experiments to gain a better understanding of the molecular and structural characteristics of large molecules, especially proteins. Researchers carry out these experiments under tightly controlled conditions, dedicating significant time and effort to process the experimental data. They refine the resulting experimental data before publishing and sharing it in databases like the PDB database.

In cases where experimental data for some large molecules cannot be obtained, AlphaFold emerges as a valuable tool. So naturally, we asked ourselves how to improve the workflow of these experiments using shiny.molstar. The answer:

Shiny.molstar Integrates with the AlphaFold Database

One of the remarkable advantages of shiny.molstar is its integration with the AlphaFold database, a powerful resource for protein structure prediction. This integration enables researchers to conveniently access and visualize protein structures stored in the AlphaFold database. It significantly enhances research capabilities by allowing the use of predicted structures, even in cases where the experimental determination of a large molecular structure has not been possible. These predicted structures can be utilized for further investigations and experiments, providing valuable insights into protein function and facilitating the design of potential therapeutic interventions.

R Shiny apps connected to databases make drug-drug interaction exploration more accessible and easier than ever. Learn more about DDI with R Shiny.

Why AlphaFold Database Access is Important for You

Indeed, the AlphaFold database offers highly accurate protein structure predictions, and its publication in the prestigious journal Nature has further established its credibility. Since its release, the AlphaFold database has gained widespread adoption within the research community.

The integration of shiny.molstar with the AlphaFold database provides users with convenient access to this valuable resource, unlocking new avenues for studying protein folding, protein-protein interactions, and analyzing the relationship between protein structure and function. Researchers can leverage this integration to explore and analyze protein structures, facilitating groundbreaking research and advancements in various fields.

Advancing Molecular Biology Visualizations in R and Shiny

The introduction of shiny.molstar represents an interesting input in the field of molecular visualization. It integrates the best of two worlds, the shiny framework and the powerful visualization features of the Molstar application. The introduction of our application expands the way in which researchers explore and analyze large molecular biological structures.

The shiny.molstar package expands the horizons of structural research by accessing and retrieving 3D structures from databases like PDB and AlphaFold. This capability is crucial in the drug discovery process, structural biology, and other scientific domains dedicated to enhancing quality of life.

If you find shiny.molstar of value, please give it a star on GitHub. And if you have any comments, suggestions or identify issues, please feel free to reach out! User feedback helps our open source initatives like the Rhinoverse thrive.

Looking to make an impact with your project? Check out Appsilon’s case studies. See how we help teams like yours unlock pharmaceutical insights with Shiny or empower Biotech supply chain planners with React.


Jumper, J., Evans, R., Pritzel, A. et al. Highly accurate protein structure prediction with AlphaFold. Nature 596, 583–589 (2021). https://doi.org/10.1038/s41586-021-03819-2

Sehnal D, Bittrich S, Deshpande M, Svobodová R, Berka K, Bazgier V, Velankar S, Burley SK, Koča J, Rose AS. Mol* Viewer: modern web app for 3D visualization and analysis of large biomolecular structures. Nucleic Acids Res. 2021 Jul 2;49(W1):W431-W437. doi: 10.1093/nar/gkab314. PMID: 33956157; PMCID: PMC8262734.

The post appeared first on appsilon.com/blog/.

To leave a comment for the author, please follow the link and comment on their blog: Tag: r - Appsilon | Enterprise R Shiny Dashboards.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)