molviewer package

Submodules

molviewer.molecules module

Molviewer Molecule classes.

A molecule is either a Macromolecule with information retrieved from the www.rcsb.org database, or a ChemicalMolecule with information retrieved from the www.ebi.ac.uk/chembl database.

class molviewer.molecules.ChemicalMolecule(chemblid)

Bases: Molecule

A small chemical molecule from the ChemBL database (searchable at www.ebi.ac.uk/chembl)

chemblid: str
conformer: Mol
mol_data: QuerySet
save(file_path)

Save the ChemicalMolecule 3D structure using the .sdf file format.

Parameters

file_path (Union[str, Path]) – The path to be used when saving the file.

Raise

FileNotFoundError or OSError if the specified file path does not exist

Return type

Path

Returns

The path to the saved file.

class molviewer.molecules.Macromolecule(pdbid)

Bases: Molecule

A macromolecule obtained from the WorldWide Protein Data Bank ( searchable at www.rcsb.org).

PDB_FILE_URL: ClassVar[str] = 'https://files.rcsb.org/download/'
pdbid: str
save(file_path)

Save the Macromolecule using the .pdb file format.

Parameters

file_path (Union[str, Path]) – The path to be used when saving the file.

Return type

Path

Returns

The path to the saved file

Raise

FileNotFoundError or OSError if the specified file path does not exist.

class molviewer.molecules.Molecule

Bases: object

The base class for molecules.

show(existing_viewer=None)

Display the molecule’s 3D structure inside a nglview.NGLWidget viewer in a Jupyter notebook. If no viewer currently exists, a new one is created and the 3D molecular structure is displayed. If a viewer does currently exist then the 3D molecule structure is added to the existing viewer.

Parameters

existing_viewer (Optional[NGLWidget]) – a 3D molecule model viewer, defaults to None.

Return type

NGLWidget

Returns

An nglview.NGLWidget viewer.

structure: Optional[Structure] = None