Skip to main content

An IPython interface for embedding iCn3D viewer

Project description


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.


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


Open a notebook:

jupyter notebook

and issue Python script as follows:

import icn3dpy

"mmdbid" as input:

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


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

view = icn3dpy.view(q='pdbid=2bbv')


"mmtfid" as input:

view = icn3dpy.view(q='mmtfid=6vxx')


"cid" as input:

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


Use predefined commands (see commands in iCn3D Gallery for reference):

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')



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.


United States Government Work

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

icn3dpy-3.12.4.tar.gz (5.4 kB view hashes)

Uploaded source

Built Distribution

icn3dpy-3.12.4-py3-none-any.whl (10.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page