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

By:
Ismael Rodriguez
July 10, 2023

<h2 id="">The Importance of Molecular Visualization and Analysis in Drug Discovery</h2>
<strong>Drug discovery</strong> 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 <strong>visualization of large molecular structures</strong>, 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 <strong>exploration of molecular rationales</strong> for understanding the mechanisms of action of existing or novel drugs.
<h3>Protein Visualization and the Drug Discovery Process</h3>
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 <strong>analyze large molecular structures in drug discovery</strong> 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:
<ul><li><a href="#importance">The Importance of Molecular Visualization and Analysis in Drug Discovery</a></li><li><a href="#visualization">Introducing shiny.molstar for the Visualization of Large Molecules</a></li><li><a href="#molstar">Adding Value by Integrating Molstar with the R and Shiny Ecosystem</a></li><li><a href="#shinymolstar">How to Use shiny.molstar</a></li><li><a href="#analysis">Beyond the Surface: Delving into Molecular Analysis</a></li><li><a href="#alphafold">Shiny.molstar Integrates with the AlphaFold Database</a></li><li><a href="#conclusion">Advancing Molecular Biology Visualizations in R and Shiny</a></li></ul>
This article was co-authored by<strong> Life Sciences Innovation Lead</strong>, Ismael Rodriguez and <strong>R Shiny Developer</strong>, <a href="https://appsilon.com/author/andre/" target="_blank" rel="noopener">André Veríssimo.</a>

<hr />

<h2 id="visualization">Introducing shiny.molstar for the Visualization of Large Molecules</h2>
The <a href="https://appsilon.github.io/shiny.molstar/" target="_blank" rel="noopener">shiny.molstar</a> 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 <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8262734/" target="_blank" rel="noopener">Nucleic Acid Research</a> in 2021.
<blockquote>Genomics visualizations are now available in R Shiny with shiny.gosling. <a href="https://connect.appsilon.com/shiny-gosling/" target="_blank" rel="noopener">Explore Gosling examples in an R Shiny app</a>.</blockquote>
<h2 id="molstar">Adding Value by Integrating Molstar with the R and Shiny Ecosystem</h2>
<h3>R Shiny</h3>
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.
<h3>Molstar</h3>
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.
<h3>shiny.molstar</h3>
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.
<blockquote>Working with genomics data? Follow our <a href="https://appsilon.com/gosling-r-shiny/" target="_blank" rel="noopener">shiny.gosling tutorial for genomics visualizations</a>.</blockquote>
<h2 id="shinymolstar">How to Use shiny.molstar</h2>
The shiny.molstar package can be installed from the <a href="https://github.com/shiny.molstar" target="_blank" rel="noopener">Github repository</a> using the remotes package.
<pre><code>
remotes::install_github("Appsilon/shiny.molstar")
</code></pre>
The package exports a function called <code>Molstar()</code> 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.
<pre><code>
library(shiny)
library(shiny.molstar)
<br>shinyApp(
 ui = basicPage(
tags$style(HTML("html, body, .container-fluid {margin: 0; padding: 0;}")),
Molstar(
  pdbId = "1LOL",
  useInterface = TRUE,
  showControls = TRUE,
  showAxes = TRUE
)
 ),
 server = function(input, output) {
 }
)
</code></pre>

<video width="100%" height="auto" src="https://wordpress.appsilon.com/wp-content/uploads/2023/07/r-shiny-molstar-demonstration.webm" loop="true" autoplay="true" controls="true"></video>

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.
<pre><code>
library(shiny)
library(shiny.molstar)
library(glue)
<br>pdbId &lt;- "8OJJ"
<br>shinyApp(
 ui = basicPage(
   tags$main(
     tags$div(
       class = "box",
       ##
       Molstar(
         pdbId = pdbId,
         dimensions = c(300, 300),
         showAxes = TRUE
       ),
       ##
       tags$hr(),
       tags$span(
         "Molecular visualization of pdbID:",
         tags$a(
           href = glue::glue("https://www.ebi.ac.uk/pdbe/entry/pdb/{pdbId}"),
           pdbId
         )
       )
     )
   )
 ),
 server = function(input, output) {
 }
)
</code></pre>
<h2 id="analysis">Beyond the Surface: Delving into Molecular Analysis</h2>
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.
<h3>Data Retrieval with shiny.molstar</h3>
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, <a href="https://alphafold.ebi.ac.uk/" target="_blank" rel="noopener">AlphaFold</a> emerges as a valuable tool. So naturally, we asked ourselves how to improve the workflow of these experiments using shiny.molstar. The answer:
<h2 id="alphafold">Shiny.molstar Integrates with the AlphaFold Database</h2>
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.

<video width="100%" height="auto" src="https://wordpress.appsilon.com/wp-content/uploads/2023/07/shiny-molstar-alphafold-protein-fold-visualizations-in-r.webm" loop="true" autoplay="true" controls="true"></video>


<blockquote>R Shiny apps connected to databases make drug-drug interaction exploration more accessible and easier than ever. <a href="https://appsilon.com/drug-drug-interactions-r-shiny/" target="_blank" rel="noopener">Learn more about DDI with R Shiny</a>.</blockquote>
<h3>Why AlphaFold Database Access is Important for You</h3>
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.
<h2 id="conclusion">Advancing Molecular Biology Visualizations in R and Shiny</h2>
The introduction of <a href="https://appsilon.github.io/shiny.molstar/" target="_blank" rel="noopener">shiny.molstar</a> 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 <a href="https://github.com/appsilon/shiny.molstar" target="_blank" rel="noopener">give it a star on GitHub</a>. 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 <a href="https://rhinoverse.dev/#rhino" target="_blank" rel="noopener">Rhinoverse</a> thrive.

Looking to make an impact with your project? Check out <a href="https://casestudies.appsilon.com/" target="_blank" rel="noopener">Appsilon's case studies</a>. See how we help teams like yours unlock <a href="https://casestudies.appsilon.com/r-shiny-pharmaceutical-case-study/" target="_blank" rel="noopener">pharmaceutical insights with Shiny</a> or empower <a href="https://casestudies.appsilon.com/r-shiny-and-python-react-supply-chain-case-study/" target="_blank" rel="noopener">Biotech supply chain planners with React</a>.
<h3>References:</h3>
Jumper, J., Evans, R., Pritzel, A. et al. Highly accurate protein structure prediction with AlphaFold. Nature 596, 583–589 (2021). <a href="https://doi.org/10.1038/s41586-021-03819-2">https://doi.org/10.1038/s41586-021-03819-2</a>

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.

Have questions or insights?

Engage with experts, share ideas and take your data journey to the next level!

Is Your Software GxP Compliant?

Download a checklist designed for clinical managers in data departments to make sure that software meets requirements for FDA and EMA submissions.
Explore Possibilities

Share Your Data Goals with Us

From advanced analytics to platform development and pharma consulting, we craft solutions tailored to your needs.

Talk to our Experts
r
shiny
data visualization
database