Skip to main content

PDBeMolstar as anywidget

Project description

ipymolstar

image

Live Demos

Give ipymolstar a spin without even installing python!

Preview

You can run a quick preview of ipymolstar in a notebook with juv:

juv run example.ipynb

Installation

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.

Use

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

Citing

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.

PDBeMolstar

The PDBeMolstar widget is based on the PDBe integration of Mol*.

MolViewSpec

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.

Development

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

Creating a new release

  • 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

Hot reloading

To enable anywidget hot reloading, you need to set the env var ANYWIDGET_HMR to 1.

Windows:

set ANYWIDGET_HMR=1
jupyter lab

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipymolstar-0.1.0.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ipymolstar-0.1.0-py2.py3-none-any.whl (1.5 MB view details)

Uploaded Python 2Python 3

File details

Details for the file ipymolstar-0.1.0.tar.gz.

File metadata

  • Download URL: ipymolstar-0.1.0.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ipymolstar-0.1.0.tar.gz
Algorithm Hash digest
SHA256 39abe60c3a53d484c06b960871e9f9077201cd771f149c9f71ab138fb5fd6e71
MD5 3c78b68eda98aad3d5c3145cb7b8153a
BLAKE2b-256 7b26fad1d05042580e84eb26315d14cd0501887c7e6d77cb1da5f126c44d74c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ipymolstar-0.1.0.tar.gz:

Publisher: pypi_main.yml on Jhsmit/ipymolstar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ipymolstar-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: ipymolstar-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ipymolstar-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1361541cd25927a0daa41de9647c6116266a4f1f7d31888bee02a308cb97f1d8
MD5 9c3fba9776c2ddbd698f5f3c4d6f6e4e
BLAKE2b-256 b2725907058da13cb4dbecb58e0d1035a5e1ca16cb69fed64f797b0cf205d1bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for ipymolstar-0.1.0-py2.py3-none-any.whl:

Publisher: pypi_main.yml on Jhsmit/ipymolstar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page