Skip to content

Instantly share code, notes, and snippets.

@asford
Created November 26, 2014 20:56
Show Gist options
  • Save asford/11f20e9761f1c4d3ea9d to your computer and use it in GitHub Desktop.
Save asford/11f20e9761f1c4d3ea9d to your computer and use it in GitHub Desktop.
Example rosetta constraint IO.
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:cbe2d6f35b5c9293641cf9427d231442fc7aa841b38dfd2f29912dc1c3e21f8e"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"import rosetta\n",
"rosetta.init()\n",
"import rosetta.core"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from rosetta.utility import ostream\n",
"import sys"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"test_pose = rosetta.pose_from_sequence(\"TESTTESTTEST\")"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cs = test_pose.constraint_set()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cs.show_definition( ostream(sys.stdout), test_pose)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import rosetta.core.scoring.constraints\n",
"import rosetta.core.scoring.func\n",
"from rosetta.core.id import AtomID, DOF_ID, DOF_Type\n",
"\n",
"from rosetta.core.scoring.constraints import AtomPairConstraint, DOF_Constraint\n",
"from rosetta.core.scoring.func import HarmonicFunc"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"atom_pair = rosetta.core.scoring.constraints.AtomPairConstraint( AtomID(1, 1), AtomID(2, 1), HarmonicFunc(1, 1) )"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 7
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"test_pose.add_constraint( atom_pair )"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 8,
"text": [
"<rosetta.core.scoring.constraints.__constraints_all_at_once_.AtomPairConstraint at 0x45dbc20>"
]
}
],
"prompt_number": 8
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"test_pose.constraint_set().show_definition( ostream(sys.stdout), test_pose )"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"AtomPair N 1 CA 1 HARMONIC 1 1\n"
]
}
],
"prompt_number": 9
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment