Created
June 21, 2014 18:56
-
-
Save ajasja/2936e87eb7dfcc0c2c46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:209fc012ce7b2a7865aaa288babd0359605ac9b0a32806c91d358560d3a9cd90" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"import os\n", | |
"import numpy as np\n", | |
"import rosetta as r\n", | |
"import random\n", | |
"r.init()\n", | |
"os.getcwd()" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 25, | |
"text": [ | |
"'/home/ajasja/notebooks'" | |
] | |
} | |
], | |
"prompt_number": 25 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"pose = r.pose_from_sequence('A'*10) \n", | |
"scorefxn = r.get_fa_scorefxn() " | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 18 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"#pmm = r.PyMOLMover(target_host=\"XXXXX\")\n", | |
"pmm = r.PyMOLMover(target_host=\"localhost\")" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 19 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"pose.set_psi(random.randint(1,10),(random.random()-0.5)*180)\n", | |
"pose.set_phi(random.randint(1,10),(random.random()-0.5)*180)\n", | |
"print scorefxn(pose)\n", | |
"pmm.apply(pose)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"27.0474905598\n" | |
] | |
} | |
], | |
"prompt_number": 20 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"pose.set_psi(5,-50)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 21 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"print scorefxn(pose)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"27.8830412834\n" | |
] | |
} | |
], | |
"prompt_number": 22 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"#test the scoring\n", | |
"import time\n", | |
"import random\n", | |
"\n", | |
"start = time.time()\n", | |
"minscore = +100000000 \n", | |
"numrun=10000;\n", | |
"for i in xrange(numrun):\n", | |
" pose.set_psi(random.randint(1,10),(random.random()-0.5)*180)\n", | |
" pose.set_phi(random.randint(1,10),(random.random()-0.5)*180)\n", | |
" score = scorefxn(pose)\n", | |
" if score<minscore:\n", | |
" minscore=score\n", | |
"\n", | |
"end = time.time()\n", | |
"elapsed = end - start\n", | |
"print \"Time taken: \", elapsed, \"seconds.\"\n", | |
"print \"Min Score is: \", minscore\n", | |
"print \"Time per run: \", elapsed*1000.0/numrun, \"msec\"" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"Time taken: 2.63420510292 seconds.\n", | |
"Min Score is: 16.4718879927\n", | |
"Time per run: 0.263420510292 msec\n" | |
] | |
} | |
], | |
"prompt_number": 23 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"#test only the loops\n", | |
"import time\n", | |
"import random\n", | |
"\n", | |
"start = time.time()\n", | |
"minscore = +100000000 \n", | |
"numrun=10000;\n", | |
"for i in xrange(numrun):\n", | |
" pass\n", | |
" random.randint(1,10); (random.random()-0.5)*180;\n", | |
" random.randint(1,10);score=(random.random()-0.5)*180;\n", | |
" #score = scorefxn(pose)\n", | |
" if score<minscore:\n", | |
" minscore=score\n", | |
"\n", | |
"end = time.time()\n", | |
"elapsed = end - start\n", | |
"print \"Time taken: \", elapsed, \"seconds.\"\n", | |
"print \"Min Score is: \", minscore\n", | |
"print \"Time per run: \", elapsed*1000.0/numrun, \"msec\"" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"Time taken: 0.0392308235168 seconds.\n", | |
"Min Score is: -89.9782554597\n", | |
"Time per run: 0.00392308235168 msec\n" | |
] | |
} | |
], | |
"prompt_number": 24 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
" r.mm_twist?" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 26 | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment