{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# ResidueSelectors的API查询"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "除了上一节我们讲到的一些简单的API,这一节我们将列出所有的ResidueSelector中的**构象依赖的选择器**和**非构象依赖的选择器**的API应用方式。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "scrolled": true,
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "PyRosetta-4 2021 [Rosetta PyRosetta4.conda.mac.cxx11thread.serialization.python37.Release 2021.26+release.b308454c455dd04f6824cc8b23e54bbb9be2cdd7 2021-07-02T13:01:54] retrieved from: http://www.pyrosetta.org\n",
      "(C) Copyright Rosetta Commons Member Institutions. Created in JHU by Sergey Lyskov and PyRosetta Team.\n",
      "\u001b[0mcore.init: {0} \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags\n",
      "\u001b[0mcore.init: {0} \u001b[0mRosetta version: PyRosetta4.conda.mac.cxx11thread.serialization.python37.Release r288 2021.26+release.b308454c455 b308454c455dd04f6824cc8b23e54bbb9be2cdd7 http://www.pyrosetta.org 2021-07-02T13:01:54\n",
      "\u001b[0mcore.init: {0} \u001b[0mcommand: PyRosetta -ex1 -ex2aro -database /opt/miniconda3/lib/python3.7/site-packages/pyrosetta/database\n",
      "\u001b[0mbasic.random.init_random_generator: {0} \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=1782107690 seed_offset=0 real_seed=1782107690 thread_index=0\n",
      "\u001b[0mbasic.random.init_random_generator: {0} \u001b[0mRandomGenerator:init: Normal mode, seed=1782107690 RG_type=mt19937\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: {0} \u001b[0mFinished initializing fa_standard residue type set.  Created 984 residue types\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: {0} \u001b[0mTotal time to initialize 0.634784 seconds.\n",
      "\u001b[0mcore.import_pose.import_pose: {0} \u001b[0mFile './data/6LZ9_H_L.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mcore.conformation.Conformation: {0} \u001b[0mFound disulfide between residues 21 94\n",
      "\u001b[0mcore.conformation.Conformation: {0} \u001b[0mcurrent variant for 21 CYS\n",
      "\u001b[0mcore.conformation.Conformation: {0} \u001b[0mcurrent variant for 94 CYS\n",
      "\u001b[0mcore.conformation.Conformation: {0} \u001b[0mcurrent variant for 21 CYD\n",
      "\u001b[0mcore.conformation.Conformation: {0} \u001b[0mcurrent variant for 94 CYD\n",
      "\u001b[0mcore.conformation.Conformation: {0} \u001b[0mFound disulfide between residues 141 206\n",
      "\u001b[0mcore.conformation.Conformation: {0} \u001b[0mcurrent variant for 141 CYS\n",
      "\u001b[0mcore.conformation.Conformation: {0} \u001b[0mcurrent variant for 206 CYS\n",
      "\u001b[0mcore.conformation.Conformation: {0} \u001b[0mcurrent variant for 141 CYD\n",
      "\u001b[0mcore.conformation.Conformation: {0} \u001b[0mcurrent variant for 206 CYD\n"
     ]
    }
   ],
   "source": [
    "# 初始化,导入PDB\n",
    "from pyrosetta import pose_from_pdb, init\n",
    "from pyrosetta.rosetta.core.select.residue_selector import ChainSelector\n",
    "init()\n",
    "# 从pdb中读入生成pose对象,(肝细胞生长因子抗体PDB:6LZ9)\n",
    "pose = pose_from_pdb('./data/6LZ9_H_L.pdb')\n",
    "select_heavy_chain = ChainSelector('H')\n",
    "select_light_chain = ChainSelector('L')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. 非构象依赖的选择器"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "这一部分接着上一节,讲一些更复杂的非构象依赖的选择器。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.1. ResiduePropertySelector\n",
    "通过氨基酸的性质进行定义的选择器,比如可以选择带正电的氨基酸、带负电的氨基酸、疏水氨基酸、含有芳香环的氨基酸等等。</br>\n",
    "氨基酸的性质分类可详见: https://www.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/ResidueSelectors/ResiduePropertySelector\n",
    "\n",
    "以实例进行说明:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#example1: 使用单一属性选择,选择所有的极性氨基酸\n",
    "from pyrosetta.rosetta.core.select.residue_selector import ResiduePropertySelector\n",
    "from pyrosetta.rosetta.core.chemical import ResidueProperty\n",
    "prop_selector = ResiduePropertySelector(ResidueProperty.POLAR)\n",
    "prop_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# example2: 使用多属性进行选择\n",
    "from pyrosetta.rosetta.core.select.residue_selector import basic_selection_logic\n",
    "prop_selector = ResiduePropertySelector()\n",
    "prop_selector.add_property(ResidueProperty.POLAR)  # 极性氨基酸\n",
    "prop_selector.add_property(ResidueProperty.CHARGED) # 带电的氨基酸\n",
    "prop_selector.set_selection_logic(basic_selection_logic.or_logic)\n",
    "prop_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**结果解读** <br />\n",
    "注意在使用多属性选择时,应当注意选择的逻辑性,可通过set_selection_logic进行设置,默认为AND逻辑。如果设置为OR逻辑需要使用basic_selection_logic.or_logic."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.2. RandomResidueSelector\n",
    "从某个氨基酸子集中随机地选取N个氨基酸定义的选择器。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mcore.select.residue_selector.RandomResidueSelector: {0} \u001b[0mSelected residues: 45 91 43 32 65 2 99 50 36 87 61 62 105 27 64 24 66 10 6 69 51 118 4 95 16 48 101 108 54 52\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 比如从重链中随机选择出5个氨基酸: 多运行几次,就可发现返回的编号是不一样的。\n",
    "from pyrosetta.rosetta.core.select.residue_selector import RandomResidueSelector\n",
    "random_selector = RandomResidueSelector(select_heavy_chain, 30)\n",
    "random_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.3. Jump相关的选择器\n",
    "第三章中,我们教授了FoldTree相关的知识内容,在Start和End位氨基酸建立虚拟链接,这就代表一个Jump点。<br />\n",
    "Jump选择器包括JumpDownstreamSelector和JumpUpstreamSelector,用于选择Jump点的下游还是上游。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mcore.import_pose.import_pose: {0} \u001b[0mFile './data/1v74.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mcore.conformation.Conformation: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OXT on residue LEU:CtermProteinFull 107\n",
      "\u001b[0mcore.conformation.Conformation: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OXT on residue LEU:CtermProteinFull 194\n",
      "PDB file name: ./data/1v74.pdb\n",
      " Pose Range  Chain    PDB Range  |   #Residues         #Atoms\n",
      "\n",
      "0001 -- 0107    A 0591  -- 0697  |   0107 residues;    01728 atoms\n",
      "0108 -- 0194    B 0001  -- 0087  |   0087 residues;    01425 atoms\n",
      "                           TOTAL |   0194 residues;    03153 atoms\n",
      "\n",
      "1v74 Fold Tree:\n",
      " FOLD_TREE  EDGE 1 107 -1  EDGE 1 108 1  EDGE 108 194 -1 \n"
     ]
    }
   ],
   "source": [
    "#这里我们还是采用第三章中的1v74的PDB\n",
    "pose_1v74 = pose_from_pdb('./data/1v74.pdb')\n",
    "pose_1v74_foldtree = pose_1v74.fold_tree()\n",
    "print(pose_1v74.pdb_info())\n",
    "print(\"1v74 Fold Tree:\\n\", pose_1v74_foldtree) #输出PDB:1V74的fold tree表示"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "有上述可见,1v74包含两条链,分别是A和B链。AB链以虚拟共价键Jump1相连接。FoldTree的顺序是1->107 -jump1-> 108->194."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1.3.1.JumpDownstreamSelector"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "vector1_bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n"
     ]
    }
   ],
   "source": [
    "#选择Jump点1的下游残基\n",
    "from pyrosetta.rosetta.core.select.residue_selector import JumpDownstreamSelector\n",
    "jumpdown_selector = JumpDownstreamSelector()\n",
    "jumpdown_selector.set_jump(1)\n",
    "residue_selector = jumpdown_selector.apply(pose_1v74)\n",
    "print(residue_selector)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194]\n"
     ]
    }
   ],
   "source": [
    "# 验证一下选择的范围。\n",
    "index_list = [index+1 for index, i in enumerate(residue_selector) if i == 1]\n",
    "print(index_list)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "JumpDownstreamSelector正确选择了FoldTree在Jump1点处的下游序列。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1.3.2.JumpUstreamSelector"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "vector1_bool[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n"
     ]
    }
   ],
   "source": [
    "#选择Jump点2的上游残基\n",
    "from pyrosetta.rosetta.core.select.residue_selector import JumpUpstreamSelector\n",
    "jumpup_selector = JumpUpstreamSelector()\n",
    "jumpup_selector.set_jump(1)\n",
    "residue_selector = jumpup_selector.apply(pose_1v74)\n",
    "print(residue_selector)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[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, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107]\n"
     ]
    }
   ],
   "source": [
    "# 验证一下选择的范围。\n",
    "index_list = [index+1 for index, i in enumerate(residue_selector) if i == 1]\n",
    "print(index_list)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "JumpUstreamSelector正确选择了FoldTree在Jump1点处的上游序列。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.4. Antibody相关的选择器\n",
    "有一些选择器是根据特定分子类型开发的,比如在RosettaAntibody模块中,就有选择抗体功能区或非功能区的选择器。比如CDRResidueSelector、AntibodyRegionSelector等。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1.4.1. CDRResidueSelector"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "PyRosetta-4 2021 [Rosetta PyRosetta4.conda.mac.cxx11thread.serialization.python37.Release 2021.26+release.b308454c455dd04f6824cc8b23e54bbb9be2cdd7 2021-07-02T13:01:54] retrieved from: http://www.pyrosetta.org\n",
      "(C) Copyright Rosetta Commons Member Institutions. Created in JHU by Sergey Lyskov and PyRosetta Team.\n",
      "\u001b[0mcore.init: {0} \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags\n",
      "\u001b[0mcore.init: {0} \u001b[0mRosetta version: PyRosetta4.conda.mac.cxx11thread.serialization.python37.Release r288 2021.26+release.b308454c455 b308454c455dd04f6824cc8b23e54bbb9be2cdd7 http://www.pyrosetta.org 2021-07-02T13:01:54\n",
      "\u001b[0mcore.init: {0} \u001b[0mcommand: PyRosetta -input_ab_scheme Chothia -database /opt/miniconda3/lib/python3.7/site-packages/pyrosetta/database\n",
      "\u001b[0mbasic.random.init_random_generator: {0} \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=-704065920 seed_offset=0 real_seed=-704065920 thread_index=0\n",
      "\u001b[0mbasic.random.init_random_generator: {0} \u001b[0mRandomGenerator:init: Normal mode, seed=-704065920 RG_type=mt19937\n"
     ]
    }
   ],
   "source": [
    "from pyrosetta.rosetta.protocols.antibody import CDRNameEnum\n",
    "from pyrosetta.rosetta.protocols.antibody.residue_selector import CDRResidueSelector\n",
    "init('-input_ab_scheme Chothia') # 根据抗体的不同编号进行选择初始化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: sampling/antibodies/cluster_center_dihedrals.txt\n",
      "\u001b[0mprotocols.antibody.AntibodyNumberingParser: {0} \u001b[0mAntibody numbering scheme definitions read successfully\n",
      "\u001b[0mprotocols.antibody.AntibodyNumberingParser: {0} \u001b[0mAntibody CDR definition read successfully\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSuccessfully finished the CDR definition\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mAC Detecting Regular CDR H3 Stem Type\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mTRDGGLLFAYYAMDYW\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mAC Finished Detecting Regular CDR H3 Stem Type: KINKED\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mAC Finished Detecting Regular CDR H3 Stem Type: Kink: 1 Extended: 0\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for H1\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 13 Omega: TTTTTTTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for H2\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 9 Omega: TTTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for H3\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 15 Omega: TTTTTTTTTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for L1\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 11 Omega: TTTTTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for L2\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 8 Omega: TTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for L3\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 9 Omega: TTTTTTCTT\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# example1: 选择单个CDR.\n",
    "cdr_selector = CDRResidueSelector()\n",
    "cdr_selector.set_cdr(CDRNameEnum.h1)  #h1,h2,h3,l1,l2,l3\n",
    "cdr_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: sampling/antibodies/cluster_center_dihedrals.txt\n",
      "\u001b[0mprotocols.antibody.AntibodyNumberingParser: {0} \u001b[0mAntibody numbering scheme definitions read successfully\n",
      "\u001b[0mprotocols.antibody.AntibodyNumberingParser: {0} \u001b[0mAntibody CDR definition read successfully\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSuccessfully finished the CDR definition\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mAC Detecting Regular CDR H3 Stem Type\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mTRDGGLLFAYYAMDYW\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mAC Finished Detecting Regular CDR H3 Stem Type: KINKED\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mAC Finished Detecting Regular CDR H3 Stem Type: Kink: 1 Extended: 0\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for H1\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 13 Omega: TTTTTTTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for H2\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 9 Omega: TTTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for H3\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 15 Omega: TTTTTTTTTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for L1\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 11 Omega: TTTTTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for L2\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 8 Omega: TTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for L3\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 9 Omega: TTTTTTCTT\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# example2: 选择多个CDR\n",
    "from pyrosetta.rosetta.utility import vector1_protocols_antibody_CDRNameEnum\n",
    "from pyrosetta.rosetta.utility import vector1_bool\n",
    "\n",
    "# 设定cdr list;\n",
    "# 全选6段CDR区, vector1_bool的顺序是,[H1, H2, H3, L1, L2, L3]。\n",
    "cdrs_list = vector1_bool()\n",
    "for i in range(6):\n",
    "    cdrs_list.append(1)\n",
    "\n",
    "cdr_selector = CDRResidueSelector()\n",
    "cdr_selector.set_cdrs(cdrs_list)\n",
    "cdr_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1.4.2. AntibodyRegionSelector\n",
    "除了选择CDR,还可以通过抗体的区域选择器选择Framework区、抗体antigen等区域。\n",
    "使用AntibodyRegionSelector选择器需要额外定义好AntibodyRegionEnum:\n",
    "- antigen_region\n",
    "- cdr_region\n",
    "- framework_region"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: sampling/antibodies/cluster_center_dihedrals.txt\n",
      "\u001b[0mprotocols.antibody.AntibodyNumberingParser: {0} \u001b[0mAntibody numbering scheme definitions read successfully\n",
      "\u001b[0mprotocols.antibody.AntibodyNumberingParser: {0} \u001b[0mAntibody CDR definition read successfully\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSuccessfully finished the CDR definition\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mAC Detecting Regular CDR H3 Stem Type\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mTRDGGLLFAYYAMDYW\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mAC Finished Detecting Regular CDR H3 Stem Type: KINKED\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mAC Finished Detecting Regular CDR H3 Stem Type: Kink: 1 Extended: 0\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for H1\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 13 Omega: TTTTTTTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for H2\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 9 Omega: TTTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for H3\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 15 Omega: TTTTTTTTTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for L1\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 11 Omega: TTTTTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for L2\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 8 Omega: TTTTTTTT\n",
      "\u001b[0mantibody.AntibodyInfo: {0} \u001b[0mSetting up CDR Cluster for L3\n",
      "\u001b[0mprotocols.antibody.cluster.CDRClusterMatcher: {0} \u001b[0mLength: 9 Omega: TTTTTTCTT\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 抗体区域选择器:\n",
    "from pyrosetta.rosetta.protocols.antibody import AntibodyRegionEnum\n",
    "from pyrosetta.rosetta.protocols.antibody.residue_selector import AntibodyRegionSelector\n",
    "ab_region_selector = AntibodyRegionSelector()\n",
    "ab_region_selector.set_region(AntibodyRegionEnum.cdr_region)\n",
    "\n",
    "# 读者也可以尝试设置以下的一些选项试试。\n",
    "#ab_region_selector.set_region(AntibodyRegionEnum.framework_region)\n",
    "# ab_region_selector.set_region(AntibodyRegionEnum.antigen_region)\n",
    "\n",
    "# 此处全选所有的CDR区。\n",
    "ab_region_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. 构象依赖的选择器"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.1. InterGroupInterfaceByVectorSelector\n",
    "该选择器使用氨基酸Cα-Cβ向量的长度以及角度来搜索两个刚体之间相互接触的氨基酸(如蛋白-蛋白相互作用界面等), 其中nearby_atom_cut和vector_dist_cut是关键的距离参数,距离越大,选择的相互作用界面越大。默认为6和8埃。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyrosetta.rosetta.core.select.residue_selector import InterGroupInterfaceByVectorSelector\n",
    "# 此处以选择抗体的重链和轻链之间的Interface为例:\n",
    "interface_seletor = InterGroupInterfaceByVectorSelector(select_light_chain, select_heavy_chain)\n",
    "interface_seletor.nearby_atom_cut(6)\n",
    "interface_seletor.vector_dist_cut(8)\n",
    "interface_seletor.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.2. RamaMutationSelector\n",
    "如我们想选出那些位置突变成L- or D-proline, 2-aminoisobutyric acid (AIB)时,通过rama得分的计算,选出满足突变需求的氨基酸位点,且这个突变强烈满足Ramachandran空间的要求。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "scrolled": true,
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet the rama_prepro multiplier to 0.8.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet rama_prepro score threshold to -0.1.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet target type to PRO.\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/all.ramaProb\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/prepro.ramaProb\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m residue 1 is a terminus!  Skipping and not selecting.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 2 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 2 is 14.5537 (11.6429 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 3 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 3 is 18.0924 (14.4739 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 4 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 4 is 14.9274 (11.942 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 5 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 5 is 3.65002 (2.92002 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 6 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 6 is 23.401 (18.7208 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 7 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 7 is 15.5227 (12.4182 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 8 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 8 is 2.30243 (1.84195 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 9 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 9 is 8.07389 (6.45911 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 10 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 10 is 23.0507 (18.4406 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 11 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 11 is 12.1568 (9.72547 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 12 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 12 is 7.58704 (6.06963 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 13 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 13 is -0.541637 (-0.433309 when multiplied by the weight coefficient), which is below the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 14 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 14 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 15 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 15 is 2.85857 (2.28685 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 16 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 16 is 15.7749 (12.6199 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 17 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 17 is 0.798573 (0.638858 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 18 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 18 is 18.7593 (15.0075 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 19 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 19 is 4.51075 (3.6086 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 20 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 20 is 17.4215 (13.9372 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m No representative type found for PRO equivalent to CYS:disulfide.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 22 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 22 is 9.10502 (7.28402 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 23 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 23 is 2.65138 (2.1211 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 24 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 24 is 23.0147 (18.4118 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 25 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 25 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 26 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 26 is 16.6628 (13.3303 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 27 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 27 is 10.3006 (8.24044 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 28 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 28 is 2.93052 (2.34442 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 29 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 29 is 1.1701 (0.93608 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 30 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 30 is 4.39453 (3.51562 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 31 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 31 is 23.4412 (18.753 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 32 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 32 is 6.48496 (5.18797 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 33 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 33 is 10.9708 (8.77664 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 34 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 34 is 11.386 (9.1088 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 35 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 35 is 4.534 (3.6272 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 36 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 36 is 16.7852 (13.4282 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 37 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 37 is 7.89972 (6.31977 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 38 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 38 is 23.9871 (19.1897 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 39 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 39 is -0.630105 (-0.504084 when multiplied by the weight coefficient), which is below the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 40 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 40 is 2.18604 (1.74883 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 41 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 41 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 42 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 42 is 3.08244 (2.46596 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 43 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 43 is 1.51222 (1.20977 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 44 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 44 is -1.17952 (-0.943613 when multiplied by the weight coefficient), which is below the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 45 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 45 is 16.9181 (13.5345 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 46 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 46 is 1.44859 (1.15887 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 47 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 47 is 6.15399 (4.92319 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 48 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 48 is 23.3637 (18.6909 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 49 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 49 is 23.229 (18.5832 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 50 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 50 is 11.8223 (9.45786 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 51 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 51 is 0.963203 (0.770562 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 52 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 52 is 0.610937 (0.48875 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 53 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 53 is 3.70231 (2.96185 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 54 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 54 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 55 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 55 is 2.93064 (2.34451 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 56 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 56 is 9.32433 (7.45947 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 57 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 57 is 12.0745 (9.65962 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 58 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 58 is 10.1937 (8.15498 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 59 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 59 is 1.36809 (1.09447 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 60 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 60 is 3.37856 (2.70285 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 61 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 61 is -0.0478797 (-0.0383037 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 62 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 62 is 2.73164 (2.18531 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 63 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 63 is -0.05593 (-0.044744 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 64 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 64 is 0.0854165 (0.0683332 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 65 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 65 is 10.8231 (8.65844 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 66 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 66 is 6.46766 (5.17413 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 67 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 67 is 23.4669 (18.7735 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 68 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 68 is 17.3637 (13.8909 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 69 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 69 is 18.7747 (15.0198 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 70 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 70 is 22.7266 (18.1813 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 71 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 71 is 12.5734 (10.0588 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 72 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 72 is 1.37238 (1.0979 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 73 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 73 is 1.67092 (1.33674 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 74 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 74 is 0.73122 (0.584976 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 75 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 75 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 76 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 76 is 13.7317 (10.9854 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 77 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 77 is 10.6395 (8.51163 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 78 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 78 is 6.97936 (5.58349 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 79 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 79 is 2.73746 (2.18997 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 80 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 80 is 20.2957 (16.2366 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 81 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 81 is 14.1586 (11.3269 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 82 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 82 is 0.373035 (0.298428 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 83 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 83 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 84 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 84 is 0.600179 (0.480143 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 85 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 85 is 3.21033 (2.56826 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 86 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 86 is 0.983249 (0.7866 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 87 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 87 is -0.422504 (-0.338003 when multiplied by the weight coefficient), which is below the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 88 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 88 is 0.874582 (0.699665 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 89 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 89 is 1.98509 (1.58807 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 90 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 90 is 23.3088 (18.647 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 91 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 91 is 1.57314 (1.25851 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 92 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 92 is 8.29916 (6.63933 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 93 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 93 is 4.08613 (3.2689 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m No representative type found for PRO equivalent to CYS:disulfide.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 95 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 95 is 15.6565 (12.5252 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 96 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 96 is 5.20635 (4.16508 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 97 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 97 is 1.90865 (1.52692 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 98 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 98 is 1.09196 (0.873568 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 99 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 99 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 100 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 100 is 3.61579 (2.89264 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 101 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 101 is 2.28871 (1.83097 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 102 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 102 is 4.07433 (3.25947 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 103 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 103 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 104 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 104 is 4.05109 (3.24087 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 105 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 105 is 2.39826 (1.91861 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 106 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 106 is -1.45473 (-1.16378 when multiplied by the weight coefficient), which is below the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 107 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 107 is 4.89552 (3.91642 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 108 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 108 is 3.31784 (2.65427 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 109 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 109 is 11.2377 (8.99018 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 110 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 110 is 12.2969 (9.83753 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 111 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 111 is 0.188431 (0.150745 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 112 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 112 is 0.848888 (0.67911 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 113 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 113 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 114 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 114 is 23.5363 (18.8291 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 115 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 115 is 0.73617 (0.588936 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 116 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 116 is 19.52 (15.616 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 117 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 117 is 10.6204 (8.49636 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m residue 118 is a terminus!  Skipping and not selecting.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m residue 119 is a terminus!  Skipping and not selecting.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 120 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 120 is 0.979719 (0.783775 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 121 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 121 is 7.20529 (5.76423 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 122 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 122 is 3.43548 (2.74838 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 123 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 123 is 3.11411 (2.49129 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 124 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 124 is 16.9701 (13.5761 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 125 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 125 is 2.26978 (1.81582 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 126 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 126 is 3.25963 (2.6077 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 127 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 127 is 4.00145 (3.20116 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 128 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 128 is 9.68382 (7.74705 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 129 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 129 is 23.4495 (18.7596 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 130 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 130 is 2.48647 (1.98918 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 131 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 131 is 21.642 (17.3136 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 132 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 132 is 8.66994 (6.93595 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 133 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 133 is -0.393604 (-0.314884 when multiplied by the weight coefficient), which is below the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 134 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 134 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 135 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 135 is 0.715085 (0.572068 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 136 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 136 is 2.96898 (2.37519 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 137 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 137 is 11.0413 (8.83304 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 138 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 138 is 12.0044 (9.60351 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 139 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 139 is 6.88164 (5.50531 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 140 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 140 is 18.0973 (14.4779 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m No representative type found for PRO equivalent to CYS:disulfide.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 142 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 142 is 13.8515 (11.0812 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 143 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 143 is 0.166254 (0.133003 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 144 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 144 is 0.780357 (0.624286 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 145 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 145 is 23.4176 (18.7341 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 146 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 146 is 1.28501 (1.02801 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 147 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 147 is 2.95477 (2.36381 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 148 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 148 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 149 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 149 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 150 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 150 is 3.14389 (2.51511 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 151 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 151 is 17.0677 (13.6542 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 152 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 152 is 7.80427 (6.24341 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 153 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 153 is 12.5306 (10.0245 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 154 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 154 is 10.0616 (8.04926 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 155 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 155 is 10.4582 (8.36659 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 156 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 156 is 7.22662 (5.7813 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 157 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 157 is -0.147996 (-0.118397 when multiplied by the weight coefficient), which is below the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 158 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 158 is -0.814982 (-0.651986 when multiplied by the weight coefficient), which is below the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 159 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 159 is 0.88283 (0.706264 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 160 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 160 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 161 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 161 is -0.383975 (-0.30718 when multiplied by the weight coefficient), which is below the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 162 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 162 is 9.09669 (7.27735 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 163 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 163 is 11.0753 (8.86023 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 164 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 164 is 2.17458 (1.73966 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 165 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 165 is 8.62142 (6.89714 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 166 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 166 is 21.1897 (16.9518 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 167 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 167 is 6.18517 (4.94813 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 168 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 168 is 23.363 (18.6904 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 169 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 169 is 1.9142 (1.53136 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 170 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 170 is 9.08465 (7.26772 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 171 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 171 is 0.837079 (0.669663 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 172 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 172 is 5.39106 (4.31285 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 173 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 173 is -0.453179 (-0.362543 when multiplied by the weight coefficient), which is below the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 174 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 174 is 1.45438 (1.16351 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 175 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 175 is 1.10625 (0.885002 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 176 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 176 is 2.01296 (1.61037 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 177 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 177 is -1.3128 (-1.05024 when multiplied by the weight coefficient), which is below the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 178 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 178 is 0.851762 (0.68141 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 179 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 179 is 0.792731 (0.634185 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 180 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 180 is 2.97041 (2.37632 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 181 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 181 is 23.462 (18.7696 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 182 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 182 is 8.97123 (7.17699 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 183 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 183 is 23.3739 (18.6991 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 184 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 184 is 23.3595 (18.6876 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 185 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 185 is 23.3284 (18.6628 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 186 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 186 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 187 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 187 is 6.60019 (5.28015 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 188 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 188 is 5.92881 (4.74305 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 189 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 189 is 9.80759 (7.84607 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 190 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 190 is 22.5646 (18.0517 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 191 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 191 is 13.7606 (11.0085 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 192 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 192 is 11.7109 (9.36869 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 193 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 193 is 11.9245 (9.53957 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 194 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 194 is 0.203103 (0.162482 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 195 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 195 is 23.3632 (18.6906 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 196 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 196 is 0.258897 (0.207117 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 197 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 197 is 5.46608 (4.37286 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 198 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 198 is 2.01794 (1.61435 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 199 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 199 is -0.141488 (-0.11319 when multiplied by the weight coefficient), which is below the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 200 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 200 is 1.14879 (0.919032 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 201 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 201 is 3.05512 (2.4441 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 202 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 202 is 23.4625 (18.77 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 203 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 203 is 6.74815 (5.39852 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 204 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 204 is 7.62714 (6.10171 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 205 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 205 is 10.2724 (8.21793 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m No representative type found for PRO equivalent to CYS:disulfide.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 207 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 207 is 23.3462 (18.6769 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 208 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 208 is 4.74366 (3.79493 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 209 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 209 is 3.33621 (2.66897 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 210 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 210 is 6.41277 (5.13022 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 211 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 211 is 8.82299 (7.05839 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 212 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 212 is -0.151298 (-0.121038 when multiplied by the weight coefficient), which is below the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 213 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 213 is 2.795 (2.236 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 214 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 214 is -1.36343 (-1.09074 when multiplied by the weight coefficient), which is below the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 215 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 215 is 13.8829 (11.1063 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 216 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 216 is 4.71823 (3.77458 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 217 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 217 is 3.27208 (2.61766 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 218 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 218 is 1.3095 (1.0476 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 219 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 219 is 23.3632 (18.6905 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 220 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 220 is 16.9944 (13.5955 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 221 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 221 is 3.36455 (2.69164 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mSet residue type for position 222 to PRO.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0mThe rama_prepro energy for position 222 is 5.11861 (4.09489 when multiplied by the weight coefficient), which is above the threshold for selection.\n",
      "\u001b[0mprotocols.cyclic_peptide.RamaMutationSelector: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m residue 223 is a terminus!  Skipping and not selecting.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyrosetta.rosetta.protocols.cyclic_peptide import *\n",
    "rama_selector = RamaMutationSelector()\n",
    "rama_selector.set_rama_prepro_multiplier(0.8) #设置rama计算时的权重系数,默认0.45。这里打分函数用的beta_nov15\n",
    "rama_selector.set_score_threshold(-0.1) #设置rama得分的阈值,从而选出低于阈值的残基\n",
    "rama_selector.set_target_type('PRO')\n",
    "rama_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.3. SymmetricalResidueSelector\n",
    "返回与给定残基对称的其他所有残基。在一个对称的体系中,想要知道其他与之对称的残基序号时是有用的。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "PyRosetta-4 2021 [Rosetta PyRosetta4.conda.mac.cxx11thread.serialization.python37.Release 2021.26+release.b308454c455dd04f6824cc8b23e54bbb9be2cdd7 2021-07-02T13:01:54] retrieved from: http://www.pyrosetta.org\n",
      "(C) Copyright Rosetta Commons Member Institutions. Created in JHU by Sergey Lyskov and PyRosetta Team.\n",
      "\u001b[0mcore.init: {0} \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags\n",
      "\u001b[0mcore.init: {0} \u001b[0mRosetta version: PyRosetta4.conda.mac.cxx11thread.serialization.python37.Release r288 2021.26+release.b308454c455 b308454c455dd04f6824cc8b23e54bbb9be2cdd7 http://www.pyrosetta.org 2021-07-02T13:01:54\n",
      "\u001b[0mcore.init: {0} \u001b[0mcommand: PyRosetta -in:auto_setup_metals -database /opt/miniconda3/lib/python3.7/site-packages/pyrosetta/database\n",
      "\u001b[0mbasic.random.init_random_generator: {0} \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=1350960609 seed_offset=0 real_seed=1350960609 thread_index=0\n",
      "\u001b[0mbasic.random.init_random_generator: {0} \u001b[0mRandomGenerator:init: Normal mode, seed=1350960609 RG_type=mt19937\n",
      "\u001b[0mcore.import_pose.import_pose: {0} \u001b[0mFile './data/6veh.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mcore.util.metalloproteins_util: {0} \u001b[0mAutomatically setting covalent bonds between metal ions and metal-binding residues.\n",
      "\u001b[0mcore.util.metalloproteins_util: {0} \u001b[0mAutomatically setting up constraints between metal ions and metal-binding residues.\n",
      "PDB file name: ./data/6veh.pdb\n",
      " Pose Range  Chain    PDB Range  |   #Residues         #Atoms\n",
      "\n",
      "0001 -- 0164    A 0002  -- 0165  |   0164 residues;    02497 atoms\n",
      "0165 -- 0328    B 0002  -- 0165  |   0164 residues;    02497 atoms\n",
      "0329 -- 0492    C 0002  -- 0165  |   0164 residues;    02497 atoms\n",
      "                           TOTAL |   0492 residues;    07491 atoms\n",
      "\n"
     ]
    }
   ],
   "source": [
    "from pyrosetta import pose_from_pdb, init\n",
    "init(\"-in:auto_setup_metals\")\n",
    "from pyrosetta.rosetta.core.select.residue_selector import *\n",
    "symm_pose = pose_from_pdb('./data/6veh.pdb')\n",
    "print(symm_pose.pdb_info())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mprotocols.simple_moves.symmetry.DetectSymmetry: {0} \u001b[0m3 number of subunits found\n",
      "\u001b[0mprotocols.simple_moves.symmetry.DetectSymmetry: {0} \u001b[0m164 residues per subunit\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m Setting weight of master jump ( jump-id=6 ) to 1.0 (was undefined)\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m Setting jump_group JGS: [master 6]  7:0  8:0\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m Setting weight of master jump ( jump-id=1 ) to 1.0 (was undefined)\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m Setting jump_group JGSS: [master 1]  2:0  3:0\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0msymmetry name: C3\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mnumber of subunits: 3\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mnumber of interfaces: 2\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mscore subunit number: C1\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0manchor the subunits at residue: COM\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0m Virtual coordinate system C1\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mx: 0 0 1\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0my: 0 1 0\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0morigin: 0 0 0\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0m Virtual coordinate system C2\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mx: 0 0 1\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0my: 0.866025 -0.5 0\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0morigin: 0 0 0\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0m Virtual coordinate system C3\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mx: 0 0 1\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0my: -0.866025 -0.5 0\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0morigin: 0 0 0\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0m Virtual coordinate system S1\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mx: 0 0 1\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0my: 0 1 0\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0morigin: 0 0 0\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0m Virtual coordinate system S2\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mx: 0 0 1\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0my: 0.866025 -0.5 0\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0morigin: 0 0 0\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0m Virtual coordinate system S3\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mx: 0 0 1\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0my: -0.866025 -0.5 0\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0morigin: 0 0 0\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mDof for jump: 6\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mx 1:0,0:0,0 n2c\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0my 1:0,0:0,0 n2c\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mz 0:0,0:0,0 n2c\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mx_angle 1:0,0:0,0 n2c\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0my_angle 1:0,0:0,0 n2c\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mz_angle 1:0,0:0,0 n2c\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mJump JC2 C1 C2\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mJump JC3 C1 C3\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mJump JS1 C1 S1\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mJump JS1S S1 SUBUNIT\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mJump JS2 C2 S2\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mJump JS2S S2 SUBUNIT\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mJump JS3 C3 S3\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mJump JS3S S3 SUBUNIT\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mInclude subunit: 1 2 3\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mOutput subunit: 1 2 3\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mSlideType: RANDOM\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mSlideCriteriaType: CEN_DOCK_SCORE\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mSlideCriteriaVal: AUTOMATIC\n",
      "\u001b[0mcore.conformation.symmetry.SymmData: {0} \u001b[0mSlideOrder: none\n",
      "\u001b[0mcore.conformation.symmetry.util: {0} \u001b[0m=================== SYM FOLD TREE, jump notation: =symfixed= *indep* #symdof# jump[=follows] ========================\n",
      "C1(493)\n",
      "|----=j4=---->C2(495)----j7=6---->S2(496)----j2=1---->253:Sub2A(165-328)\n",
      "|----=j5=---->C3(497)----j8=6---->S3(498)----j3=1---->417:Sub3A(329-492)\n",
      "\\----#j6#---->S1(494)----*j1*----->89:Sub1A(1-164)\n"
     ]
    }
   ],
   "source": [
    "from pyrosetta.rosetta.core.select.residue_selector import SymmetricalResidueSelector, ResidueIndexSelector\n",
    "from pyrosetta.rosetta.protocols.symmetry import DetectSymmetry\n",
    "# 先使用DetectSymmetry识别Pose中的对称性;\n",
    "detect_symm = DetectSymmetry()\n",
    "detect_symm.apply(symm_pose)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "vector1_bool[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 对称性地选择1-15号残基:\n",
    "residue_selector = ResidueIndexSelector('1-15')\n",
    "symmetrical_selector = SymmetricalResidueSelector()\n",
    "symmetrical_selector.set_selector(residue_selector)\n",
    "symmetrical_selector.apply(symm_pose)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 可视化 对称性选择的1-15号残基\n",
    "from pyrosetta.rosetta.core.simple_metrics.metrics import SelectedResiduesPyMOLMetric\n",
    "pymol_selected = SelectedResiduesPyMOLMetric()\n",
    "pymol_selected.set_residue_selector(symmetrical_selector)\n",
    "prefix = 'symm_'\n",
    "pymol_selected.apply(symm_pose, prefix)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'select rosetta_sele, (chain A and resid 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) or (chain B and resid 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) or (chain C and resid 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)'"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyrosetta.rosetta.core.simple_metrics import get_sm_data\n",
    "symm_sm_data = get_sm_data(symm_pose)\n",
    "symm_string_metric = symm_sm_data.get_string_metric_data()\n",
    "symm_string_metric['symm_pymol_selection']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<center><img src=\"./img/6VEH_symm.png\" width = \"400\" height = \"300\" align=center /> </center>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**结果解读**<br />\n",
    "上图中蓝色棍棒形式的残基为对称性选择的1-15号残基。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.4. ResiduePDBInfoHasLabelSelector\n",
    "需要先标记残基,然后此API可以根据lable选出预先标记的残基。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mprotocols.simple_moves.AddResidueLabelMover: {0} \u001b[0mExecuting AddResidueLabelMover...\n",
      "\u001b[0mprotocols.simple_moves.AddResidueLabelMover: {0} \u001b[0mAdding to residue #5, label: hotspot\n",
      "\u001b[0mprotocols.simple_moves.AddResidueLabelMover: {0} \u001b[0mAdding to residue #6, label: hotspot\n",
      "\u001b[0mprotocols.simple_moves.AddResidueLabelMover: {0} \u001b[0mAdding to residue #7, label: hotspot\n",
      "\u001b[0mprotocols.simple_moves.AddResidueLabelMover: {0} \u001b[0mAdding to residue #8, label: hotspot\n",
      "\u001b[0mprotocols.simple_moves.AddResidueLabelMover: {0} \u001b[0mNumber of residues labeled: 4\n",
      "\u001b[0mprotocols.simple_moves.AddResidueLabelMover: {0} \u001b[0mselect hotspot, resi 5+6+7+8+\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyrosetta.rosetta.protocols.simple_moves import *\n",
    "from pyrosetta.rosetta.core.select.residue_selector import *\n",
    "from pyrosetta.rosetta.core.select.residue_selector import ResidueIndexSelector\n",
    "residue1_selector = ResidueIndexSelector('5,6,7,8')\n",
    "\n",
    "#创建label标签:调用AddResidueLabelMover\n",
    "add_label = AddResidueLabelMover(residue1_selector,'hotspot')\n",
    "add_label.apply(pose)\n",
    "\n",
    "#将带标签“Hotspot“的残基子集从pose中分离出来:\n",
    "label_selector = ResiduePDBInfoHasLabelSelector('hotspot')\n",
    "label_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.5. LayerSelector\n",
    "Layer是Rosetta中的一个重要概念,将蛋白质分为表面层(surface)、交界层(boundary)以及内核层(Core)。众所周知,蛋白质的不同层的氨基酸是具有偏好性分布的,比如在内核层由许多的非极性氨基酸组成的疏水核心,而在表面层分布大多为极性氨基酸,能与溶液环境中的水分子相互作用。LayerSelector是十分强大的工具,可以根据set_layers()进行组合选择。set_layers()的三个布尔值按顺序分别代表选择Core/boundary/Surface。另外该选择器有两种判别模式(只能选其一),分别是基于SASA的方法和基于邻居数量的方法。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSetting LayerSelector to use sidechain neighbors to determine burial.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSet cutoffs for core and surface to 5.2 and 2, respectively, in LayerSelector.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSetting core=true boundary=false surface=false in LayerSelector.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSetting core=false boundary=true surface=false in LayerSelector.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSetting core=false boundary=false surface=true in LayerSelector.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSetting LayerSelector to use rolling ball-based occlusion to determine burial.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSet cutoffs for core and surface to 5.2 and 2, respectively, in LayerSelector.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSetting LayerSelector to use sidechain neighbors to determine burial.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSet cutoffs for core and surface to 5.2 and 2, respectively, in LayerSelector.\n"
     ]
    }
   ],
   "source": [
    "from pyrosetta.rosetta.core.select.residue_selector import LayerSelector\n",
    "layer_selector = LayerSelector()\n",
    "\n",
    "# 定义需要选定的层:\n",
    "layer_selector.set_layers(True, False, False) # 只选择内核的设置方法\n",
    "layer_selector.set_layers(False, True, False) # 只选择边界层的设置方法\n",
    "layer_selector.set_layers(False, False, True) # 只选择表面层的设置方法 \n",
    "\n",
    "# neighbor-based(选1,根据set_use_sc_neighbors)\n",
    "layer_selector.set_use_sc_neighbors(False) # True使用Sidechain neighbor算法,False使用SASA-based算法\n",
    "layer_selector.set_cutoffs(5.2, 2.0) # 内核,表层邻居数量截断设置\n",
    "\n",
    "# neighbor-based(选1,根据set_use_sc_neighbors)\n",
    "layer_selector.set_use_sc_neighbors(True)\n",
    "layer_selector.set_cutoffs(5.2, 2.0) # 内核,表层邻居数量截断设置"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSetting LayerSelector to use sidechain neighbors to determine burial.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSet cutoffs for core and surface to 5.2 and 2, respectively, in LayerSelector.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSetting core=true boundary=false surface=false in LayerSelector.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSetting LayerSelector to use rolling ball-based occlusion to determine burial.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSet cutoffs for core and surface to 20 and 40, respectively, in LayerSelector.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSetting radius for rolling ball algorithm to 2 in LayerSelector.  (Note that this will have no effect if the sidechain neighbors method is used.)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0]"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# example1: 选择内核层(SASA法)\n",
    "layer_selector = LayerSelector()\n",
    "layer_selector.set_layers(True, False, False) # 只选择内核的设置方法\n",
    "layer_selector.set_use_sc_neighbors(False) # 使用Sidechain neighbor算法,否则使用SASA-based算法,确定内核残基。\n",
    "layer_selector.set_cutoffs(20.0, 40.0) # 内核,表层截断半径设置\n",
    "layer_selector.set_ball_radius(2.0) # 传统值为1.4\n",
    "layer_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'select rosetta_sele, (chain H and resid 4,6,18,20,22,32,33,34,35,37,49,51,60,78,82C,88,92,93,96,97,100D,102,104,107) or (chain L and resid 2,4,6,21,23,25,29,33,34,35,46,47,48,51,64,71,78,84,87,88,90,95,99,101,102,104)'"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 可视化选择 内核层氨基酸\n",
    "pymol_selected = SelectedResiduesPyMOLMetric()\n",
    "pymol_selected.set_residue_selector(layer_selector)\n",
    "prefix = 'core_select_'\n",
    "pymol_selected.apply(pose, prefix)\n",
    "sm_data = get_sm_data(pose)\n",
    "string_metric = sm_data.get_string_metric_data()\n",
    "string_metric['core_select_pymol_selection']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<center><img src=\"./img/6LZ9_core.png\" width = \"400\" height = \"300\" align=center /> </center>\n",
    "(图片来源: 晶泰科技团队)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSetting LayerSelector to use sidechain neighbors to determine burial.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSet cutoffs for core and surface to 5.2 and 2, respectively, in LayerSelector.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSetting core=false boundary=false surface=true in LayerSelector.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSetting LayerSelector to use sidechain neighbors to determine burial.\n",
      "\u001b[0mcore.select.residue_selector.LayerSelector: {0} \u001b[0mSet cutoffs for core and surface to 5.2 and 2, respectively, in LayerSelector.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# example2: 选择表面层(侧链法)\n",
    "layer_selector = LayerSelector()\n",
    "layer_selector.set_layers(False, False, True) # 只选择表面层的设置方法\n",
    "layer_selector.set_use_sc_neighbors(True) # 使用Sidechain neighbor算法,否则使用SASA-based算法,确定内核残基。\n",
    "layer_selector.set_cutoffs(5.2, 2.0) # 内核,表层邻居数量截断设置\n",
    "layer_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'select rosetta_sele, (chain H and resid 3,5,7,9,10,11,13,14,15,17,19,21,23,25,28,30,31,40,41,42,43,52,54,55,56,61,62,64,65,68,70,72,73,74,75,76,77,79,81,82A,82B,83,84,85,87,98,99,100A,105,108,110) or (chain L and resid 1,3,5,7,9,10,12,14,15,16,18,20,22,24,26,27,28,30,31,39,40,41,43,45,50,52,53,56,57,59,60,63,65,67,68,69,70,72,74,76,77,79,80,81,83,93,100,103,105)'"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 可视化选择 表面层氨基酸\n",
    "pymol_selected = SelectedResiduesPyMOLMetric()\n",
    "pymol_selected.set_residue_selector(layer_selector)\n",
    "prefix = 'surface_select_'\n",
    "pymol_selected.apply(pose, prefix)\n",
    "string_metric = sm_data.get_string_metric_data()\n",
    "string_metric['surface_select_pymol_selection']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<center><img src=\"./img/6LZ9_surface.png\" width = \"400\" height = \"300\" align=center /> </center>\n",
    "(图片来源: 晶泰科技团队)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.6. 键相关选择器\n",
    "在Rosetta中,键是一个重要的描述参数。此处主要介绍BondedResidueSelector和UnsatSelector两种选择器。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.6.1. BondedResidueSelector\n",
    "选择与给定残基成键的残基,包括主链成键的残基和其他任何与之成键的残基。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 1\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 2\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 3\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 4\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 6\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n",
      "\u001b[0mcore.select.residue_selector.BondedResidueSelector: {0} \u001b[0mSelecting residue 5\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyrosetta.rosetta.core.select.residue_selector import BondedResidueSelector, ResidueIndexSelector\n",
    "residue_selector = ResidueIndexSelector('1-5')\n",
    "bonded_selector = BondedResidueSelector()\n",
    "bonded_selector.set_input_set_selector(residue_selector)\n",
    "bonded_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.6.2. HBondSelector\n",
    "选择所有与子集产生氢键的氨基酸,如果未设置子集,那么将返回所有形成氢键且氢键能量E>cutoff的氨基酸。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mcore.scoring.etable: {0} \u001b[0mStarting energy table calculation\n",
      "\u001b[0mcore.scoring.etable: {0} \u001b[0msmooth_etable: changing atr/rep split to bottom of energy well\n",
      "\u001b[0mcore.scoring.etable: {0} \u001b[0msmooth_etable: spline smoothing lj etables (maxdis = 6)\n",
      "\u001b[0mcore.scoring.etable: {0} \u001b[0msmooth_etable: spline smoothing solvation etables (max_dis = 6)\n",
      "\u001b[0mcore.scoring.etable: {0} \u001b[0mFinished calculating energy tables.\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBPoly1D.csv\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBFadeIntervals.csv\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBEval.csv\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/DonStrength.csv\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/AccStrength.csv\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.all.txt\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.gly.txt\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.pro.txt\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.valile.txt\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA_n\n",
      "\u001b[0mcore.scoring.P_AA: {0} \u001b[0mshapovalov_lib::shap_p_aa_pp_smooth_level of 1( aka low_smooth ) got activated.\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/shapovalov/10deg/kappa131/a20.prop\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: {0} \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: {0} \u001b[0mThe -auto_setup_metals flag was used with no metalbinding_constraint weight set in the weights file.  Setting to 1.0.\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/elec_cp_reps.dat\n",
      "\u001b[0mcore.scoring.elec.util: {0} \u001b[0mRead 40 countpair representative atoms\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: {0} \u001b[0mshapovalov_lib_fixes_enable option is true.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: {0} \u001b[0mshapovalov_lib::shap_dun10_smooth_level of 1( aka lowest_smooth ) got activated.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: {0} \u001b[0mBinary rotamer library selected: /opt/miniconda3/lib/python3.7/site-packages/pyrosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: {0} \u001b[0mUsing Dunbrack library binary file '/opt/miniconda3/lib/python3.7/site-packages/pyrosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin'.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: {0} \u001b[0mDunbrack 2010 library took 0.193597 seconds to load from binary\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyrosetta.rosetta.protocols.residue_selectors import HBondSelector\n",
    "from pyrosetta import create_score_function\n",
    "scorefxn = create_score_function('ref2015') #默认ref2015\n",
    "residue_selector = ResidueIndexSelector('42H-60H')\n",
    "hbond_selector = HBondSelector()\n",
    "hbond_selector.set_input_set_selector(residue_selector)\n",
    "hbond_selector.set_scorefxn(scorefxn)\n",
    "hbond_selector.set_hbond_energy_cutoff(-0.5) #设置氢键能量的cutoff\n",
    "hbond_selector.set_include_bb_bb(False) #设置是否包括主链氢键,默认是False(即不包括) \n",
    "hbond_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.6.2. UnsatSelector\n",
    "将选出与架骨的羰基或氨基不满足形成氢键的氨基酸。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mcore.scoring.ScoreFunctionFactory: {0} \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: {0} \u001b[0mThe -auto_setup_metals flag was used with no metalbinding_constraint weight set in the weights file.  Setting to 1.0.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1]"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyrosetta.rosetta.protocols.hbnet import *\n",
    "unsat_selector = UnsatSelector()\n",
    "unsat_selector.set_consider_mainchain_only(True) #True是仅考虑主链,False是不仅仅考虑主链\n",
    "unsat_selector.set_hbond_energy_cutoff(-0.5) #设置氢键能的截断\n",
    "unsat_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.7. 二面角相关选择器\n",
    "在Rosetta中,二面角作为描述蛋白骨架结构最重要的参数,当然少不了与二面角数据有关的选择器。此处主要介绍BinSelector、PhiSelector。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.7.1. BinSelector\n",
    "ABEGO系统在Rosetta中也是比较重要的概念,是从Ramachandran-plot的分布区间进行定义的离散模型, 坐标轴分别定义了phi/psi角,用于描述蛋白局部骨架结构的构象。\n",
    "ABEGO的每个字母代表一个区间, 这些区间的分布是有二级结构的偏向性的:\n",
    "- A: 二面角分布多见于右手性的α螺旋\n",
    "- B: 二面角分布多见于右手性的β折叠\n",
    "- E: 二面角分布多见于左手性的β折叠(罕见)\n",
    "- G: 二面角分布多见于左手性的螺旋(罕见)\n",
    "- O: 反式的omega分布,多见于反式脯氨酸"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: protocol_data/generalizedKIC/bin_params/ABEGO.bin_params\n",
      "\u001b[0mcore.scoring.bin_transitions.BinTransitionCalculator: {0} \u001b[0mOpened file protocol_data/generalizedKIC/bin_params/ABEGO.bin_params for read.\n",
      "\u001b[0mcore.scoring.ramachandran: {0} \u001b[0mshapovalov_lib::shap_rama_smooth_level of 4( aka highest_smooth ) got activated.\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/rama/shapovalov/kappa25/all.ramaProb\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/rama/flat/avg_L_rama.dat\n",
      "\u001b[0mcore.scoring.ramachandran: {0} \u001b[0mReading custom Ramachandran table from scoring/score_functions/rama/flat/avg_L_rama.dat.\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/rama/flat/sym_all_rama.dat\n",
      "\u001b[0mcore.scoring.ramachandran: {0} \u001b[0mReading custom Ramachandran table from scoring/score_functions/rama/flat/sym_all_rama.dat.\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/rama/flat/sym_G_rama.dat\n",
      "\u001b[0mcore.scoring.ramachandran: {0} \u001b[0mReading custom Ramachandran table from scoring/score_functions/rama/flat/sym_G_rama.dat.\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/rama/flat/sym_P_rama.dat\n",
      "\u001b[0mcore.scoring.ramachandran: {0} \u001b[0mReading custom Ramachandran table from scoring/score_functions/rama/flat/sym_P_rama.dat.\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/rama/flat/avg_L_rama_str.dat\n",
      "\u001b[0mcore.scoring.ramachandran: {0} \u001b[0mReading custom Ramachandran table from scoring/score_functions/rama/flat/avg_L_rama_str.dat.\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/rama/flat/sym_all_rama_str.dat\n",
      "\u001b[0mcore.scoring.ramachandran: {0} \u001b[0mReading custom Ramachandran table from scoring/score_functions/rama/flat/sym_all_rama_str.dat.\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/rama/flat/sym_G_rama_str.dat\n",
      "\u001b[0mcore.scoring.ramachandran: {0} \u001b[0mReading custom Ramachandran table from scoring/score_functions/rama/flat/sym_G_rama_str.dat.\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/rama/flat/sym_P_rama_str.dat\n",
      "\u001b[0mcore.scoring.ramachandran: {0} \u001b[0mReading custom Ramachandran table from scoring/score_functions/rama/flat/sym_P_rama_str.dat.\n",
      "\u001b[0mcore.scoring.bin_transitions.BinTransitionCalculator: {0} \u001b[0mFinished read of protocol_data/generalizedKIC/bin_params/ABEGO.bin_params.\n",
      "\u001b[0mcore.select.residue_selector.BinSelector: {0} \u001b[0mLoaded bin parameters file \"ABEGO\" and set bin to select to \"A\".  Only selecting alpha-amino acids.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 将满足phi、psi落在某个区间骨架二面角的残基选出。\n",
    "from pyrosetta.rosetta.core.select.residue_selector import BinSelector\n",
    "bin_selector = BinSelector()\n",
    "bin_selector.set_bin_name('A') # 选择落在A区域的氨基酸\n",
    "bin_selector.set_bin_params_file_name('ABEGO')\n",
    "bin_selector.initialize_and_check() # 必须先启动\n",
    "bin_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.7.2.  PhiSelector\n",
    "根据Ramachandran空间某一坐标轴的正负值,进行选择氨基酸。</br>\n",
    "该选择器**有特定的应用场景**,比如在环肽设计中,通常会混合D-/L-氨基酸。那这些氨基酸的ABGEO分布式对称的,一般用甘氨酸作为出发的氨基酸进行骨架采样,当骨架phi为正值时,这些位置就可以设计为D型氨基酸,而phi为负值时,设计为L型氨基酸。这种设计方案显得更有\"物理\"意义。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyrosetta.rosetta.core.select.residue_selector import PhiSelector\n",
    "phi_selector = PhiSelector()\n",
    "phi_selector.set_select_positive_phi(True)  # True=select +phi\n",
    "phi_selector.set_ignore_unconnected_upper(True)\n",
    "phi_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.8 邻居相关的选择器\n",
    "邻居的概念应用十分广泛,比如我想选择酶活中心周围8埃距离范围内的所有氨基酸等,该选择器对区域性设计时十分有用!<br />\n",
    "- NeighborhoodResidueSelector\n",
    "- NumNeighborsSelector\n",
    "- CloseContactResidueSelector\n",
    "-  LigandMetalContactSelector\n",
    "\n",
    "上一节已经讲过NeighborhoodResidueSelector,这一节主要讲后三个选择器。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.8.1. NumNeighborsSelector\n",
    "不同于NeighborhoodResidueSelector,NumNeighborsSelector只会将周围邻居氨基酸超过设定阈值部分的氨基酸位点选出,**对于选择氨基酸密度高的区域比较有用。**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyrosetta.rosetta.core.select.residue_selector import NumNeighborsSelector\n",
    "nn_selector = NumNeighborsSelector(15, 10.0)  # 两个参数分别是邻居数量阈值、距离半径阈值\n",
    "nn_selector.count_water(True)  # 甚至还可以考虑水分子的数量.\n",
    "nn_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.8.2. CloseContactResidueSelector\n",
    "与NeighborhoodResidueSelector相似,但CloseContactResidueSelector选定的是以整个氨基酸所有原子为中心一定范围内的残基,因此会对氨基酸的rotemer很敏感,而NeighborhoodResidueSelector选定的是以$C_{\\beta}$原子为中心一定范围内的残基。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mcore.select.residue_selector.CloseContactResidueSelector: {0} \u001b[0mSelecting residues around central seqpos: 1 with a distance cutoff of 10\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyrosetta.rosetta.core.select.residue_selector import CloseContactResidueSelector, ResidueIndexSelector\n",
    "residue1_selector = ResidueIndexSelector('1')\n",
    "cc_selector = CloseContactResidueSelector()\n",
    "cc_selector.central_residue_group_selector(residue1_selector)\n",
    "cc_selector.threshold(10.0)\n",
    "cc_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.8.3. LigandMetalContactSelector\n",
    "选择与金属有范德华相互作用的残基,即: 潜在相互作用的原子和金属原子的距离不超过该原子和金属原子范德华半径总和与距离截断因子的乘积。<br />\n",
    "其中: 距离截断因子dist_cutoff_multiplier的默认值为1。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "PyRosetta-4 2021 [Rosetta PyRosetta4.conda.mac.cxx11thread.serialization.python37.Release 2021.26+release.b308454c455dd04f6824cc8b23e54bbb9be2cdd7 2021-07-02T13:01:54] retrieved from: http://www.pyrosetta.org\n",
      "(C) Copyright Rosetta Commons Member Institutions. Created in JHU by Sergey Lyskov and PyRosetta Team.\n",
      "\u001b[0mcore.init: {0} \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags\n",
      "\u001b[0mcore.init: {0} \u001b[0mRosetta version: PyRosetta4.conda.mac.cxx11thread.serialization.python37.Release r288 2021.26+release.b308454c455 b308454c455dd04f6824cc8b23e54bbb9be2cdd7 http://www.pyrosetta.org 2021-07-02T13:01:54\n",
      "\u001b[0mcore.init: {0} \u001b[0mcommand: PyRosetta -in:auto_setup_metals -database /opt/miniconda3/lib/python3.7/site-packages/pyrosetta/database\n",
      "\u001b[0mbasic.random.init_random_generator: {0} \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=-1361465697 seed_offset=0 real_seed=-1361465697 thread_index=0\n",
      "\u001b[0mbasic.random.init_random_generator: {0} \u001b[0mRandomGenerator:init: Normal mode, seed=-1361465697 RG_type=mt19937\n",
      "\u001b[0mcore.import_pose.import_pose: {0} \u001b[0mFile './data/6xbe.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: {0} \u001b[0mZN 230 was added by a jump, with base residue 81\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: {0} \u001b[0mZN 231 was added by a jump, with base residue 167\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: {0} \u001b[0mZN 232 was added by a jump, with base residue 111\n",
      "\u001b[0mcore.util.metalloproteins_util: {0} \u001b[0mAutomatically setting covalent bonds between metal ions and metal-binding residues.\n",
      "\u001b[0mcore.util.metalloproteins_util: {0} \u001b[0mAdding covalent linkage between residue 79's  NE2 atom and residue 230's ZN   atom.\n",
      "\u001b[0mcore.util.metalloproteins_util: {0} \u001b[0mAdding covalent linkage between residue 81's  ND1 atom and residue 230's ZN   atom.\n",
      "\u001b[0mcore.util.metalloproteins_util: {0} \u001b[0mAdding covalent linkage between residue 148's  NE2 atom and residue 230's ZN   atom.\n",
      "\u001b[0mcore.util.metalloproteins_util: {0} \u001b[0mAdding covalent linkage between residue 83's  OD2 atom and residue 231's ZN   atom.\n",
      "\u001b[0mcore.util.metalloproteins_util: {0} \u001b[0mAdding covalent linkage between residue 167's  SG  atom and residue 231's ZN   atom.\n",
      "\u001b[0mcore.util.metalloproteins_util: {0} \u001b[0mAdding covalent linkage between residue 209's  NE2 atom and residue 231's ZN   atom.\n",
      "\u001b[0mcore.util.metalloproteins_util: {0} \u001b[0mAutomatically setting up constraints between metal ions and metal-binding residues.\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 1 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 2 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 3 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 4 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 5 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 6 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 7 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 8 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 9 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 1 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 2 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 3 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 4 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 5 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 6 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 7 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 8 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 9 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 10 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 1 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 2 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 3 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 4 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 5 selected\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyrosetta.rosetta.protocols.residue_selectors import LigandMetalContactSelector\n",
    "from pyrosetta.rosetta.core.select.residue_selector import ResidueIndexSelector\n",
    "from pyrosetta.rosetta.core.select.residue_selector import *\n",
    "init(\"-in:auto_setup_metals\")\n",
    "metal_protein_pose = pose_from_pdb('./data/6xbe.pdb')\n",
    "pose_index_selector = TrueResidueSelector() # TrueResidueSelector: 选择整个Pose的所有残基和分子。\n",
    "lmc_selector = LigandMetalContactSelector()\n",
    "lmc_selector.set_dist_cutoff_multiplier(2.0)\n",
    "lmc_selector.set_resnum_string('ZN')\n",
    "lmc_selector.set_input_set_selector(pose_index_selector)\n",
    "lmc_selector.apply(metal_protein_pose)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 1 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 2 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 3 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 4 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 5 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 6 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 7 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 8 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 9 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 1 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 2 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 3 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 4 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 5 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 6 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 7 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 8 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 9 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 10 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 1 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 2 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 3 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 4 selected\n",
      "\u001b[0mprotocols.residue_selectors.LigandMetalContactSelector: {0} \u001b[0mResidue 5 selected\n"
     ]
    }
   ],
   "source": [
    "# 可视化 与金属有范德华相互作用的残基\n",
    "pymol_selected = SelectedResiduesPyMOLMetric()\n",
    "pymol_selected.set_residue_selector(lmc_selector)\n",
    "prefix = 'lmc_'\n",
    "pymol_selected.apply(metal_protein_pose, prefix)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'select rosetta_sele, (chain A and resid 120,122,124,152,189,208,223,249,250)'"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lmc_sm_data = get_sm_data(metal_protein_pose)\n",
    "lmc_string_metric = lmc_sm_data.get_string_metric_data()\n",
    "lmc_string_metric['lmc_pymol_selection']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<center><img src=\"./img/6XBE_lmc.png\" width = \"400\" height = \"300\" align=center /> </center>\n",
    "(图片来源: 晶泰科技团队)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**结果解读** <br />\n",
    "上图中粉色棍棒形式的残基为与金属有范德华相互作用的残基。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.9 一、二级结构相关的选择器\n",
    "基于一、二级结构的选择器种类丰富:\n",
    "- PrimarySequenceNeighborhoodSelector\n",
    "- SSElementSelector\n",
    "- SecondaryStructureSelector\n",
    "- PairedSheetResidueSelector"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "####  2.9.1. PrimarySequenceNeighborhoodSelector\n",
    "选择一级序列上的邻近残基且包括选定的残基。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mcore.select.residue_selector.PrimarySequenceNeighborhoodSelector: {0} \u001b[0m]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyrosetta.rosetta.core.select.residue_selector import PrimarySequenceNeighborhoodSelector, ResidueIndexSelector\n",
    "residue1_selector = ResidueIndexSelector('5')\n",
    "psn_selector = PrimarySequenceNeighborhoodSelector()\n",
    "psn_selector.set_selector(residue1_selector)\n",
    "psn_selector.set_upper_residues(2) #设定上限,默认为1\n",
    "psn_selector.set_lower_residues(2) #设定下限,默认为1\n",
    "psn_selector.apply(pose) \n",
    "#残基118在H链,残基119在L链,如果是选定残基118,则只选择残基116,117和118"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mcore.select.residue_selector.PrimarySequenceNeighborhoodSelector: {0} \u001b[0m]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#上游残基数、下游残基数、初始选择、是否允许穿越边界TER?\n",
    "residue1_selector = ResidueIndexSelector('118')\n",
    "psn_selector.set_selector(residue1_selector)\n",
    "psn_selector.set_cross_chain_boundaries(False) #True是穿越边界TER,False是不穿越\n",
    "psn_selector.apply(pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.9.2. SSElementSelector\n",
    "二级结构元件选择器,根据设置,可以自定义选择某段二级结构的残基。用法与SecondaryStructureSelector有些差异。\n",
    "\n",
    "selection的语法结构为: “A,B,C” or “A,B”;\n",
    "\n",
    "A代表二级结构序号(H、E、L独立编码);B代表二级结构类型(H、E、L),C代表分割区段:S=Start, E=End, M=Middle。<br />\n",
    "例子1: selection=”-1,H,S” to_selection=”4,L,E” 代表选择 最后一端螺旋到第四个loop区的结尾,该区域所有的氨基酸。<br />\n",
    "例子2: selection=”3,H,S” to_selection=”4,H,E” 代表选择 第三段螺旋的开始至第四段螺旋的结尾,该区域所有的氨基酸。<br />"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mcore.import_pose.import_pose: {0} \u001b[0mFile './data/EHEE_rd4_0976.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mcore.util.metalloproteins_util: {0} \u001b[0mAutomatically setting covalent bonds between metal ions and metal-binding residues.\n",
      "\u001b[0mcore.util.metalloproteins_util: {0} \u001b[0mAutomatically setting up constraints between metal ions and metal-binding residues.\n",
      "\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: {0} \u001b[0mGenerating XML Schema for rosetta_scripts...\n",
      "\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: {0} \u001b[0m...done\n",
      "\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: {0} \u001b[0mInitializing schema validator...\n",
      "\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: {0} \u001b[0m...done\n",
      "\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: {0} \u001b[0mValidating input script...\n",
      "\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: {0} \u001b[0m...done\n",
      "\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: {0} \u001b[0mParsed script:\n",
      "<ROSETTASCRIPTS>\n",
      "\t<RESIDUE_SELECTORS>\n",
      "\t\t<SSElement chain=\"A\" name=\"SSE\" selection=\"-1,E\"/>\n",
      "\t</RESIDUE_SELECTORS>\n",
      "\t<PROTOCOLS/>\n",
      "</ROSETTASCRIPTS>\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: {0} \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: {0} \u001b[0mThe -auto_setup_metals flag was used with no metalbinding_constraint weight set in the weights file.  Setting to 1.0.\n",
      "\u001b[0mcore.scoring.etable: {0} \u001b[0mStarting energy table calculation\n",
      "\u001b[0mcore.scoring.etable: {0} \u001b[0msmooth_etable: changing atr/rep split to bottom of energy well\n",
      "\u001b[0mcore.scoring.etable: {0} \u001b[0msmooth_etable: spline smoothing lj etables (maxdis = 6)\n",
      "\u001b[0mcore.scoring.etable: {0} \u001b[0msmooth_etable: spline smoothing solvation etables (max_dis = 6)\n",
      "\u001b[0mcore.scoring.etable: {0} \u001b[0mFinished calculating energy tables.\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/PairEPotential/pdb_pair_stats_fine\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/InterchainPotential/interchain_env_log.txt\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/InterchainPotential/interchain_pair_log.txt\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/EnvPairPotential/env_log.txt\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/EnvPairPotential/cbeta_den.txt\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/EnvPairPotential/pair_log.txt\n",
      "\u001b[0mbasic.io.database: {0} \u001b[0mDatabase file opened: scoring/score_functions/EnvPairPotential/cenpack_log.txt\n",
      "\u001b[0mprotocols.rosetta_scripts.ParsedProtocol: {0} \u001b[0mParsedProtocol mover with the following settings\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1]"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# example1:selection\n",
    "from pyrosetta.rosetta.protocols import rosetta_scripts\n",
    "sheet_pose = pose_from_pdb('./data/EHEE_rd4_0976.pdb')\n",
    "sse1_selector=rosetta_scripts.XmlObjects.create_from_string('''\n",
    "<RESIDUE_SELECTORS>\n",
    "    <SSElement name=\"SSE\" selection=\"-1,E\" chain=\"A\"/>\n",
    "</RESIDUE_SELECTORS>\n",
    "''').get_residue_selector('SSE')\n",
    "sse1_selector.apply(sheet_pose)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: {0} \u001b[0mGenerating XML Schema for rosetta_scripts...\n",
      "\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: {0} \u001b[0m...done\n",
      "\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: {0} \u001b[0mInitializing schema validator...\n",
      "\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: {0} \u001b[0m...done\n",
      "\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: {0} \u001b[0mValidating input script...\n",
      "\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: {0} \u001b[0m...done\n",
      "\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: {0} \u001b[0mParsed script:\n",
      "<ROSETTASCRIPTS>\n",
      "\t<RESIDUE_SELECTORS>\n",
      "\t\t<SSElement chain=\"A\" name=\"SSE\" selection=\"1,H\" to_selection=\"2,E\"/>\n",
      "\t</RESIDUE_SELECTORS>\n",
      "\t<PROTOCOLS/>\n",
      "</ROSETTASCRIPTS>\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: {0} \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: {0} \u001b[0mThe -auto_setup_metals flag was used with no metalbinding_constraint weight set in the weights file.  Setting to 1.0.\n",
      "\u001b[0mprotocols.rosetta_scripts.ParsedProtocol: {0} \u001b[0mParsedProtocol mover with the following settings\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# example2:selection + to_selection = 选择 selection 到 to selection之间的所有残基。\n",
    "from pyrosetta.rosetta.protocols import rosetta_scripts\n",
    "sse2_selector=rosetta_scripts.XmlObjects.create_from_string('''\n",
    "<RESIDUE_SELECTORS>\n",
    "    <SSElement name=\"SSE\" selection=\"1,H\" to_selection=\"2,E\" chain=\"A\"/>\n",
    "</RESIDUE_SELECTORS>\n",
    "''').get_residue_selector('SSE')\n",
    "sse2_selector.apply(sheet_pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "####  2.9.3. SecondaryStructureSelector\n",
    "二级结构元件选择器,将所有具有某类二级结构的氨基酸选出。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mcore.select.residue_selector.SecondaryStructureSelector: {0} \u001b[0mUsing dssp for secondary structure: LEEEEELLHHHHHHHHHHHHHLLLLEEEEEELLEEEEEEL\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0]"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyrosetta.rosetta.core.select.residue_selector import SecondaryStructureSelector\n",
    "# E:beta折叠 H:α-螺旋 L:loop无规卷曲,选择所有该类型的二级结构区间。\n",
    "ss_selector = SecondaryStructureSelector('H') #选择所有的α-螺旋区域;\n",
    "ss_selector = SecondaryStructureSelector('EH') #选择所有β-折叠和α-螺旋区域;\n",
    "ss_selector.apply(sheet_pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.9.4. PairedSheetResidueSelector\n",
    "β折叠配对残基选择器,将β折叠中配对的残基对选出。<br />"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "使用这个选择器的时候需要参入比较多的人工处理成分:\n",
    "- 首先,需要使用DSSPMover将Pose的二级结构进行输出\n",
    "- 次之,需要人工检查定义Sheet的拓扑结构"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mprotocols.denovo_design.components.StructureDataFactory: {0} \u001b[0m\u001b[1m[ WARNING ]\u001b[0m -run:preserve_header is required for using \"Tomponents\" -- setting it to true. To avoid this message, include -run:preserve header true in your flags\n",
      "\u001b[0mprotocols.denovo_design.residue_selectors.PairedSheetResidueSelector: {0} \u001b[0mCould not determine strand pairings! You must specify them using the \"sheet_topology\" option or attach a StructureData object to the pose. No residues will be selected.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0]"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#example1:自动全选所有配对的残基。\n",
    "from pyrosetta.rosetta.protocols.denovo_design.residue_selectors import PairedSheetResidueSelector\n",
    "from pyrosetta.rosetta.core.select.residue_selector import SecondaryStructureSelector\n",
    "secondarystructure = SecondaryStructureSelector()\n",
    "secondarystructure.set_use_dssp(True)\n",
    "paired_sheet = PairedSheetResidueSelector()\n",
    "paired_sheet.apply(sheet_pose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可见Sheet主要分布在三个区间:'2-6','26-31','34-39'。第一段beta片与第三段是反平行的,第二段与第三段也是反平行的。\n",
    "<center><img src=\"./img/sheet_pose.png\" width = \"500\" height = \"300\" align=center /> </center>\n",
    "(图片来源: 晶泰科技团队)\n",
    "\n",
    "如果想选取特定sheet_topology的写法:format A-B.P.R <br />\n",
    "- A = stand的序号\n",
    "- B = stand的序号\n",
    "- P = 'P' for parallel and 'A' for antiparallel \n",
    "- R = register shift\n",
    "\n",
    "R是指残基的平移。平移会与parallel和antiparallel有关,并且在平移时短链会优先与长链对齐,然后再一起平移。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mstrand1=1(2,6)\n",
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mstrand2=3(34,39)\n",
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mabego=[]\n",
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mBulges1: [] Bulges2: []\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0]"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "paired_sheet = PairedSheetResidueSelector()\n",
    "paired_sheet.set_sheet_topology('1-3.A.0')\n",
    "paired_sheet.apply(sheet_pose)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mstrand1=1(2,6)\n",
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mstrand2=3(34,39)\n",
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mabego=[]\n",
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mBulges1: [] Bulges2: []\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'select rosetta_sele, (chain A and resid 2,3,4,5,6,35,36,37,38,39)'"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 可视化 所有配对的残基\n",
    "pymol_selected = SelectedResiduesPyMOLMetric()\n",
    "pymol_selected.set_residue_selector(paired_sheet)\n",
    "prefix = 'all_paired_sheet_'\n",
    "pymol_selected.apply(sheet_pose, prefix)\n",
    "paired_sm_data = get_sm_data(sheet_pose)\n",
    "string_metric = paired_sm_data.get_string_metric_data()\n",
    "string_metric['all_paired_sheet_pymol_selection']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<center><img src=\"./img/paired_sheet.png\" width = \"500\" height = \"300\" align=center /> </center>\n",
    "(图片来源: 晶泰科技团队)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**结果解读**<br />\n",
    "上图中着色为粉色的残基为选出来的配对残基,其中被选择的区域骨架有规整的氢键配对。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "当R不为0时,选择的残基会向不同的方向有所平移。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mstrand1=1(2,6)\n",
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mstrand2=3(34,39)\n",
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mabego=[]\n",
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mBulges1: [] Bulges2: []\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "vector1_bool[0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0]"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "paired_sheet = PairedSheetResidueSelector()\n",
    "paired_sheet.set_sheet_topology('1-3.A.1')\n",
    "paired_sheet.apply(sheet_pose)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mstrand1=1(2,6)\n",
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mstrand2=3(34,39)\n",
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mabego=[]\n",
      "\u001b[0mprotocols.topology.StrandPairing: {0} \u001b[0mBulges1: [] Bulges2: []\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'select rosetta_sele, (chain A and resid 3,4,5,6,36,37,38,39)'"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 可视化 所有配对的残基\n",
    "pymol_selected = SelectedResiduesPyMOLMetric()\n",
    "pymol_selected.set_residue_selector(paired_sheet)\n",
    "prefix = 'shift_all_paired_sheet_'\n",
    "pymol_selected.apply(sheet_pose, prefix)\n",
    "paired_sm_data = get_sm_data(sheet_pose)\n",
    "string_metric = paired_sm_data.get_string_metric_data()\n",
    "string_metric['shift_all_paired_sheet_pymol_selection']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<center><img src=\"./img/shtif_paired_sheet.png\" width = \"500\" height = \"300\" align=center /> </center>\n",
    "(图片来源: 晶泰科技团队)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.10. TaskSelector(想理解需要先看完第六章节)\n",
    "根据用户定义的task operator去选择残基,并且残基的选择会根据PackerTask中designable、fixed和packable的状态。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "vector1_bool[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyrosetta.rosetta.protocols.residue_selectors import TaskSelector\n",
    "from pyrosetta.rosetta.core.pack.task import TaskFactory\n",
    "tf = TaskFactory()\n",
    "task_selector = TaskSelector()\n",
    "task_selector.set_select_designable(True)\n",
    "task_selector.set_select_fixed(False)\n",
    "task_selector.set_select_packable(False)\n",
    "task_selector.set_task_factory(tf)\n",
    "task_selector.apply(pose)"
   ]
  }
 ],
 "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.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}