{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "*This notebook contains material from [PyRosetta](https://RosettaCommons.github.io/PyRosetta);\n", "content is available [on Github](https://github.com/RosettaCommons/PyRosetta.notebooks.git).*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Working with Pose residues](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/02.02-Working-with-Pose-Residues.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Getting spatial features from a Pose](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/02.04-Getting-Spatial-Features-from-Pose.ipynb) >
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Accessing PyRosetta Documentation\n",
"Keywords: help()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Notebook setup\n",
"import sys\n",
"if 'google.colab' in sys.modules:\n",
" !pip install pyrosettacolabsetup\n",
" import pyrosettacolabsetup\n",
" pyrosettacolabsetup.setup()\n",
" print (\"Notebook is set for PyRosetta use in Colab. Have fun!\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0mcore.init: \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags\n",
"\u001b[0mcore.init: \u001b[0mRosetta version: PyRosetta4.Release.python36.mac r208 2019.04+release.fd666910a5e fd666910a5edac957383b32b3b4c9d10020f34c1 http://www.pyrosetta.org 2019-01-22T15:55:37\n",
"\u001b[0mcore.init: \u001b[0mcommand: PyRosetta -ex1 -ex2aro -database /Users/kathyle/Computational Protein Prediction and Design/PyRosetta4.Release.python36.mac.release-208/pyrosetta/database\n",
"\u001b[0mcore.init: \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=-261722691 seed_offset=0 real_seed=-261722691\n",
"\u001b[0mcore.init.random: \u001b[0mRandomGenerator:init: Normal mode, seed=-261722691 RG_type=mt19937\n"
]
}
],
"source": [
"from pyrosetta import *\n",
"init()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**From previous section:**\n",
"Make sure you are in the directory with the pdb files:\n",
"\n",
"`cd google_drive/My\\ Drive/student-notebooks/`"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mFinished initializing fa_standard residue type set. Created 696 residue types\n",
"\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mTotal time to initialize 0.972394 seconds.\n",
"\u001b[0mcore.import_pose.import_pose: \u001b[0mFile 'inputs/5tj3.pdb' automatically determined to be of type PDB\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CG on residue LYS 233\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CD on residue LYS 233\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CE on residue LYS 233\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: NZ on residue LYS 233\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CG on residue ASP 350\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: OD1 on residue ASP 350\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: OD2 on residue ASP 350\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CG on residue LYS 353\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CD on residue LYS 353\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CE on residue LYS 353\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: NZ on residue LYS 353\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CG on residue GLU 354\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CD on residue GLU 354\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: OE1 on residue GLU 354\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: OE2 on residue GLU 354\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CG on residue LYS 382\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CD on residue LYS 382\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CE on residue LYS 382\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: NZ on residue LYS 382\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CG on residue TYR 454\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CD1 on residue TYR 454\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CD2 on residue TYR 454\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CE1 on residue TYR 454\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CE2 on residue TYR 454\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: CZ on residue TYR 454\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: OH on residue TYR 454\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom: OXT on residue GLY:CtermProteinFull 520\n",
"\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 233 because of missing atom number 6 atom name CG\n",
"\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 350 because of missing atom number 6 atom name CG\n",
"\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 353 because of missing atom number 6 atom name CG\n",
"\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 354 because of missing atom number 6 atom name CG\n",
"\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 382 because of missing atom number 6 atom name CG\n",
"\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 454 because of missing atom number 6 atom name CG\n",
"\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line()\n",
"\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
"\u001b[0mcore.scoring.etable: \u001b[0mStarting energy table calculation\n",
"\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: changing atr/rep split to bottom of energy well\n",
"\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing lj etables (maxdis = 6)\n",
"\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing solvation etables (max_dis = 6)\n",
"\u001b[0mcore.scoring.etable: \u001b[0mFinished calculating energy tables.\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBPoly1D.csv\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBFadeIntervals.csv\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBEval.csv\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/DonStrength.csv\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/AccStrength.csv\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/all.ramaProb\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/prepro.ramaProb\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.all.txt\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.gly.txt\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.pro.txt\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.valile.txt\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA_n\n",
"\u001b[0mcore.scoring.P_AA: \u001b[0mshapovalov_lib::shap_p_aa_pp_smooth_level of 1( aka low_smooth ) got activated.\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/shapovalov/10deg/kappa131/a20.prop\n",
"\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/elec_cp_reps.dat\n",
"\u001b[0mcore.scoring.elec.util: \u001b[0mRead 40 countpair representative atoms\n",
"\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib_fixes_enable option is true.\n",
"\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib::shap_dun10_smooth_level of 1( aka lowest_smooth ) got activated.\n",
"\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mBinary rotamer library selected: /Users/kathyle/Computational Protein Prediction and Design/PyRosetta4.Release.python36.mac.release-208/pyrosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin\n",
"\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mUsing Dunbrack library binary file '/Users/kathyle/Computational Protein Prediction and Design/PyRosetta4.Release.python36.mac.release-208/pyrosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin'.\n",
"\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mDunbrack 2010 library took 0.325361 seconds to load from binary\n",
"\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 90 rotamers at 6 positions.\n",
"\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n"
]
}
],
"source": [
"pose = pose_from_pdb(\"inputs/5tj3.pdb\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"One benefit of working within Jupyter notebooks is that we can make use of its autocomplete features. To see an example, try typing `res_24.is_` and pressing `tab` to find other features of residues you can examine. Note that you can scroll down to see more features."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now that we've looked through those functions, we know how to confirm that PyRosetta has loaded in the zinc ions as metal ions. "
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"zn_resid = pose.pdb_info().pdb2pose('A', 601)\n",
"res_zn = pose.residue(zn_resid) \n",
"res_zn.is_metal() "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercise 3: Python Object Help\n",
"We can also explore documentation for objects and methods from Jupyter notebooks. Say you wanted to find out more about the Pose object. Try typing in `Pose?`, `?Pose` or `help(Pose)`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"By the way, now if you ever go on to develop some PyRosetta functions, you can see the importance of docstrings!\n",
"\n",
"This works for PyRosetta methods as well:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"res_24 = pose.residue(24)\n",
"\n",
"# Uncomment this line:\n",
"# res_24.atom_index?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercise 4: Some residue commands\n",
"\n",
"Now use the `atom_index` method and the method below to find out whether the \"CA\" atom in res_24 is a backbone atom. "
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"# Uncomment this line:\n",
"# res_24.atom_is_backbone?"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"nbgrader": {
"grade": true,
"grade_id": "cell-64267b10056ef3b7",
"locked": false,
"points": 0,
"schema_version": 1,
"solution": true
}
},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"### BEGIN SOLUTION\n",
"res_24.atom_is_backbone(res_24.atom_index(\"CA\"))\n",
"### END SOLUTION"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"< [Working with Pose residues](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/02.02-Working-with-Pose-Residues.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Getting spatial features from a Pose](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/02.04-Getting-Spatial-Features-from-Pose.ipynb) >
"
]
}
],
"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.6.0"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}