This sample application resembles Sample 03, but there are a couple of important differences, reflect the fact that we are working with multiple origins.
Note that is page should have launched PyMOL when it opened, instead of being served up into a new browser window hosted by PyMOL's own web server, which should now be running on port 8081.
The port number of the PyMOL web server is controlled by the contents of the PWG file which is used as the source content for the IFRAME.
The command queuing infrastructure is the same as Sample 03, so we have not repeated it here. What has changed, however, is that we now need to direct our PyMOL command links at PyMOL's web server instead of at the web server hosting this page. The required change is hilighted below in red.
function cmd() { for(var i=0; i < arguments.length; i++) { pymol_queue.push( "http://localhost:8081/apply/pymol.cmd."+ arguments[i] + ( arguments[i].indexOf('?') < 0 ? '?' : '&' ) + "_ts=" + new Date().getTime()); } if(!pymol_active) { pymol_queue_flush(); } }
cmd('set?name=suspend_updates', 'delete?name=all', 'reset', 'load?filename=$PYMOL_PATH/test/dat/1tii.pdb', 'show?representation=cartoon', 'show_as?representation=sticks&selection=chain A', 'orient?selection=chain A&animate=5', 'unset?name=suspend_updates') cmd('count_atoms') cmd('reinitialize')