{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Calculating the solvent density around a protein\n", "\n", " Here we use `density.DensityAnalysis` to analyse the solvent density around an enzyme.\n", "\n", "**Last updated:** December 2022 with MDAnalysis 2.4.0-dev0\n", "\n", "**Minimum version of MDAnalysis:** 1.0.0\n", "\n", "**Packages required:**\n", " \n", "* MDAnalysis (Michaud-Agrawal *et al.*, 2011, Gowers *et al.*, 2016)\n", "* MDAnalysisTests\n", "\n", "**Optional packages for visualisation:**\n", "\n", "* nglview\n", "* matplotlib\n", "* scikit-image\n", "* pyvista\n", "* ipygany\n", "\n", "Throughout this tutorial we will include cells for visualising Universes with the [NGLView](http://nglviewer.org/nglview/latest/api.html) library. However, these will be commented out, and we will show the expected images generated instead of the interactive widgets." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2023-06-09T12:30:56.671792744Z", "start_time": "2023-06-09T12:30:55.843321182Z" } }, "outputs": [], "source": [ "import MDAnalysis as mda\n", "from MDAnalysis.tests.datafiles import TPR, XTC\n", "from MDAnalysis.analysis import density\n", "\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "# import nglview as nv\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Loading files" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The test files we will be working with here feature adenylate kinase (AdK), a phosophotransferase enzyme. (Beckstein *et al.*, 2009). It is solvated in TIP4P water and broken across periodic boundaries." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2023-06-09T12:31:03.941347994Z", "start_time": "2023-06-09T12:30:56.675317606Z" } }, "outputs": [], "source": [ "u = mda.Universe(TPR, XTC)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# view1 = nv.show_mdanalysis(u)\n", "# view1.add_representation(\n", "# 'licorice', \n", "# selection='resname SOL',\n", "# )\n", "# view1" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# from nglview.contrib.movie import MovieMaker\n", "# movie = MovieMaker(\n", "# view1,\n", "# step=4, # keep every 4th step\n", "# render_params={\"factor\": 3}, # average quality render\n", "# output='density_analysis_images/density_analysis-view1.gif',\n", "# )\n", "# movie.make()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "