hainm / molstarview

Try to bring molstar to Jupyter notebook (no lab yet).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Usable but still "Work-in-progress"

Codes are copied/adapted from nglview and molstar. Will update the licenses.

molstarview-widget

Example

  • Load structure and trajectory
from molstarview.widget import MolstarView
from nglview.adaptor import SimpletrajTrajectory
import nglview as nv

traj = SimpletrajTrajectory(nv.datafiles.XTC, nv.datafiles.PDB)
view = MolstarView()
view.add_trajectory(traj)

struc = nv.FileStructure('1tsu.pdb')
view.add_structure(struc)
view

Installation

Only development installation is available (requires Node.js and Yarn version 1),

$ git clone https://github.com/molstar/molstarview-widget.git
$ cd molstarview-widget
$ pip install -e .
$ jupyter nbextension install --py --symlink --overwrite --sys-prefix molstarview
$ jupyter nbextension enable --py --sys-prefix molstarview

When actively developing your extension for JupyterLab, run the command:

$ jupyter labextension develop --overwrite molstarview

Then you need to rebuild the JS when you make a code change:

$ cd js
$ yarn run build

You then need to refresh the JupyterLab page when your javascript changes.

Acknowledgement

About

Try to bring molstar to Jupyter notebook (no lab yet).


Languages

Language:Python 51.1%Language:TypeScript 39.3%Language:JavaScript 9.6%