{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Before you turn this problem in, make sure everything runs as expected. First, **restart the kernel** (in the menubar, select Kernel$\\rightarrow$Restart) and then **run all cells** (in the menubar, select Cell$\\rightarrow$Run All).\n", "\n", "Make sure you fill in any place that says `YOUR CODE HERE` or \"YOUR ANSWER HERE\", as well as your name and collaborators below:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "NAME = \"\"\n", "COLLABORATORS = \"\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "*This notebook contains material from [PyRosetta](https://RosettaCommons.github.io/PyRosetta.notebooks);\n", "content is available [on Github](https://github.com/RosettaCommons/PyRosetta.notebooks.git).*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Practice: Analyzing energy between residues](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/03.02-Analyzing-energy-between-residues.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Introduction to Folding](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/04.00-Introduction-to-Folding.ipynb) >
"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": false,
"editable": false,
"nbgrader": {
"checksum": "d6e44e83cb1e101a773ee3b27a09c602",
"grade": false,
"grade_id": "cell-c32668370dae07d5",
"locked": true,
"schema_version": 1,
"solution": false
}
},
"source": [
"# Energies and the PyMOL Mover\n",
"Keywords: send_energy(), label_energy(), send_hbonds()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Notebook setup\n",
"import sys\n",
"if 'google.colab' in sys.modules:\n",
" !pip install pyrosettacolabsetup\n",
" import pyrosettacolabsetup\n",
" pyrosettacolabsetup.setup()\n",
" print (\"Notebook is set for PyRosetta use in Colab. Have fun!\")\n",
"\n",
"from pyrosetta import *\n",
"from pyrosetta.teaching import *\n",
"init()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Make sure you are in the directory with the pdb files:**\n",
"\n",
"`cd google_drive/My\\ Drive/student-notebooks/`"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# From previous section:\n",
"ras = pyrosetta.pose_from_pdb(\"inputs/6Q21_A.pdb\")\n",
"sfxn = get_fa_scorefxn()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The `PyMOLMover` class contains a method for sending score function information to PyMOL,\n",
"which will then color the structure based on relative residue energies.\n",
"\n",
"Open up PyMOL. Instantiate a `PyMOLMover` object and use the `pymol_mover.send_energy(ras)` to send the coloring command to PyMOL.\n",
"\n",
"```\n",
"pymol_mover = PyMOLMover()\n",
"pymol_mover.apply(ras)\n",
"print(sfxn(ras))\n",
"pymol_mover.send_energy(ras)\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"nbgrader": {
"checksum": "834f8d41b3b3c87a6bc4795697ffcfd9",
"grade": true,
"grade_id": "cell-6b50c733700571cc",
"locked": false,
"points": 0,
"schema_version": 1,
"solution": true
}
},
"outputs": [],
"source": [
"# YOUR CODE HERE\n",
"raise NotImplementedError()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IPython.core.interactiveshell import InteractiveShell\n",
"InteractiveShell.ast_node_interactivity = \"all\"\n",
"from IPython import display"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"gifPath = Path(\"./Media/PyMOL-send_energy.gif\")\n",
"# Display GIF in Jupyter, CoLab, IPython\n",
"with open(gifPath,'rb') as f:\n",
" display.Image(data=f.read(), format='png',width='800')"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": false,
"editable": false,
"nbgrader": {
"checksum": "6e5103476c776a1a5b9681b87d6709b8",
"grade": false,
"grade_id": "cell-bac636a945b1ef80",
"locked": true,
"schema_version": 1,
"solution": false
}
},
"source": [
"What color is residue Proline34? What color is residue Alanine66? Which residue has lower energy?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"editable": false,
"nbgrader": {
"checksum": "1d6e99f8c25d8dde4fc00d1d6d7dc57a",
"grade": false,
"grade_id": "cell-6e7eccd7e775c0a5",
"locked": true,
"schema_version": 1,
"solution": false
}
},
"outputs": [],
"source": [
"# your response here"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": false,
"editable": false,
"nbgrader": {
"checksum": "3165ed03b60ac9f69f11f678527fffdb",
"grade": false,
"grade_id": "cell-21e2444f382f080a",
"locked": true,
"schema_version": 1,
"solution": false
}
},
"source": [
"`pymol_mover.send_energy(ras, fa_atr)` will have PyMOL color only by the attractive van der Waals energy component. What color is residue 34 if colored by solvation energy, `fa_sol`?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"editable": false,
"nbgrader": {
"checksum": "5f824081125bd901461d464e1700f9ca",
"grade": false,
"grade_id": "cell-9103a75de706b1d0",
"locked": true,
"schema_version": 1,
"solution": false
}
},
"outputs": [],
"source": [
"# send specific energies to pymol"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"nbgrader": {
"checksum": "b626e9a77f2c1329d1a045d4319921db",
"grade": true,
"grade_id": "cell-f9000db7d0cfabd1",
"locked": false,
"points": 0,
"schema_version": 1,
"solution": true
}
},
"outputs": [],
"source": [
"# YOUR CODE HERE\n",
"raise NotImplementedError()"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": false,
"editable": false,
"nbgrader": {
"checksum": "47d68c9ce2acdbec24a4607f8cb49792",
"grade": false,
"grade_id": "cell-24a17254b7d885c8",
"locked": true,
"schema_version": 1,
"solution": false
}
},
"source": [
"You can have PyMOL label each Cα with the value of its residue’s specified energy using:\n",
"```\n",
"pymol_mover.label_energy(ras, \"fa_atr\")\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"nbgrader": {
"checksum": "8a5b0466487ed132c5ec7d034404c24a",
"grade": true,
"grade_id": "cell-2ba49a6550dab5c7",
"locked": false,
"points": 0,
"schema_version": 1,
"solution": true
}
},
"outputs": [],
"source": [
"# YOUR CODE HERE\n",
"raise NotImplementedError()"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": false,
"editable": false,
"nbgrader": {
"checksum": "017aa335b84dd9da443af3367d577b6b",
"grade": false,
"grade_id": "cell-7fdeb8b695d89a68",
"locked": true,
"schema_version": 1,
"solution": false
}
},
"source": [
"Finally, if you have scored the `pose` first, you can have PyMOL display all of the calculated hydrogen bonds for the structure:\n",
"\n",
"```\n",
"pymol_mover.send_hbonds(ras)\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"nbgrader": {
"checksum": "fa5e2b543ba46881f27771087b748a4c",
"grade": true,
"grade_id": "cell-e881648552ab8641",
"locked": false,
"points": 0,
"schema_version": 1,
"solution": true
}
},
"outputs": [],
"source": [
"# YOUR CODE HERE\n",
"raise NotImplementedError()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## References\n",
"This Jupyter notebook is an adapted version of \"Workshop #3: Scoring\" in the PyRosetta workbook: https://graylab.jhu.edu/pyrosetta/downloads/documentation/pyrosetta4_online_format/PyRosetta4_Workshop3_Scoring.pdf"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"< [Practice: Analyzing energy between residues](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/03.02-Analyzing-energy-between-residues.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Introduction to Folding](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/04.00-Introduction-to-Folding.ipynb) >
"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}