{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "*This notebook contains material from [PyRosetta](https://RosettaCommons.github.io/PyRosetta.notebooks);\n", "content is available [on Github](https://github.com/RosettaCommons/PyRosetta.notebooks.git).*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Pose Basics](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/02.01-Pose-Basics.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Accessing PyRosetta Documentation](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/02.03-Accessing-PyRosetta-Documentation.ipynb) >

\"Open" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Working with Pose residues\n", "Keywords: total_residue(), chain(), number(), pdb2pose(), pose2pdb()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "!pip install pyrosettacolabsetup\n", "import pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()\n", "import pyrosetta; pyrosetta.init()\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "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/MyDrive/student-notebooks/`" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "pose = pose_from_pdb(\"inputs/5tj3.pdb\")\n", "pose_clean = pose_from_pdb(\"inputs/5tj3.clean.pdb\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " We can use methods in `Pose` to count residues and pick out residues from the pose. Remember that `Pose` is a python class, and to access methods it implements, you need an instance of the class (here `pose` or `pose_clean`) and you then use a dot after the instance." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(pose.total_residue())\n", "print(pose_clean.total_residue())\n", "# Did you catch all the missing residues before?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Store the `Residue` information for residue 20 of the pose by using the `pose.residue(20)` function." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "deletable": false, "nbgrader": { "cell_type": "code", "checksum": "517be4c287f331935aa68474e44133ca", "grade": true, "grade_id": "cell-b4a65f9eb1e72d02", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [], "source": [ "# residue20 = type here\n", "YOUR-CODE-HERE\n", "print(residue20.name())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 2: Residue objects\n", "\n", "Use the `pose`'s `.residue()` object to get the 24th residue of the protein pose. What is the 24th residue in the PDB file (look in the PDB file)? Are they the same residue?" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "code_folding": [], "deletable": false, "nbgrader": { "cell_type": "code", "checksum": "bf87a933c6c05ae5644d680dde256d88", "grade": true, "grade_id": "cell-0b423c45607a85e0", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [], "source": [ "# store the 24th residue in the pose into a variable (see residue20 example above)\n", "YOUR-CODE-HERE\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "code_folding": [] }, "outputs": [], "source": [ "# what other methods are attached to that Residue object? (type \"residue24.\" and hit Tab to see a list of commands)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can immediately see that the numbering PyRosetta internally uses for pose residues is different from the PDB file. The information corresponding to the PDB file can be accessed through the `pose.pdb_info()` object." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(pose.pdb_info().chain(24))\n", "print(pose.pdb_info().number(24))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "By using the `pdb2pose` method in `pdb_info()`, we can turn PDB numbering (which requires a chain ID and a residue number) into Pose numbering" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "code_folding": [] }, "outputs": [], "source": [ "# PDB numbering to Pose numbering\n", "print(pose.pdb_info().pdb2pose('A', 24))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Use the `pose2pdb` method in `pdb_info()` to see what is the corresponding PDB chain and residue ID for pose residue number 24" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "code_folding": [] }, "outputs": [], "source": [ "# Pose numbering to PDB numbering" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "deletable": false, "nbgrader": { "cell_type": "code", "checksum": "0fa3011798ed6c16ec76a9edf540aa3f", "grade": true, "grade_id": "cell-eb3b845928c9313f", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [], "source": [ "YOUR-CODE-HERE" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we can see how to examine the identity of a residue by PDB chain and residue number.\n", "\n", "Once we get a residue, there are various methods in the `Residue` class that might be for running analysis. We can get instances of the `Residue` class from `Pose`. For instance, we can do the following:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "res_24 = pose.residue(24)\n", "print(res_24.name())\n", "print(res_24.is_charged())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Pose Basics](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/02.01-Pose-Basics.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Accessing PyRosetta Documentation](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/02.03-Accessing-PyRosetta-Documentation.ipynb) >

\"Open" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.11.6" }, "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": 4 }