{ "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 with a Resfile and FastRelax](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/06.03-Design-with-a-resfile-and-relax.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [HBNet Before Design](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/06.05-HBNet-Before-Design.ipynb) >

\"Open" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Protein Design 2\n", "\n", "Keywords: FastDesign, FastRelax, ResidueSelector, TaskFactory, TaskOperation, pose_from_rcsb, get_residues_from_subset, ResidueNameSelector, ChainSelector, ResiduePropertySelector, NotResidueSelector, AndResidueSelector, RestrictToRepackingRLT, RestrictAbsentCanonicalAASRLT, NoRepackDisulfides, OperateOnResidueSubset\n", "\n", "## Overview\n", "\n", "Here, we will expand upon our knowledge of ResidueSelectors and TaskOperations and how to use them. We can once again use FastRelax or FastDesign to do design. Since we don't need any additional tools offered by FastDesign, we will use FastRelax. I like to call it RelaxedDesign. :)" ] }, { "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": [ "!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": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import logging\n", "logging.basicConfig(level=logging.INFO)\n", "import os\n", "import pyrosetta\n", "import pyrosetta.toolbox\n", "import site\n", "\n", "from IPython.core.display import display, HTML\n", "display(HTML(\"\"))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Initialize PyRosetta " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:pyrosetta.rosetta:Found rosetta database at: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyrosetta-2019.33+release.1e60c63beb5-py3.6-macosx-10.6-intel.egg/pyrosetta/database; using it....\n", "INFO:pyrosetta.rosetta:PyRosetta-4 2019 [Rosetta PyRosetta4.Release.python36.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.python36.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 -database /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyrosetta-2019.33+release.1e60c63beb5-py3.6-macosx-10.6-intel.egg/pyrosetta/database\n", "INFO:rosetta:\u001b[0mbasic.random.init_random_generator: \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=955310447 seed_offset=0 real_seed=955310447\n", "INFO:rosetta:\u001b[0mbasic.random.init_random_generator: \u001b[0mRandomGenerator:init: Normal mode, seed=955310447 RG_type=mt19937\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "PyRosetta-4 2019 [Rosetta PyRosetta4.Release.python36.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\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " For this tutorial, let's again use the native protein crambin from PDB ID 1AB1 (http://www.rcsb.org/structure/1AB1)\n", " Setup the input pose and scorefunction:" ] }, { "cell_type": "code", "execution_count": 3, "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.949456 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.conformation.Conformation: \u001b[0mFound disulfide between residues 3 40\n", "INFO:rosetta:\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 3 CYS\n", "INFO:rosetta:\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 40 CYS\n", "INFO:rosetta:\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 3 CYD\n", "INFO:rosetta:\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 40 CYD\n", "INFO:rosetta:\u001b[0mcore.conformation.Conformation: \u001b[0mFound disulfide between residues 4 32\n", "INFO:rosetta:\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 4 CYS\n", "INFO:rosetta:\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 32 CYS\n", "INFO:rosetta:\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 4 CYD\n", "INFO:rosetta:\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 32 CYD\n", "INFO:rosetta:\u001b[0mcore.conformation.Conformation: \u001b[0mFound disulfide between residues 16 26\n", "INFO:rosetta:\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 16 CYS\n", "INFO:rosetta:\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 26 CYS\n", "INFO:rosetta:\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 16 CYD\n", "INFO:rosetta:\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 26 CYD\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": [ " To list the cysteine residues in crambin, now we use ResidueSelectors:\n", " Note difference in residue names \"CYS:disulfide\" vs. \"CYS\"\n", " \n", " Note that we could also use the `ResiduePropertySelector` and use the `DISULFIDE_BONDED` property to grab these." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "vector1_unsigned_long[3, 4, 16, 26, 32, 40]\n" ] } ], "source": [ "disulfide_res = pyrosetta.rosetta.core.select.residue_selector.ResidueNameSelector(\"CYS:disulfide\")\n", "print(pyrosetta.rosetta.core.select.get_residues_from_subset(disulfide_res.apply(pose)))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Inspect the starting pose using the `PyMolMover` or `dump_pdb()`. By default, disulfide bonds are not drawn even if they exist in PyRosetta:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " You can also use this shortcut to view a pose in `py3Dmol` which recognizes disulfide bonds in PyRosetta:\n", " \n", "Run one of the following, whether you git cloned the pyrosetta_scripts repository or downloaded visualization.py from the Google Drive\n", "\n", "`%run ~/pyrosetta_scripts/pilot/apps/klimaj/py3Dmol/visualization.py`\n", "`%run ./visualization.py`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Design strategy\n", "\n", "Design away the cysteine residues (i.e. disulfide bonds) using ResidueSelectors and TaskOperations, allowing all side-chains to re-pack and all backbone and side-chain torsions to minimize using the `FastDesign` mover." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Note: because we did not include the `-detect_disulfide 0` command line flag in `pyrosetta.init()`, in order to mutate disulfide bonded cysteine residues using packing steps in the `FastDesign` mover, first we need to break the disulfide bonds:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "for i in pyrosetta.rosetta.core.select.get_residues_from_subset(disulfide_res.apply(pose)):\n", " for j in pyrosetta.rosetta.core.select.get_residues_from_subset(disulfide_res.apply(pose)):\n", " if pyrosetta.rosetta.core.conformation.is_disulfide_bond(pose.conformation(), i, j):\n", " pyrosetta.rosetta.core.conformation.break_disulfide(pose.conformation(), i, j)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Now we can declare a `ResidueSelector` for cysteine residues:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "vector1_unsigned_long[3, 4, 16, 26, 32, 40]\n" ] } ], "source": [ "cys_res = pyrosetta.rosetta.core.select.residue_selector.ResidueNameSelector(\"CYS\")\n", "print(pyrosetta.rosetta.core.select.get_residues_from_subset(cys_res.apply(pose)))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Note: the pose consists of only chain \"A\"" ] }, { "cell_type": "code", "execution_count": 7, "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": [ " Although the pose contains only chain A, if the pose contained other chains we could make the selection to only select chain A and cysteine residues using an `AndResidueSelector`. We will use this ResidueSelector with `RestrictAbsentCanonicalAASRLT` (restrict absent canonical amino acids residue level task operation)." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "vector1_unsigned_long[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46]\n", "vector1_unsigned_long[3, 4, 16, 26, 32, 40]\n" ] } ], "source": [ "chain_A = pyrosetta.rosetta.core.select.residue_selector.ChainSelector(\"A\")\n", "print(pyrosetta.rosetta.core.select.get_residues_from_subset(chain_A.apply(pose)))\n", "chain_A_cys_res = pyrosetta.rosetta.core.select.residue_selector.AndResidueSelector(selector1=cys_res, selector2=chain_A)\n", "print(pyrosetta.rosetta.core.select.get_residues_from_subset(chain_A_cys_res.apply(pose)))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Specify a `NotResidueSelector` selecting everything except the `chain_A_cys_res` ResidueSelector to use with a `RestrictToRepackingRLT` (restrict to repacking residue level task operation):" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "vector1_unsigned_long[1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46]\n" ] } ], "source": [ "not_chain_A_cys_res = pyrosetta.rosetta.core.select.residue_selector.NotResidueSelector(chain_A_cys_res)\n", "print(pyrosetta.rosetta.core.select.get_residues_from_subset(not_chain_A_cys_res.apply(pose)))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Quickly view the `not_chain_A_cys_res` ResidueSelector:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Now we can set up the TaskOperations for `FastDesign`:" ] }, { "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", "\n", "# Disable design (i.e. repack only) on not_chain_A_cys_res\n", "tf.push_back(pyrosetta.rosetta.core.pack.task.operation.OperateOnResidueSubset(\n", " pyrosetta.rosetta.core.pack.task.operation.RestrictToRepackingRLT(), not_chain_A_cys_res))\n", "\n", "# Enable design on chain_A_cys_res\n", "aa_to_design = pyrosetta.rosetta.core.pack.task.operation.RestrictAbsentCanonicalAASRLT()\n", "aa_to_design.aas_to_keep(\"ADEFGHIKLMNPQRSTVWY\")\n", "tf.push_back(pyrosetta.rosetta.core.pack.task.operation.OperateOnResidueSubset(\n", " aa_to_design, chain_A_cys_res))\n", "\n", "# Convert the task factory into a PackerTask\n", "packer_task = tf.create_task_and_apply_taskoperations(pose)\n", "# View the PackerTask\n", "print(packer_task)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " This time we will set up a `MoveMap` to establish which torsions are free to minimize" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "mm = pyrosetta.rosetta.core.kinematics.MoveMap()\n", "mm.set_bb(True)\n", "mm.set_chi(True)\n", "mm.set_jump(True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Set up `FastDesign`" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscore12 : 11.2084\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mtalaris2013 : 4.35493\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mtalaris2014 : 4.28436\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mref2015 : 1.8125\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mbeta_nov16 : 9.87535\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mLooking for MonomerDesign2019.ref2015.txt\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0m================== Reading script file: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyrosetta-2019.33+release.1e60c63beb5-py3.6-macosx-10.6-intel.egg/pyrosetta/database/sampling/relax_scripts/MonomerDesign2019.ref2015.txt ==================\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mrepeat %%nrepeats%%\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mreference -0.511909 2.0282 -3.29233 -3.74112 2.5917 -1.12843 -1.33724 3.25715 -1.56117 2.65488 2.88076 -2.80685 -1.5498 -2.69754 -1.62133 -1.86628 -0.0648395 2.6561 4.7344 1.37564\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mcoord_cst_weight 1.0\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscale:fa_rep 0.059\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mrepack\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscale:fa_rep 0.092\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mmin 0.01\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mreference 0.335091 2.4652 -2.85533 -3.29412 1.6487 -1.27143 -1.07024 2.80415 -1.20417 2.08188 2.06776 -2.26985 -1.5128 -2.21054 -1.15433 -1.25928 0.392161 2.6131 2.9414 0.752641\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mcoord_cst_weight 0.5\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscale:fa_rep 0.280\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mrepack\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscale:fa_rep 0.323\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mmin 0.01\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mreference 0.742591 2.7127 -2.62783 -3.12662 1.1962 -0.823929 -0.992739 2.55165 -1.09667 1.83938 1.72526 -2.04235 -1.6253 -2.10304 -1.06683 -0.951779 0.589661 2.6206 2.0389 0.440141\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mcoord_cst_weight 0.0\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscale:fa_rep 0.568\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mrepack\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscale:fa_rep 0.633\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mmin 0.01\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mreference 1.32468 3.25479 -2.14574 -2.72453 1.21829 0.79816 -0.30065 2.30374 -0.71458 1.66147 1.65735 -1.34026 -1.64321 -1.45095 -0.09474 -0.28969 1.15175 2.64269 2.26099 0.58223\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mcoord_cst_weight 0.0\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscale:fa_rep 1\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mrepack\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mmin 0.00001\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0maccept_to_best\n", "INFO:rosetta:\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mendrepeat\n" ] } ], "source": [ "rel_design = pyrosetta.rosetta.protocols.relax.FastRelax(scorefxn_in=scorefxn, standard_repeats=1, script_file=\"MonomerDesign2019\")\n", "rel_design.cartesian(True)\n", "rel_design.set_task_factory(tf)\n", "rel_design.set_movemap(mm)\n", "rel_design.minimize_bond_angles(True)\n", "rel_design.minimize_bond_lengths(True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Run the `FastDesign` mover. Note: this takes ~39.6 s" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "nbgrader": { "grade": true, "grade_id": "cell-0276fa644308dd5b", "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: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyrosetta-2019.33+release.1e60c63beb5-py3.6-macosx-10.6-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 '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyrosetta-2019.33+release.1e60c63beb5-py3.6-macosx-10.6-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.25445 seconds to load from binary\n", "INFO:rosetta:\u001b[0mprotocols::checkpoint: \u001b[0mDeleting checkpoints of FastRelax\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 150 ms, sys: 132 ms, total: 282 ms\n", "Wall time: 307 ms\n" ] } ], "source": [ "### BEGIN SOLUTION\n", "%time rel_design.apply(pose)\n", "### END SOLUTION" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Inspect the resulting design!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## *Design Challenge*:\n", "\n", "### Copy and modify this script to:\n", " - Repack all residues and allow all degrees of freedom to minimize (i.e. FastRelax) `start_pose` prior to downstream design. Use the resulting `start_pose` for analysis.\n", " - Re-design the cysteine residues in `start_pose` to allow only hydrophobic residues excluding glycine and proline\n", " - Only re-pack residues within a 6 Angstroms radius around the neighborhood of each cysteine residue (Cα-Cα distance)\n", " - Note this will require using:\n", " - The NeighborhoodResidueSelector: `pyrosetta.rosetta.core.select.residue_selector.NeighborhoodResidueSelector(selector, distance, include_focus_in_subset)`\n", " - The prevent repacking residue level task operation: `pyrosetta.rosetta.core.pack.task.operation.PreventRepackingRLT()`\n", " - Minimize only the side-chains (chi degrees of freedom) being re-packed or designed\n", " - Allow the backbone torsions to minimize, except for the first, last and any proline phi/psi angles\n", " \n", "## *Extra Challenge!*\n", "\n", " Instead of using `pyrosetta.rosetta.core.pack.task.operation.OperateOnResidueSubset` TaskOperations, use `pyrosetta.rosetta.protocols.task_operations.ResfileCommandOperation` TaskOperations by applying resfile-style commands to ResidueSelectors. Example:\n", " > repack_only_task_operation = pyrosetta.rosetta.protocols.task_operations.ResfileCommandOperation() \n", " > repack_only_task_operation.set_command(\"POLAR EMPTY NC R2 NC T6 NC OP5\") \n", " > repack_only_task_operation.set_residue_selector(selector) \n", " > tf.push_back(repack_only_task_operation)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " By how many Angstroms RMSD did the backbone Cα atoms move?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ " What is the delta `total_score` from `start_pose` to `pose`?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "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": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Protein Design with a Resfile and FastRelax](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/06.03-Design-with-a-resfile-and-relax.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [HBNet Before Design](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/06.05-HBNet-Before-Design.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.1" }, "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 }