.. figure:: /docs/images/scipion_logo.gif
:width: 250
:alt: scipion logo
.. _scipion-web-volume-map-visualization:
=====================================
Scipion web volume map visualization
=====================================
Objectives
==========
Scipion web client environment can have some limitations compared to the
desktop client environment. One of these hypothetical limitations is the
possibility of using client machine tools to visualize some Scipion
files.
In volume visualization, it is possible to use some tools
that allow the user to open and interact with volumes in a web client. Here,
we will see several alternative ways to do so:
Open Astex viewer
=================
`Open Astex Viewer `_ is a Java molecular
graphics program that assists in structure-based drug design. It can be
used as an applet in a web page or as a desktop application.
Advantages
----------
1. We are familiar with Open Astex Viewer because we have another project in the
laboratory that uses it: `PeppeR `_.
2. It can be displayed as an applet in a web page.
3. It can be customized.
4. It allows interaction.
Disadvantages
--------------
1. When it is displayed as an applet it has all the disadvantages of an
applet.
2. When it is used as an applet it has some restrictions that we
will see below in the Installation section.
Installation
-------------
We are not going to use the Open Astex Viewer jar published on their
official web page because we have detected some problems with it, so we
will use `EMDB jar `_.
Since we are working with Django, the installation is referred in to this
framework.
1. Place jar file in the Django static folder (Django: STATIC_ROOT = 'static').
2. In the html code include the applet code (here is an example):
.. code-block:: bash
*NOTES*
Jar and script file paths must be defined using a "static" value set in
Django "settings.py" file. To load the applet you can add a parameter (HTML element) called "script" and set it to the script code you want to use or you can use a "scriptfile" parameter and set its value to the script file path.
Script file and volume maps must be placed in jar location sub-folders and
volume files path must follow "/staticUrl/path" format.
Problems
-----------
Continuous conflicts with java navigator and installed JRE versions.
Now we get errors executing commands in the visualizer after loading it
(even in 3demloupe web).
Chimera
--------
`UCSF Chimera `_ is a program for interactive
visualization and analysis of molecular structures and related data.
This program has an export option where you can export a volume path as
a webGL page; this functionality will allow us to visualize volume maps
in a web page.
Advantages
-----------
1. It does not use an applet; it is html, css and javascript code.
2. It has no restrictions.
Disadvantages
-------------
1. It must be installed on the server machine.
2. It does not allow complex interactions.
Installation
---------------
1. We must install a headless Chimera version; this version is for servers or other places where we do not need a user GUI, and it avoids some problems for our operations.
2. Our code must open Chimera, load the volume map, export it, take the needed code from exported file, and add it to our html code. Here is an example code:
.. code-block:: bash
p = Popen(['chimera', '--start', 'ReadStdin', volPath], stdout=PIPE, stdin=PIPE, stderr=PIPE) # Read problems section. This has changed.
outputHtmlFile = '/home/ballotelli/tmpDir/test.html'
threshold = exampleThreshold
stdout_data = p.communicate(input='volume #0 level ' + str(threshold) + '; export format WebGL ' + outputHtmlFile + '; stop')[0]
f = open(outputHtmlFile)
chimeraHtml = f.read().decode('string-escape').decode("utf-8").split("