{ "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", "< [Packing and Relax](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/06.02-Packing-design-and-regional-relax.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Protein Design 2](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/06.04-Protein-Design-2.ipynb) >

\"Open" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Protein Design with a Resfile and FastRelax\n", "\n", "Keywords: FastDesign, FastRelax, ResfileCommandOperation, Resfile, ResidueSelector, MoveMapFactory, TaskFactory, TaskOperation, NoRepackDisulfides, IncludeCurrent, ReadResfile, conf2pdb_chain(), pose_from_rcsb(), create_score_function(), CA_rmsd()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Overview\n", "\n", "In this Workshop, we will learn the classic way to design proteins, but in the same breath introduce the concept of design using a flexible backbone protocol. \n", "\n", "This protocol, is essentially design during FastRelax. A separate class, FastDesign, has a bit more options for design, but essentially, they are the same. \n", "\n", "Many modern designs have used this FastDesign/RelaxedDesign protocol - including many Science papers from the Baker lab and the RosettaAntibodyDesign (RAbD) protocol that we will cover in another tutorial. \n", "\n", "Before this workshop, you should read about the resfile syntax here: https://www.rosettacommons.org/docs/latest/rosetta_basics/file_types/resfiles" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*Warning*: This notebook uses `pyrosetta.distributed.viewer` code, which runs in `jupyter notebook` and might not run if you're using `jupyterlab`." ] }, { "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!\")" ] }, { "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": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import logging\n", "logging.basicConfig(level=logging.INFO)\n", "import pyrosetta\n", "import pyrosetta.toolbox\n", "\n", "from IPython.core.display import display, HTML\n", "display(HTML(\"\"))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Initialize PyRosetta" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:pyrosetta.rosetta:Found rosetta database at: /Users/jadolfbr/Library/Python/2.7/lib/python/site-packages/pyrosetta-2019.33+release.1e60c63beb5-py2.7-macosx-10.14-intel.egg/pyrosetta/database; using it....\n", "INFO:pyrosetta.rosetta:PyRosetta-4 2019 [Rosetta PyRosetta4.Release.python27.mac 2019.33+release.1e60c63beb532fd475f0f704d68d462b8af2a977 2019-08-09T15:19:57] retrieved from: http://www.pyrosetta.org\n", "(C) Copyright Rosetta Commons Member Institutions. Created in JHU by Sergey Lyskov and PyRosetta Team.\n", "INFO:rosetta:\u001b[0mcore.init: \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags\n", "INFO:rosetta:\u001b[0mcore.init: \u001b[0mReading fconfig.../Users/jadolfbr/.rosetta/flags/common\n", "INFO:rosetta:\u001b[0mcore.init: \u001b[0m\n", "INFO:rosetta:\u001b[0mcore.init: \u001b[0m\n", "INFO:rosetta:\u001b[0mcore.init: \u001b[0mRosetta version: PyRosetta4.Release.python27.mac r230 2019.33+release.1e60c63beb5 1e60c63beb532fd475f0f704d68d462b8af2a977 http://www.pyrosetta.org 2019-08-09T15:19:57\n", "INFO:rosetta:\u001b[0mcore.init: \u001b[0mcommand: PyRosetta -ignore_unrecognized_res 1 -ex1 -ex2aro -detect_disulf 0 -database /Users/jadolfbr/Library/Python/2.7/lib/python/site-packages/pyrosetta-2019.33+release.1e60c63beb5-py2.7-macosx-10.14-intel.egg/pyrosetta/database\n", "INFO:rosetta:\u001b[0mbasic.random.init_random_generator: \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=-1041050292 seed_offset=0 real_seed=-1041050292\n", "INFO:rosetta:\u001b[0mbasic.random.init_random_generator: \u001b[0mRandomGenerator:init: Normal mode, seed=-1041050292 RG_type=mt19937\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "PyRosetta-4 2019 [Rosetta PyRosetta4.Release.python27.mac 2019.33+release.1e60c63beb532fd475f0f704d68d462b8af2a977 2019-08-09T15:19:57] retrieved from: http://www.pyrosetta.org\n", "(C) Copyright Rosetta Commons Member Institutions. Created in JHU by Sergey Lyskov and PyRosetta Team.\n" ] } ], "source": [ "pyrosetta.init(\"-ignore_unrecognized_res 1 -ex1 -ex2aro -detect_disulf 0\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " For this tutorial, let's use the well-studied native protein crambin from PDB ID 1AB1 (http://www.rcsb.org/structure/1AB1).\n", " \n", " Setup the input pose and scorefunction:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:rosetta:\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mFinished initializing fa_standard residue type set. Created 980 residue types\n", "INFO:rosetta:\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mTotal time to initialize 0.915967 seconds.\n", "INFO:rosetta:\u001b[0mcore.import_pose.import_pose: \u001b[0mFile '1AB1.clean.pdb' automatically determined to be of type PDB\n", "INFO:rosetta:\u001b[0mcore.io.pdb.pdb_reader: \u001b[0mParsing 0 .pdb records with unknown format to search for Rosetta-specific comments.\n", "INFO:rosetta:\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m discarding 3 atoms at position 1 in file 1AB1.clean.pdb. Best match rsd_type: THR:NtermProteinFull\n", "INFO:rosetta:\u001b[0mcore.scoring.etable: \u001b[0mStarting energy table calculation\n", "INFO:rosetta:\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: changing atr/rep split to bottom of energy well\n", "INFO:rosetta:\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing lj etables (maxdis = 6)\n", "INFO:rosetta:\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing solvation etables (max_dis = 6)\n", "INFO:rosetta:\u001b[0mcore.scoring.etable: \u001b[0mFinished calculating energy tables.\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBPoly1D.csv\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBFadeIntervals.csv\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBEval.csv\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/DonStrength.csv\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/AccStrength.csv\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/all.ramaProb\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/prepro.ramaProb\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.all.txt\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.gly.txt\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.pro.txt\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.valile.txt\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA_n\n", "INFO:rosetta:\u001b[0mcore.scoring.P_AA: \u001b[0mshapovalov_lib::shap_p_aa_pp_smooth_level of 1( aka low_smooth ) got activated.\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/shapovalov/10deg/kappa131/a20.prop\n", "INFO:rosetta:\u001b[0mcore.scoring.CartesianBondedEnergy: \u001b[0mInitializing IdealParametersDatabase with default Ks=300 , 80 , 20 , 10 , 40\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/bondlength_bondangle/default-lengths.txt\n", "INFO:rosetta:\u001b[0mcore.scoring.CartesianBondedEnergy: \u001b[0mRead 757 bb-independent lengths.\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/bondlength_bondangle/default-angles.txt\n", "INFO:rosetta:\u001b[0mcore.scoring.CartesianBondedEnergy: \u001b[0mRead 1456 bb-independent angles.\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/bondlength_bondangle/default-torsions.txt\n", "INFO:rosetta:\u001b[0mcore.scoring.CartesianBondedEnergy: \u001b[0mRead 1 bb-independent torsions.\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/bondlength_bondangle/default-improper.txt\n", "INFO:rosetta:\u001b[0mcore.scoring.CartesianBondedEnergy: \u001b[0mRead 2216 bb-independent improper tors.\n" ] } ], "source": [ "start_pose = pyrosetta.toolbox.rcsb.pose_from_rcsb(\"1AB1\", ATOM=True, CRYS=False)\n", "pose = start_pose.clone()\n", "scorefxn = pyrosetta.create_score_function(\"ref2015_cart.wts\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Make of list of which residues are cysteine:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[3, 4, 16, 26, 32, 40]\n" ] } ], "source": [ "cys_res = []\n", "for i, aa in enumerate(start_pose.sequence(), start=1):\n", " if aa == \"C\":\n", " cys_res.append(i)\n", "print(cys_res)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Inspect `start_pose` using the `PyMolMover` or `dump_pdb()`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Design strategy:\n", "\n", "Design away the cysteine residues (i.e. disulfide bonds) using a resfile, allowing all side-chains to re-pack and all backbone and side-chain torsions to minimize using the `FastRelax` mover.\n", "\n", " Read more about resfile file structure at https://www.rosettacommons.org/docs/latest/rosetta_basics/file_types/resfiles" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To write a resfile, we need to know which chain to mutate.\n", "\n", "We can see that the pose consists of only chain \"A\" by printing the `pose.pdb_info()` object:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "PDB file name: 1AB1.clean.pdb\n", " Pose Range Chain PDB Range | #Residues #Atoms\n", "\n", "0001 -- 0046 A 0001 -- 0046 | 0046 residues; 00649 atoms\n", " TOTAL | 0046 residues; 00649 atoms\n", "\n" ] } ], "source": [ "print(pose.pdb_info())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " More programmatically, we could find which chains are in the `pose` using `pyrosetta.rosetta.core.pose.conf2pdb_chain(pose)` which returns a `pyrosetta.rosetta.std.map_unsigned_long_char` object which is iterable." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "map_unsigned_long_char{1: A}\n" ] } ], "source": [ "print(pyrosetta.rosetta.core.pose.conf2pdb_chain(pose))" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "A\n" ] } ], "source": [ "for k, v in pyrosetta.rosetta.core.pose.conf2pdb_chain(pose).items():\n", " print(v)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " So we could write a resfile to disc indicating design specifications to mutate only the cysteine residues in chain \"A\". Use the syntax described below, and save your resfile in this directory as `resfile`.\n", " \n", " https://www.rosettacommons.org/docs/latest/rosetta_basics/file_types/resfiles" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "nbgrader": { "grade": true, "grade_id": "cell-4dfc4f43e2031e10", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "NATAA\r\n", "start\r\n", "3 A ALLAAxc\r\n", "4 A ALLAAxc\r\n", "16 A ALLAAxc\r\n", "26 A ALLAAxc\r\n", "32 A ALLAAxc\r\n", "40 A ALLAAxc\r\n" ] } ], "source": [ "### BEGIN SOLUTION\n", "resfile = \"./outputs/resfile\"\n", "with open(resfile, \"w\") as f:\n", " f.write(\"NATAA\\n\")\n", " f.write(\"start\\n\")\n", " for i in cys_res:\n", " f.write(\"{0} {1} ALLAAxc\\n\".format(i, pyrosetta.rosetta.core.pose.conf2pdb_chain(pose)[1]))\n", "!cat {resfile}\n", "\n", "### END SOLUTION" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note that we don't necessarily need a resfile to use resfile commands. We can now do this in an intuitive way through code and `ResidueSelectors` using the `ResfileCommandOperation`. The main docs for the XML interface are available below, however the code-level interface is extremely similar. Use the ? to get more info on this. The operation is located in `pyrosetta.rosetta.core.pack.task.operation` as we saw this location in the previous tutorial.\n", "\n", "https://www.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/TaskOperations/taskoperations_pages/ResfileCommandOperation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Now we can setup the TaskOperations for the `FastRelax` mover. These tell `FastRelax` which residues to design or repack during the packer steps in `FastRelax`. You should be familiar with this from the previous tutorial\n", " \n", "We use the `IncludeCurrent` to include the current rotamer of from the crystal structure during packing." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:rosetta:\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line()\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "#Packer_Task\n", "\n", "resid\tpack?\tdesign?\tallowed_aas\n", "1\tTRUE\tFALSE\tTHR:NtermProteinFull\n", "2\tTRUE\tFALSE\tTHR\n", "3\tTRUE\tTRUE\tALA,ASP,GLU,PHE,GLY,HIS,HIS_D,ILE,LYS,LEU,MET,ASN,PRO,GLN,ARG,SER,THR,VAL,TRP,TYR\n", "4\tTRUE\tTRUE\tALA,ASP,GLU,PHE,GLY,HIS,HIS_D,ILE,LYS,LEU,MET,ASN,PRO,GLN,ARG,SER,THR,VAL,TRP,TYR\n", "5\tTRUE\tFALSE\tPRO\n", "6\tTRUE\tFALSE\tSER\n", "7\tTRUE\tFALSE\tILE\n", "8\tTRUE\tFALSE\tVAL\n", "9\tTRUE\tFALSE\tALA\n", "10\tTRUE\tFALSE\tARG\n", "11\tTRUE\tFALSE\tSER\n", "12\tTRUE\tFALSE\tASN\n", "13\tTRUE\tFALSE\tPHE\n", "14\tTRUE\tFALSE\tASN\n", "15\tTRUE\tFALSE\tVAL\n", "16\tTRUE\tTRUE\tALA,ASP,GLU,PHE,GLY,HIS,HIS_D,ILE,LYS,LEU,MET,ASN,PRO,GLN,ARG,SER,THR,VAL,TRP,TYR\n", "17\tTRUE\tFALSE\tARG\n", "18\tTRUE\tFALSE\tLEU\n", "19\tTRUE\tFALSE\tPRO\n", "20\tTRUE\tFALSE\tGLY\n", "21\tTRUE\tFALSE\tTHR\n", "22\tTRUE\tFALSE\tSER\n", "23\tTRUE\tFALSE\tGLU\n", "24\tTRUE\tFALSE\tALA\n", "25\tTRUE\tFALSE\tILE\n", "26\tTRUE\tTRUE\tALA,ASP,GLU,PHE,GLY,HIS,HIS_D,ILE,LYS,LEU,MET,ASN,PRO,GLN,ARG,SER,THR,VAL,TRP,TYR\n", "27\tTRUE\tFALSE\tALA\n", "28\tTRUE\tFALSE\tTHR\n", "29\tTRUE\tFALSE\tTYR\n", "30\tTRUE\tFALSE\tTHR\n", "31\tTRUE\tFALSE\tGLY\n", "32\tTRUE\tTRUE\tALA,ASP,GLU,PHE,GLY,HIS,HIS_D,ILE,LYS,LEU,MET,ASN,PRO,GLN,ARG,SER,THR,VAL,TRP,TYR\n", "33\tTRUE\tFALSE\tILE\n", "34\tTRUE\tFALSE\tILE\n", "35\tTRUE\tFALSE\tILE\n", "36\tTRUE\tFALSE\tPRO\n", "37\tTRUE\tFALSE\tGLY\n", "38\tTRUE\tFALSE\tALA\n", "39\tTRUE\tFALSE\tTHR\n", "40\tTRUE\tTRUE\tALA,ASP,GLU,PHE,GLY,HIS,HIS_D,ILE,LYS,LEU,MET,ASN,PRO,GLN,ARG,SER,THR,VAL,TRP,TYR\n", "41\tTRUE\tFALSE\tPRO\n", "42\tTRUE\tFALSE\tGLY\n", "43\tTRUE\tFALSE\tASP\n", "44\tTRUE\tFALSE\tTYR\n", "45\tTRUE\tFALSE\tALA\n", "46\tTRUE\tFALSE\tASN:CtermProteinFull\n", "\n" ] } ], "source": [ "# The task factory accepts all the task operations\n", "tf = pyrosetta.rosetta.core.pack.task.TaskFactory()\n", "\n", "# These are pretty standard\n", "tf.push_back(pyrosetta.rosetta.core.pack.task.operation.InitializeFromCommandline())\n", "tf.push_back(pyrosetta.rosetta.core.pack.task.operation.IncludeCurrent())\n", "tf.push_back(pyrosetta.rosetta.core.pack.task.operation.NoRepackDisulfides())\n", "\n", "# Include the resfile\n", "tf.push_back(pyrosetta.rosetta.core.pack.task.operation.ReadResfile(resfile))\n", "\n", "# Convert the task factory into a PackerTask to take a look at it\n", "packer_task = tf.create_task_and_apply_taskoperations(pose)\n", "# View the PackerTask\n", "print(packer_task)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " The PackerTask looks as intended! \n", "\n", " Now we can set up a `MoveMap` or a `MoveMapFactory` to specify which torsions are free to minimize during the minimization steps of the `FastDesign` mover" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "# Set up a MoveMapFactory\n", "mmf = pyrosetta.rosetta.core.select.movemap.MoveMapFactory()\n", "mmf.all_bb(setting=True)\n", "mmf.all_bondangles(setting=True)\n", "mmf.all_bondlengths(setting=True)\n", "mmf.all_chi(setting=True)\n", "mmf.all_jumps(setting=True)\n", "mmf.set_cartesian(setting=True)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "# Set up a MoveMap\n", "# mm = pyrosetta.rosetta.core.kinematics.MoveMap()\n", "# mm.set_bb(True)\n", "# mm.set_chi(True)\n", "# mm.set_jump(True)\n", "\n", "# If needed, you could turn off bb and chi torsions for individual residues like this:\n", "\n", "# vector1 of true/false for each residue in the pose\n", "# subset_to_minimize = do_something_set.apply(pose)\n", "\n", "# for i in range(1, pose.size() + 1):\n", "# if (not subset_to_minimize[i]):\n", "# mm.set_bb(i, False)\n", "# mm.set_chi(i, False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Because some Movers only take as input a `MoveMap`, for backwards-compatibility one could generate a `MoveMap` from a `MoveMapFactory` using the `MoveMapFactory` function `create_movemap_from_pose(pose)`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Now let's double-check some more `pose` information to verify that we are ready for `FastRelax`:" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:rosetta:\u001b[0mprotocols.DsspMover: \u001b[0mLEELLLHHHHHHHHHHHLLLLLHHHHHHHHLLEELLLLLLLLLLLL\n", "INFO:rosetta:\u001b[0mprotocols.fold_from_loops.DisplayPoseLabelsMover: \u001b[0mSEQUENCE TTCCPSIVARSNFNVCRLPGTSEAICATYTGCIIIPGATCPGDYAN\n", "INFO:rosetta:\u001b[0mprotocols.fold_from_loops.DisplayPoseLabelsMover: \u001b[0mSTRUCTURE LEELLLHHHHHHHHHHHLLLLLHHHHHHHHLLEELLLLLLLLLLLL\n", "INFO:rosetta:\u001b[0mprotocols.fold_from_loops.DisplayPoseLabelsMover: \u001b[0mMVMP_BB **********************************************\n", "INFO:rosetta:\u001b[0mprotocols.fold_from_loops.DisplayPoseLabelsMover: \u001b[0mMVMP_CHI **********************************************\n", "INFO:rosetta:\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line()\n", "INFO:rosetta:\u001b[0mprotocols.fold_from_loops.DisplayPoseLabelsMover: \u001b[0mDESIGN --**-----------*---------*-----*-------*------\n", "INFO:rosetta:\u001b[0mprotocols.fold_from_loops.DisplayPoseLabelsMover: \u001b[0mREPACK **********************************************\n", "INFO:rosetta:\u001b[0mprotocols.fold_from_loops.DisplayPoseLabelsMover: \u001b[0mFOLDTREE *********************************************C\n", "INFO:rosetta:\u001b[0mprotocols.fold_from_loops.DisplayPoseLabelsMover: \u001b[0m\n", "INFO:rosetta:\u001b[0mprotocols.fold_from_loops.DisplayPoseLabelsMover: \u001b[0mFOLD_TREE EDGE 1 46 -1\n", "INFO:rosetta:\u001b[0mprotocols.fold_from_loops.DisplayPoseLabelsMover: \u001b[0mT[THR:NtermProteinFull]TCCPSIVARSNFNVCRLPGTSEAICATYTGCIIIPGATCPGDYAN[ASN:CtermProteinFull]\n", "INFO:rosetta:\u001b[0mprotocols.fold_from_loops.DisplayPoseLabelsMover: \u001b[0mPDB file name: 1AB1.clean.pdb\n", "INFO:rosetta:\u001b[0mprotocols.fold_from_loops.DisplayPoseLabelsMover: \u001b[0m Pose Range Chain PDB Range | #Residues #Atoms\n", "INFO:rosetta:\u001b[0mprotocols.fold_from_loops.DisplayPoseLabelsMover: \u001b[0m0001 -- 0046 A 0001 -- 0046 | 0046 residues; 00649 atoms\n", "INFO:rosetta:\u001b[0mprotocols.fold_from_loops.DisplayPoseLabelsMover: \u001b[0m TOTAL | 0046 residues; 00649 atoms\n" ] } ], "source": [ "display_pose = pyrosetta.rosetta.protocols.fold_from_loops.movers.DisplayPoseLabelsMover()\n", "display_pose.tasks(tf)\n", "display_pose.movemap_factory(mmf)\n", "display_pose.apply(pose)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Setting up `FastRelax` prints the default `relaxscript`, showing the `ramp_repack_min` settings with the following assignments:\n", ">ramp_repack_min [scale:fa_rep] [min_tolerance] [coord_cst_weight]" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mReading relax scripts list from database.\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mLooking for default.txt\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0m================== Reading script file: /Users/jadolfbr/Library/Python/2.7/lib/python/site-packages/pyrosetta-2019.33+release.1e60c63beb5-py2.7-macosx-10.14-intel.egg/pyrosetta/database/sampling/relax_scripts/default.txt ==================\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mrepeat %%nrepeats%%\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mramp_repack_min 0.02 0.01 1.0\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mramp_repack_min 0.250 0.01 0.5\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mramp_repack_min 0.550 0.01 0.0\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mramp_repack_min 1 0.00001 0.0\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0maccept_to_best\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mendrepeat\n" ] } ], "source": [ "fr = pyrosetta.rosetta.protocols.relax.FastRelax(scorefxn_in=scorefxn, standard_repeats=1)\n", "fr.cartesian(True)\n", "fr.set_task_factory(tf)\n", "fr.set_movemap_factory(mmf)\n", "fr.min_type(\"lbfgs_armijo_nonmonotone\") # For non-Cartesian scorefunctions, use \"dfpmin_armijo_nonmonotone\"\n", "\n", "#Note that this min_type is automatically set when you set the cartesian option. \n", "# But it is good to be aware of this - as not all protocols will do this for you.\n", "\n", "#fr.set_movemap(mm) # Could have optionally specified a MoveMap instead of MoveMapFactory\n", "#fr.minimize_bond_angles(True) # If not using MoveMapFactory, could specify bond angle minimization here\n", "#fr.minimize_bond_lengths(True) # If not using MoveMapFactory, could specify bond length minimization here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For recommendations on setting `fr.min_type()` for the scorefunction being used, see: https://www.rosettacommons.org/docs/latest/rosetta_basics/structural_concepts/minimization-overview#recommendations" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Run Fast(Design)! Note: this takes ~1min 31s" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "nbgrader": { "grade": true, "grade_id": "cell-5bcc2bfb4357035d", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:rosetta:\u001b[0mcore.scoring.CartesianBondedEnergy: \u001b[0mCreating new peptide-bonded energy container (46)\n", "INFO:rosetta:\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/elec_cp_reps.dat\n", "INFO:rosetta:\u001b[0mcore.scoring.elec.util: \u001b[0mRead 40 countpair representative atoms\n", "INFO:rosetta:\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib_fixes_enable option is true.\n", "INFO:rosetta:\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib::shap_dun10_smooth_level of 1( aka lowest_smooth ) got activated.\n", "INFO:rosetta:\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mBinary rotamer library selected: /Users/jadolfbr/Library/Python/2.7/lib/python/site-packages/pyrosetta-2019.33+release.1e60c63beb5-py2.7-macosx-10.14-intel.egg/pyrosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin\n", "INFO:rosetta:\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mUsing Dunbrack library binary file '/Users/jadolfbr/Library/Python/2.7/lib/python/site-packages/pyrosetta-2019.33+release.1e60c63beb5-py2.7-macosx-10.14-intel.egg/pyrosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin'.\n", "INFO:rosetta:\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mDunbrack 2010 library took 0.250948 seconds to load from binary\n", "INFO:rosetta:\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repeat 1274.78 0 0 0.55\n", "INFO:rosetta:\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line()\n", "INFO:rosetta:\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 11740 rotamers at 46 positions.\n", "INFO:rosetta:\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating PDInteractionGraph\n", "INFO:rosetta:\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mHigh IG memory usage (>25 MB). If this becomes an issue, consider using a different interaction graph type.\n", "INFO:rosetta:\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: ramp_repack_min -205.966 0.807679 0.807679 0.011\n", "INFO:rosetta:\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line()\n", "INFO:rosetta:\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 5954 rotamers at 46 positions.\n", "INFO:rosetta:\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating PDInteractionGraph\n", "INFO:rosetta:\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mHigh IG memory usage (>25 MB). If this becomes an issue, consider using a different interaction graph type.\n", "INFO:rosetta:\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: ramp_repack_min -128.832 0.924574 0.924574 0.1375\n", "INFO:rosetta:\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line()\n", "INFO:rosetta:\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 4186 rotamers at 46 positions.\n", "INFO:rosetta:\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating PDInteractionGraph\n", "INFO:rosetta:\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mHigh IG memory usage (>25 MB). If this becomes an issue, consider using a different interaction graph type.\n", "INFO:rosetta:\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: ramp_repack_min -116.436 0.862077 0.862077 0.3025\n", "INFO:rosetta:\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line()\n", "INFO:rosetta:\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 4197 rotamers at 46 positions.\n", "INFO:rosetta:\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating PDInteractionGraph\n", "INFO:rosetta:\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mHigh IG memory usage (>25 MB). If this becomes an issue, consider using a different interaction graph type.\n", "INFO:rosetta:\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: ramp_repack_min -102.735 0.798086 0.798086 0.55\n", "INFO:rosetta:\u001b[0mprotocols.relax.FastRelax: \u001b[0mMRP: 0 -102.735 -102.735 0.798086 0.798086\n", "INFO:rosetta:\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: accept_to_best -102.735 0.798086 0.798086 0.55\n", "INFO:rosetta:\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: endrepeat -102.735 0.798086 0.798086 0.55\n", "INFO:rosetta:\u001b[0mprotocols::checkpoint: \u001b[0mDeleting checkpoints of FastRelax\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 2min 51s, sys: 1.02 s, total: 2min 52s\n", "Wall time: 2min 52s\n" ] } ], "source": [ "### BEGIN SOLUTION\n", "%time fr.apply(pose)\n", "### END SOLUTION" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Analysis\n", "\n", "Inspect the resulting design!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " By how many Angstroms RMSD did the backbone Cα atoms move?" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.798085629940033" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pyrosetta.rosetta.core.scoring.CA_rmsd(start_pose, pose)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "What is the delta `total_score` from `start_pose` to `pose`? Why is it large?" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:rosetta:\u001b[0mcore.scoring.CartesianBondedEnergy: \u001b[0mCreating new peptide-bonded energy container (46)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "-1377.51918428\n" ] } ], "source": [ "delta_total_score = scorefxn(pose) - scorefxn(start_pose)\n", "print(delta_total_score)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " What is the per-residue energy difference for each mutated position between `start_pose` and `pose`?" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "nbgrader": { "grade": true, "grade_id": "cell-32cfb702cb53c564", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The delta total_score for residue 3 between start_pose and pose is -12.881750115\n", "The delta total_score for residue 4 between start_pose and pose is -162.36925048\n", "The delta total_score for residue 16 between start_pose and pose is -34.5286984711\n", "The delta total_score for residue 26 between start_pose and pose is -7.32796169396\n", "The delta total_score for residue 32 between start_pose and pose is -6.70455775554\n", "The delta total_score for residue 40 between start_pose and pose is -7.55635449526\n" ] } ], "source": [ "### BEGIN SOLUTION\n", "\n", "for i in cys_res:\n", " pose_total_score = pyrosetta.rosetta.protocols.relax.get_per_residue_scores(pose, pyrosetta.rosetta.core.scoring.ScoreType.total_score)[i - 1]\n", " start_pose_total_score = pyrosetta.rosetta.protocols.relax.get_per_residue_scores(start_pose, pyrosetta.rosetta.core.scoring.ScoreType.total_score)[i - 1]\n", " print(\"The delta total_score for residue {} between start_pose and pose is {}\".format(i, pose_total_score - start_pose_total_score))\n", " \n", "### END SOLUTION" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Packing and Relax](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/06.02-Packing-design-and-regional-relax.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Protein Design 2](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/06.04-Protein-Design-2.ipynb) >

\"Open" ] } ], "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": {}, "toc_section_display": true, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }