Bio3DView.jl tutorial

This notebook outlines the features available in Bio3DView.jl, a viewer for molecular structures in Julia. It is a wrapper round the excellent 3Dmol.js package. When used from the REPL or a file, the viewer shows in a popup using Blink.jl. When used from IJulia running in a Jupyter notebook or JupyterLab, or from Pluto.jl, the viewer shows in the output cell. You can also use Bio3DView.jl to generate standalone HTML, e.g. for use in a web page.

See the installation instructions to install Bio3DView.jl. More documentation on each function can be found using ?, e.g. ?IsoSurface.

There is a known bug where rendering a surface/box removes these from previous cells. This affects the below tutorial.

In [4]:
using Bio3DView

View a file in a given file format. Click, drag and zoom with the mouse to move the molecule. Available formats are "pdb", "sdf", "xyz" and "mol2". The second argument is optional and is inferred from the file extension if not given.

In [5]:
viewfile("benzene.sdf", "sdf")
Out[5]:

If you want to return the HTML as a String to open in a browser or use in your own web pages, set the html keyword argument to true.

View a PDB file by PDB ID (requires an internet connection):

In [6]:
viewpdb("1CRN")
Out[6]:

Pass a Style to style the display:

In [7]:
style = Style("sphere", Dict("colorscheme"=> "greenCarbon"))
viewfile("benzene.sdf", style=style)
Out[7]: