Give ipymolstar
a spin without even installing python!
- Try it in jupyter lab via JupyterLite 🌍🚀
- Explore the solara ☀️ demo application on Ploomber-cloud ⛅
- Grab a cup and play with the solara, pyshiny or panel live demo's on PyCafé ☕
- Upload your Alphafold3 .zip result and view plddt or chain colors in the
solarafold
result viewer on huggingface 🤗 - Control the camera 📷 with MolViewSpec from python 🐍 in a solara ☀️ dashboard on PyCafé ☕
You can find other examples in the examples directory.
You can run a quick preview of ipymolstar
in a notebook with juv:
juv run example.ipynb
pip install ipymolstar
Warning
Make sure you install ipymolstar in an environment that contains your installation of Jupyter. If you have installed Jupyter in a different environment from your project (requiring you to use a named, non-default kernel), you will have to install ipymolstar (or only anywidget) in your Jupyter environment as well.
from ipymolstar import PDBeMolstar
view = PDBeMolstar(molecule_id='1qyn', theme='light', hide_water=True)
view
Loading local data, hiding the buttons:
from pathlib import Path
fpth = Path().resolve() / 'assets' / '6vsb.bcif'
custom_data = {
'data': fpth.read_bytes(),
'format': 'cif',
'binary': True,
}
view = PDBeMolstar(
custom_data=custom_data,
hide_controls_icon=True,
hide_expand_icon=True,
hide_settings_icon=True,
hide_selection_icon=True,
hide_animation_icon=True,
hide_water=True,
hide_carbs=True,
)
view
See the example notebook for more advanced usage. Solara example code can be found here
ipymolstar
uses anywidget to create a widgets based on Mol*
To cite Mol*:
David Sehnal, Sebastian Bittrich, Mandar Deshpande, Radka Svobodová, Karel Berka, Václav Bazgier, Sameer Velankar, Stephen K Burley, Jaroslav Koča, Alexander S Rose: Mol* Viewer: modern web app for 3D visualization and analysis of large biomolecular structures, Nucleic Acids Research, 2021; 10.1093/nar/gkab31.
The PDBeMolstar widget is based on the PDBe integration of Mol*.
The MolViewSpec widget is based on MolViewSpec. To cite MolViewSpec:
Sebastian Bittrich, Adam Midlik, Mihaly Varadi, Sameer Velankar, Stephen K. Burley, Jasmine Y. Young, David Sehnal, Brinda Vallat: Describing and Sharing Molecular Visualizations Using the MolViewSpec Toolkit, Current Protocols, 2024; 10.1002/cpz1.1099
See also the RCSB citation policies for additional citation information.
The molviewspec widget front-end code bundles it's JavaScript dependencies. After setting up Python, make sure to install these dependencies locally:
npm install
While developing, you can run the following in a separate terminal to automatically rebuild JavaScript as you make changes:
npm run dev
- update
__version__
in__init__.py
- create a new release on GitHub, choose as tag 'v' +
__version__
; ie 'v0.0.3' - GitHub actions should automatically deploy to PyPi
To enable anywidget hot reloading, you need to set the env var ANYWIDGET_HMR
to 1.
Windows:
set ANYWIDGET_HMR=1
jupyter lab