{ "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) >
"
]
},
{
"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": 1,
"metadata": {
"collapsed": true
},
"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": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"PyRosetta-4 2019 [Rosetta PyRosetta4.Release.python36.mac 2019.31+release.9a323bc72ca18d3abdc8b1a730b37e52197e4ceb 2019-07-29T16:16:04] retrieved from: http://www.pyrosetta.org\n",
"(C) Copyright Rosetta Commons Member Institutions. Created in JHU by Sergey Lyskov and PyRosetta Team.\n",
"init complete\n"
]
}
],
"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": 5,
"metadata": {
"nbgrader": {
"grade": true,
"grade_id": "cell-c34d0bd1a81b4a7d",
"locked": false,
"points": 0,
"schema_version": 3,
"solution": true
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"setup complete\n"
]
}
],
"source": [
"pose = pose_from_pdb(\"inputs/hbnet_example.pdb\")\n",
"start_pose = Pose()\n",
"start_pose.assign(pose)\n",
"scorefxn = get_fa_scorefxn()\n",
"print( \"setup complete\" )"
]
},
{
"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": 6,
"metadata": {
"nbgrader": {
"grade": true,
"grade_id": "cell-1754b479780ad2e4",
"locked": false,
"points": 0,
"schema_version": 3,
"solution": true
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Num residues: 454\n",
"Num packable residues: 116\n",
"Num designable residues: 53\n"
]
}
],
"source": [
"from pyrosetta.rosetta.core.select.residue_selector import InterGroupInterfaceByVectorSelector, ChainSelector, NotResidueSelector\n",
"\n",
"chain1 = ChainSelector( \"1\" ) #selects the first chain\n",
"chain2 = ChainSelector( \"2\" ) #selects the second chain\n",
"\n",
"interface_selector = InterGroupInterfaceByVectorSelector( chain1, chain2 );#selects residues at the interface\n",
"not_interface_selector = NotResidueSelector( interface_selector ); #selects residues not at the interface\n",
"\n",
"from pyrosetta.rosetta.core.pack.task.operation import PreventRepackingRLT, RestrictToRepackingRLT, OperateOnResidueSubset\n",
"\n",
"#prevent non interface residues from repacking/designing\n",
"fix_non_interface = OperateOnResidueSubset( PreventRepackingRLT(), not_interface_selector )\n",
"\n",
"#perhaps we are performing one-sided design and do not want to make mutations on chain 2:\n",
"no_mutation_chain2 = OperateOnResidueSubset( RestrictToRepackingRLT(), chain2 )\n",
"\n",
"from pyrosetta.rosetta.core.pack.task import TaskFactory\n",
"task_factory = TaskFactory()\n",
"task_factory.push_back( fix_non_interface )\n",
"task_factory.push_back( no_mutation_chain2 )\n",
"\n",
"task_design = task_factory.create_task_and_apply_taskoperations( pose )\n",
"print( \"Num residues: \", pose.size() )\n",
"print( \"Num packable residues: \", task_design.num_to_be_packed() ) # this includes the ones being designed\n",
"\n",
"num_designable = 0\n",
"for i in range( 1, pose.size() + 1 ):\n",
" if( task_design.design_residue( i ) ):\n",
" num_designable += 1;\n",
"print( \"Num designable residues: \", num_designable )"
]
},
{
"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": 7,
"metadata": {
"nbgrader": {
"grade": true,
"grade_id": "cell-9e50dd452de9681a",
"locked": false,
"points": 0,
"schema_version": 3,
"solution": true
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: \u001b[0mGenerating XML Schema for rosetta_scripts...\n",
"\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: \u001b[0m...done\n",
"\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: \u001b[0mInitializing schema validator...\n",
"\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: \u001b[0m...done\n",
"\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: \u001b[0mValidating input script...\n",
"\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: \u001b[0m...done\n",
"\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: \u001b[0mParsed script:\n",
" "
]
}
],
"metadata": {
"celltoolbar": "Create Assignment",
"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
}