Skip to main content

An IPython interface for embedding iCn3D viewer

Project description

icn3dpy

icn3dpy is a simple IPython/Jupyter widget to embed an interactive iCn3D viewer in a notebook. Its source code is at PyPI, and is also included at iCn3D GitHub.

The 3D view of icn3dpy in Jupyter Notebook is interactive, just like in any browser. The popup windows will appear under the 3D view. If you have a predefined cutom view, you can use the predefined commands in icn3dpy as shown below.

If you experience problems, please file an issue.

Installation

Install icn3dpy:

pip install icn3dpy

Install node if node is unavailable. One way in Mac is to use "brew":

brew update

brew install node 

Install Jupyter Lab and the extension "jupyterlab_3dmol":

pip install jupyterlab

jupyter labextension install jupyterlab_3dmol
or jupyterhub labextension install jupyterlab_3dmol

Usage

Open a notebook:

jupyter notebook

and issue Python script as follows:

import icn3dpy

"mmdbid" as input:

view = icn3dpy.view(q='mmdbid=6hjr')
view

You can also try other input besides "mmdbid". "cid" as input:

view = icn3dpy.view(q='cid=2244')
view

"url" as input for local PDB files, e.g., "./1TOP.pdb":

view = icn3dpy.view(q='url=pdb|./1TOP.pdb')
view

"url" as input for remote PDB files:

view = icn3dpy.view(q='url=pdb|https://storage.googleapis.com/membranome-assets/pdb_files/proteins/FCG2A_HUMAN.pdb')
view

"url" as input for iCn3D PNG Image files:

view = icn3dpy.view(q='url=icn3dpng|https://api.figshare.com/v2/file/download/39125801')
view

Use predefined commands (The Jupyter Notebook commands can be copied from the "Copy Commands" button in the "File > Share Link" menu of interactive iCn3D viewers in Jupyter Notebook or in a web browser):

view = icn3dpy.view(q='mmdbid=6m0j',command='scatterplot interaction pairs | !A !E | hbonds,salt bridge,interactions,halogen,pi-cation,pi-stacking | false | threshold 3.8 6 4 3.8 6 6; show selection; add residue number labels')
view

Embed a static image instead of an interactive 3D view to improve the performace of a page with multiple structures. The image is clickable to launch an interactive 3D view. The parameters are separated with the symbol "&" (e.g., "imageonly=1&showanno=1"). All parameters are described in the "URL parameters" section:

view = icn3dpy.view(q='mmdbid=6hjr', para='imageonly=1')
view

Command

You can use iCn3D interactive interface to generate a custom view, then click "File > Share Link" to get the commands in the "Original URL". All iCn3D commands are listed here.

License

United States Government Work

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

icn3dpy-3.38.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

icn3dpy-3.38.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file icn3dpy-3.38.0.tar.gz.

File metadata

  • Download URL: icn3dpy-3.38.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.8.2 requests/2.28.1 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.7.3

File hashes

Hashes for icn3dpy-3.38.0.tar.gz
Algorithm Hash digest
SHA256 4b1fc2d99e2ace175e5a3f846f6573d41239c55fe84498978a44eef722c2ad18
MD5 e8baed21ee3e4a8f4185a824e09acd58
BLAKE2b-256 f634740e0c427eec23ba6b5512ece8ad35d622b85cd718600aff76d007a1c81e

See more details on using hashes here.

File details

Details for the file icn3dpy-3.38.0-py3-none-any.whl.

File metadata

  • Download URL: icn3dpy-3.38.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.8.2 requests/2.28.1 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.7.3

File hashes

Hashes for icn3dpy-3.38.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e8e7e88aac991489b474ba89123e827e2dd750e346018866f34b62f87cf49e2
MD5 e774872c4d55412cb6bb3b86798ffb90
BLAKE2b-256 19359db2677b3b9387db4527f9f3a0dea6a650ebbed7bed81e8e2e7afc68d211

See more details on using hashes here.

Supported by

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