-
Notifications
You must be signed in to change notification settings - Fork 48
Scipion web volume map visualization

Scipion web client environment could have some limitations over desktop client environment. One of these hipotetical limitations is the posibility of using client machine tools to visualize some Scipion files.
In volumes visualization case exists the posibility of using some tools that allows open and interact with the volume in a web client. In this document we are going to see several alternatives to implement it:
<a target="_blank" href="http://openastexviewer.net/web/" title="Open Astex Viewer web page">Open Astex Viewer</a> 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.
1 We know Open Astex Viewer because we have another project in the laboratory that uses it: <a target="_blank" href="http://pepper.cnb.csic.es/das/PeppeR/" title="PeppeR home page">PeppeR</a>. 1 It can be displayed as an Applet in a web page. 1 It can be customized. 1 It allows interaction.
1 When it is displayed as an applet it has all the disadvantages of an applet. 1 When it is used as an applet it has some restrictions that we are going to see in installation section.
We are not going to use Open Astex Viewer jar published in their official web page because we detected some problems in the past so we use <a target="_blank" href="http://www.ebi.ac.uk/pdbe/entry/applets/OpenAstexViewer.jar" title="Open Astex Viewer jar">EMDB jar</a>.
As we are working with Django, this installation is referred to this framework.
1.- Place jar file in the public static folder.
2.- In the html code include the applet code (here there is an example):
<applet width="600px" height="600px" name="av" archive="{{ STATIC_URL }}astex/OpenAstexViewer.jar" codebase=".." code="MoleculeViewerApplet.class"> <param name="script" value="map load volMap '{{volLink}}' {{form.volType.value}} {{form.threshold.value}}; map volMap contour 0 solid on; radius 50; center map volMap; view -background lightgrey; map volMap -reread true;"> </applet>
NOTES
Jar and sript file paths must be defined using "static" value set in Django "settings.py" file. Loading script can be defined using the "script" param and setting the value with the commands or ussing "scriptfile" param and setting it value with the script file path.
Script file and volume maps must be placed in jar location subpaths and volume file paths must follow "/staticUrl/path" format.
<a target="_blank" href="http://www.cgl.ucsf.edu/chimera/" title="Chimera home page">UCSF Chimera</a> 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 volue maps in a web page.
1 It does not use any applet, it is html, css and javascript code. 1 It has no restrictions.
1 It requirest o be installed in server machine. 1 It does not allow complex interactions.
1.- We must install headless Chimera version, this version is for servers or another places where we do not need user GUI and it avoid 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 it is an example code:
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("</html>")[1]
We are going to see the each line function: 1 Execute chimera telling that when it starts also run ReadStdin utility (to read commands from std in) and giving the file to open. 1 Define a temporal html file path for the webGL exportation. 1 Define a initial threshld value. 1 Execute chimera commands to apply a threshold to the volume, export to a webGL html file and close chimera. 1 Open the exported file to read it. 1 Extract the html code that we need. After this you can include this html in your page adding another static code (code that is always the same) taen from the exported file that is needed for the corect webGL visualization.
1.- After some using experienced ReadStdin utility command has been removed because we have some problems, but we must know it. Now we use this instruction:
p = Popen(['chimera', inputVolume], stdout=PIPE, stdin=PIPE, stderr=PIPE)
2.- With an incorrect threshold we will see a black result. With a very bad threshold we will not see anything.
— Main.AntonioPozaBallesteros - 2013-07-19