Skip to content

Commit

Permalink
add a simple sample
Browse files Browse the repository at this point in the history
  • Loading branch information
biasmv committed Jun 27, 2015
1 parent c53108b commit 42b9692
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/samples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ List of PV samples

.. toctree::

structure-with-ligand
ensemble/index
hover/index
33 changes: 33 additions & 0 deletions doc/samples/structure-with-ligand.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Display protein together with ligands
========================================

This sample shows how to render a protein in cartoon mode and display the contained ligands as balls-and-sticks. For this particular example, we have chosen the dengue methyl transferase structure (1r6a) which contains a s-adenosyl homocysteine and the inhibitor ribavirin 5' triphosphate.


.. pv-sample::

<script>
var parent = document.getElementById('viewer');
var viewer = pv.Viewer(parent,
{ width : 300, height : 300, antialias : true });
pv.io.fetchPdb('http://www.rcsb.org/pdb/files/1r6a.pdb', function(structure) {
// select the two ligands contained in the methyl transferase by name, so
// we can display them as balls and sticks.
viewer.on('viewerReady', function() {
var ligand = structure.select({rnames : ['RVP', 'SAH']});
viewer.ballsAndSticks('ligand', ligand);
// display the whole protein as cartoon
viewer.cartoon('protein', structure);

// set camera orientation to pre-determined rotation, zoom and
// center values that are optimal for this very protein
var rotation = [
0.1728139370679855, 0.1443438231945038, 0.974320650100708,
0.0990324765443802, 0.9816440939903259, -0.162993982434272,
-0.9799638390541077, 0.1246569454669952, 0.155347332358360
];
var center = [6.514, -45.571, 2.929];
viewer.setCamera(rotation, center, 73);
});
});
</script>

0 comments on commit 42b9692

Please sign in to comment.