Introduction

molviewer is a Python package which aims to provide an easy and intuitive way of retrieving and viewing 3D models of molecules from the rcsb and ChEMBL databases. It is intended to be used within a Jupyter notebook and essentially provides an extension of the nglview Python package (see here).

The aim here was to define two classes: Macromolecule for molecules from the rcsb database, and ChemicalMolecule for small molecules from the ChEMBL database. Both classes wrap the nglview.NGLWidget methods for viewing multiple 3D molecule models and enable the user to save the molecular information to file. In the case of ChemicalMolecule, 2D SMILES structure is converted in to a 3D conformer using methods available in the rdkit Python package.

The package is platform agnostic and is built using Python 3.8+. It implements typing conventions according to PEP484 and PEP526, and it was written following the principles of test-driven development so comes with test suite.

Motivation

By providing methods for retrieving and visualizing the 3D structure of molecules, we enable detailed examination of how molecules interact. This functionality could, for example, be important for assessing the expected function of drugs or ligands, or macromolecule mutations.