{ "cells": [ { "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", "< [Protein Design 2](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/06.04-Protein-Design-2.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [*De Novo* Parametric Backbone Design](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/06.06-Introduction-to-Parametric-backbone-design.ipynb) >

\"Open" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# HBNet Before Design\n", "\n", "Keywords: HBNet, OperateOnResidueSubset, getPoseExtraScore, InterGroupInterfaceByVectorSelector, ChainSelector, PreventRepackingRLT, RestrictToRepackingRLT, OperateOnResidueSubset, ResiduePDBInfoHasLabelSelector, PackRotamersMover" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Sometimes in Rosetta we want to run implicit multistage design. That is, we want to optimize one conformation while implicitly modeling another (either negatively or positively). There are many ways to accomplish this depending on your interests. In this section we will look at HBNet, a tool for explicitly designing hydrogen bond networks.\n", "\n", "One negative-design approach is to implicitly model binding specificity. Designing a complicated network of hydrogen bonds at one interface will implicitly destabilize other interfaces. Hydrogen bonds are so sensitive to geometry that competing interfaces are unlikely to be able to \"satisfy\" the network well enough to remain competetive.\n", "\n", "The previous example can also be viewed through the implicit positive-design lens as well. We often find that Rosetta designs very hydrophobic interfaces (especially with newer score functions). Running HBNet before the traditional design protocols can boost the polar residue concentration of your interface in exchange for a small cost packing quality. In other words, we can implicitly stabilize the unbound state by running HBNet, but it might mildly destabilize the bound state.\n", "\n", "Our experience shows that it is useful to run both with and without HBNet, depending on your design case. It is possible that the default design protocol handles your implicits states well enough. When that fails, though, there is not much to do to fix it other than to run pre-design protocols like HBNet. An added benefit of HBNet is that it can provide \"seeds\" for packing, which can influence design diversity if nothing else." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "!pip install pyrosettacolabsetup\n", "import pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()\n", "import pyrosetta; pyrosetta.init()\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Make sure you are in the directory with the pdb files:**\n", "\n", "`cd google_drive/MyDrive/student-notebooks/`" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# From previous section:\n", "from pyrosetta import *\n", "from pyrosetta.teaching import *\n", "pyrosetta.init(\"-mute core -mute basic\")\n", "print( \"init complete\" )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We prepare for HBNet the same way that we prepare for packing. We setup the pose and score function as before..." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "deletable": false, "nbgrader": { "cell_type": "code", "checksum": "f43b5f517cb3e471f264ccfdc5136143", "grade": true, "grade_id": "cell-c34d0bd1a81b4a7d", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [], "source": [ "YOUR-CODE-HERE" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Just like before, you can edit the resfile to your own personal specifications. Alternatively, you can use task operations to automate the process. Let's use task operations to fix all residues not at the interface." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setting Designable Residues:\n", "\n", "Create a new task for design\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "deletable": false, "nbgrader": { "cell_type": "code", "checksum": "891aceaf31664afc0efb4bdd02ff3bab", "grade": true, "grade_id": "cell-1754b479780ad2e4", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [], "source": [ "YOUR-CODE-HERE" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Running HBNet\n", "\n", "This is an interface case so we will use HBNetStapleInterface. We will use both the code-level interface, and the XML interface as an introduction to this functionality. The XML interface to PyRosetta will be covered more in later workshops. " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "deletable": false, "nbgrader": { "cell_type": "code", "checksum": "695ad8ea1375767eb86237260d45849f", "grade": true, "grade_id": "cell-9e50dd452de9681a", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [], "source": [ "YOUR-CODE-HERE" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Wait, my score is terrible.\n", "\n", "__Question:__ Why?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Finishing Design:\n", "\n", "Well of course the score is terrible, the pose is dense with clashes. We had 116 packable residues and only assigned states to 5 of them. The other 111 residues are still in their input conformations and likely clash with the 5 we just assigned." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We need to run the packer (either using PackRotamersMover or FastDesign) but we don't want to overwrite the residues we just assigned with HBNet. The trick here is to select the residues with \"HBNet\" labels and fix them." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "deletable": false, "nbgrader": { "cell_type": "code", "checksum": "7a445c74ba44503a6b0ff579e8b50ca5", "grade": true, "grade_id": "cell-ecdd3a3881511698", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [], "source": [ "YOUR-CODE-HERE" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## We made it...?\n", "\n", "The change in score is a better, but still positive. One great thing about HBNet is that it can return multiple poses. Each one is slightly worse than the previous by HBNet's standards but might design into something better. Let's try a few to see if they help." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#there were 10 (or so) networks total, but let's just try the next 5\n", "#this might take a few minutes...\n", "if not os.getenv('DEBUG'): #Adding this line to decrease runtime on the testing server\n", " for x in range(0,5):\n", " extra_pose = hbnet.get_additional_output()\n", " if extra_pose is None:\n", " break\n", " task_design3 = task_factory.create_task_and_apply_taskoperations( extra_pose )\n", " task_design3.or_linmem_ig( True )\n", " pack_mover = PackRotamersMover( scorefxn, task_design3 )\n", " pack_mover.apply( extra_pose )\n", " print( \"Change in score\", scorefxn(extra_pose) - scorefxn(start_pose) )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## But wait, there's more??\n", "\n", "Great! We found a few results that designed to me more stable than the input pose (-60, -45, and -31 REU)!\n", "\n", "The main score function is not the only way to evaluate these networks. HBNet also adds its own score terms. These are useful for sorting/filtering decoys before running expensive packing calculations." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pyrosetta.rosetta.core.pose import hasPoseExtraScore, getPoseExtraScore\n", "\n", "if hasPoseExtraScore( pose, \"HBNet_NumUnsatHpol\" ):\n", " #All 3 of these metrics are explained in more detail in Maguire, Boyken, et al. (see second reference below)\n", "\n", " #NumUnsatHpol is HBNet's primary sorting metric, it counts the number of polar hydrogen atoms that are unsatisfied (buried and not forming hbonds). We know that there are no heavy (non-hydrogen) unsatisfied atoms because HBNet filters those out by default. Lower is better\n", " print( \"HBNet_NumUnsatHpol\", getPoseExtraScore( pose, \"HBNet_NumUnsatHpol\" ) )\n", "\n", " #HBNet's secondary sorting metric. 1.0 if every polar atom in the network is forming the maximum number of hbonds. Higher is better\n", " print( \"HBNet_Saturation\", getPoseExtraScore( pose, \"HBNet_Saturation\" ) )\n", "\n", " #HBNet's tertiary sorting metric. A little complicated but lower is better.\n", " print( \"HBNet_Score\", getPoseExtraScore( pose, \"HBNet_Score\" ) )\n", "else:\n", " print( \"Somebody go bug a developer to enable this feature for PyRosetta\" )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Advice for using this in the wild\n", "\n", "#### ex1 ex2\n", "\n", "HBonds are very sensitive to sidechain sampling resolution. I highly recommend using -ex1 and -ex2. You can do this by adding:\n", "```py\n", "ex1ex2 = ExtraRotamersGeneric()\n", "ex1ex2.ex1( True )\n", "ex1ex2.ex2( True )\n", "task_factory.push_back( ex1ex2 )\n", "```\n", "\n", "#### get_additional_output\n", "\n", "As we saw in the exercise, the first result out of HBNet does not always wind up being the best. Try designing with a few results from `hbnet.get_additional_output()` to get more coverage of the design space. For the commandline users reading this, this functionality can also be accessed via `multistage_rosetta_scripts` or the `MultiplePoseMover` in `rosetta_scripts`. See the `rosetta_scripts_scripts` repository for examples.\n", "\n", "#### set_monte_carlo_seed_must_be_buried\n", "\n", "I highly recommend playing with the `set_monte_carlo_seed_must_be_buried` mentioned above. Without it, HBNet tends to just design many surface networks that nobody really cares about." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Thought Question\n", "\n", "The energy of HBNet+Design is often less favorable that the energy after an equivalent design run without HBNet. Why do people still use HBNet?\n", "\n", "\n", "## References\n", "\n", "\n", "- Boyken SE, Chen Z, Groves B, et al. De novo design of protein homo-oligomers with modular hydrogen-bond network-mediated specificity. Science. 2016;352(6286):680–687. doi:10.1126/science.aad8865\n", "\n", "\n", "- Maguire JB, Boyken SE, Baker D, Kuhlman B. Rapid Sampling of Hydrogen Bond Networks for Computational Protein Design. J Chem Theory Comput. 2018;14(5):2751–2760. doi:10.1021/acs.jctc.8b00033" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Protein Design 2](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/06.04-Protein-Design-2.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [*De Novo* Parametric Backbone Design](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/06.06-Introduction-to-Parametric-backbone-design.ipynb) >

\"Open" ] } ], "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": { "height": "calc(100% - 180px)", "left": "10px", "top": "150px", "width": "284.444px" }, "toc_section_display": true, "toc_window_display": true } }, "nbformat": 4, "nbformat_minor": 2 }