Skip to content

Instantly share code, notes, and snippets.

@ajasja
Created June 27, 2014 11:04
Show Gist options
  • Save ajasja/1b8217a29b54a4e8d507 to your computer and use it in GitHub Desktop.
Save ajasja/1b8217a29b54a4e8d507 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"worksheets": [
{
"cells": [
{
"metadata": {},
"cell_type": "code",
"input": "import os\nimport numpy as np\nimport rosetta as r\nimport random\nr.init()\nr.__version__\n",
"prompt_number": 13,
"outputs": [
{
"output_type": "pyout",
"prompt_number": 13,
"metadata": {},
"text": "'56891:56891:6efc58f8abb54611ace5a6cdd7e69e6c970a01ef'"
}
],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "code",
"input": "pmm = r.PyMOLMover(target_host=\"localhost\")",
"prompt_number": 31,
"outputs": [],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "code",
"input": "#This works normally\n#Create sequence \nseq = 'R'*5 + 'R'+'R'*5; print seq\npose = r.pose_from_sequence(seq, res_type=\"fa_standard\") \nscorefxn = r.get_fa_scorefxn()\n\n#Create perfect alpha helix\n#phi = -57.8, Psi -47.0\nfor i in range(1, pose.total_residue()+1):\n pose.set_phi(i, -57.9)\n pose.set_psi(i, -47.9)\n\n#pack side chains\npacker_task = r.standard_packer_task(pose)\npacker_task.restrict_to_repacking() \nprint packer_task\npack_mover = r.PackRotamersMover(scorefxn, packer_task) \npack_mover.apply(pose) \n\n#show the resuls\npmm.apply(pose)\nprint scorefxn(pose)",
"prompt_number": 15,
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": "RRRRRRRRRRR\n#Packer_Task\n\nresid\tpack?\tdesign?\tallowed_aas\n1\tTRUE\tFALSE\tARG:NtermProteinFull\n2\tTRUE\tFALSE\tARG\n3\tTRUE\tFALSE\tARG\n4\tTRUE\tFALSE\tARG\n5\tTRUE\tFALSE\tARG\n6\tTRUE\tFALSE\tARG\n7\tTRUE\tFALSE\tARG\n8\tTRUE\tFALSE\tARG\n9\tTRUE\tFALSE\tARG\n10\tTRUE\tFALSE\tARG\n11\tTRUE\tFALSE\tARG:CtermProteinFull\n\n0.50116673879"
},
{
"output_type": "stream",
"stream": "stdout",
"text": "\n"
}
],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "markdown",
"source": "And I get a nice alpha-helix: <img src=\"http://snag.gy/SqFon.jpg\">\n"
},
{
"metadata": {},
"cell_type": "code",
"input": "#This fails\n#Create sequence \nseq = 'R'*5 + 'Z[R1A]'+'R'*5; print seq\npose = r.pose_from_sequence(seq, res_type=\"fa_standard\") \nscorefxn = r.get_fa_scorefxn()\nprint pose\n#Create perfect alpha helix\n#phi = -57.8, Psi -47.0\nfor i in range(1, pose.total_residue()+1):\n pose.set_phi(i, -57.9)\n pose.set_psi(i, -47.9)\n\n#pack side chains\npacker_task = r.standard_packer_task(pose)\npacker_task.restrict_to_repacking() \nprint packer_task\npack_mover = r.PackRotamersMover(scorefxn, packer_task) \npack_mover.apply(pose) \n\n#show the resuls\npmm.apply(pose)\nprint scorefxn(pose)",
"prompt_number": 27,
"outputs": [
{
"output_type": "stream",
"text": "RRRRRZ[R1A]RRRRR\nPDB file name: RRRRRZ[R\nTotal residues:11\nSequence: RRRRRZRRRRR\nFold tree:\nFOLD_TREE EDGE 1 5 -1 EDGE 1 6 1 EDGE 1 7 2 EDGE 7 11 -1 \n\n#Packer_Task\n\nresid\tpack?\tdesign?\tallowed_aas\n1\tTRUE\tFALSE\tARG:NtermProteinFull\n2\tTRUE\tFALSE\tARG\n3\tTRUE\tFALSE\tARG\n4\tTRUE\tFALSE\tARG\n5\tTRUE\tFALSE\tARG\n6\tTRUE\tFALSE\tR1A\n7\tTRUE\tFALSE\tARG\n8\tTRUE\tFALSE\tARG\n9\tTRUE\tFALSE\tARG\n10\tTRUE\tFALSE\tARG\n11\tTRUE\tFALSE\tARG:CtermProteinFull\n\n70709.4001028",
"stream": "stdout"
},
{
"output_type": "stream",
"text": "\n",
"stream": "stdout"
}
],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "markdown",
"source": "Here only half an alpha helix is created:\n<img src=\"http://snag.gy/82RTz.jpg\">"
},
{
"metadata": {},
"cell_type": "code",
"input": "#Makin a mutation after the helix is created also works\n#Create sequence \nseq = 'R'*5 + 'R'+'R'*5; print seq\npose = r.pose_from_sequence(seq, res_type=\"fa_standard\") \nscorefxn = r.get_fa_scorefxn()\n\n#Create perfect alpha helix\n#phi = -57.8, Psi -47.0\nfor i in range(1, pose.total_residue()+1):\n pose.set_phi(i, -57.9)\n pose.set_psi(i, -47.9)\n\n#Make mutation \nmut = r.MutateResidue(6 , 'R1A')\nmut.apply(pose) \n \n#pack side chains\npacker_task = r.standard_packer_task(pose)\npacker_task.restrict_to_repacking() \nprint packer_task\npack_mover = r.PackRotamersMover(scorefxn, packer_task) \npack_mover.apply(pose) \n\n#show the resuls\nprint scorefxn(pose)\npmm.apply(pose)",
"prompt_number": 24,
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": "RRRRRRRRRRR\n#Packer_Task\n\nresid\tpack?\tdesign?\tallowed_aas\n1\tTRUE\tFALSE\tARG:NtermProteinFull\n2\tTRUE\tFALSE\tARG\n3\tTRUE\tFALSE\tARG\n4\tTRUE\tFALSE\tARG\n5\tTRUE\tFALSE\tARG\n6\tTRUE\tFALSE\tR1A\n7\tTRUE\tFALSE\tARG\n8\tTRUE\tFALSE\tARG\n9\tTRUE\tFALSE\tARG\n10\tTRUE\tFALSE\tARG\n11\tTRUE\tFALSE\tARG:CtermProteinFull\n\n-1.23751339249"
},
{
"output_type": "stream",
"stream": "stdout",
"text": "\n"
}
],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "markdown",
"source": "<img src=http://snag.gy/auJAR.jpg>"
},
{
"metadata": {},
"cell_type": "code",
"input": "#An alternative way is also to directly replace the residue\n\n#Create sequence \nseq = 11*'R'; print seq\npose = r.pose_from_sequence(seq, res_type=\"fa_standard\") \nscorefxn = r.get_fa_scorefxn()\n\nr1a_pose = r.pose_from_sequence(\"Z[R1A]\", res_type=\"fa_standard\")\nr1a_res = r1a_pose.residue(1)\n#Replace position 6 with the residue, orienting it on the backbone\npose.replace_residue(6, r1a_res, True)\n\nprint pose\n#Create perfect alpha helix\n#phi = -57.8, Psi -47.0\nfor i in range(1, pose.total_residue()+1):\n pose.set_phi(i, -57.9)\n pose.set_psi(i, -47.9)\n\n \n#pack side chains\npacker_task = r.standard_packer_task(pose)\npacker_task.restrict_to_repacking() \nprint packer_task\npack_mover = r.PackRotamersMover(scorefxn, packer_task) \npack_mover.apply(pose) \n\n#show the resuls\nprint scorefxn(pose)\npmm.apply(pose)",
"prompt_number": 30,
"outputs": [
{
"output_type": "stream",
"text": "RRRRRRRRRRR\nPDB file name: RRRRRRRR\nTotal residues:11\nSequence: RRRRRZRRRRR\nFold tree:\nFOLD_TREE EDGE 1 11 -1 \n\n#Packer_Task\n\nresid\tpack?\tdesign?\tallowed_aas\n1\tTRUE\tFALSE\tARG:NtermProteinFull\n2\tTRUE\tFALSE\tARG\n3\tTRUE\tFALSE\tARG\n4\tTRUE\tFALSE\tARG\n5\tTRUE\tFALSE\tARG\n6\tTRUE\tFALSE\tR1A\n7\tTRUE\tFALSE\tARG\n8\tTRUE\tFALSE\tARG\n9\tTRUE\tFALSE\tARG\n10\tTRUE\tFALSE\tARG\n11\tTRUE\tFALSE\tARG:CtermProteinFull\n\n-1.05767090815",
"stream": "stdout"
},
{
"output_type": "stream",
"text": "\n",
"stream": "stdout"
}
],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "markdown",
"source": "<img src=http://snag.gy/TUARf.jpg>"
}
],
"metadata": {}
}
],
"metadata": {
"gist_id": "1b8217a29b54a4e8d507",
"name": "",
"signature": "sha256:0ce45a9140e7fa6783c85e41ec222d0901dc59c12c2e4ed4a799cf5df5409ec4"
},
"nbformat": 3
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment