{ "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", "< [Working With Symmetry](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/10.00-Working-With-Symmetry.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Working With Antibodies](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/12.00-Working-With-Antibodies.ipynb) >
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Working With Density\n",
"Keywords: crystal, density, refinement, LoadDensityMapMover, map, EM, X-ray\n",
"\n",
"## Overview\n",
"\n",
"Density can be a useful tool in Rosetta and can be used to refine a PDB structure, test Rosetta structure prediction methods, and build de-novo models guided by density of different resolutions. It can also be used as an experimentally-determined guide/constraint for custom methods. \n",
"\n",
"Rosetta understands X-ray or electron density through scoring. In this tutorial, we will first walk through how to create a density file that Rosetta understands, and then load it, score it, and refine a structure using it. We will also cover some common tools used while working with density. \n",
"\n",
"More complicated protocols exist through the use of `RosettaScripts` in PyRosetta, and even more protocols through applications built using main Rosetta. We will not cover these in this introductory tutorial, but please refer to the original references listed below (such as De novo protein structure determination...) for how to run these applications. \n",
"\n",
"Note that symmetry and density can be used together!\n",
"\n",
"## Documentation\n",
"More information on Density Scoring and relavent applications can be found here:\n",
"\n",
"- https://www.rosettacommons.org/docs/latest/application_documentation/analysis/density-map-scoring\n",
"- https://www.rosettacommons.org/docs/latest/application_documentation/structure_prediction/mr-protocols\n",
"\n",
"\n",
"## References\n",
"\n",
"- _Atomic-accuracy models from 4.5-Å cryo-electron microscopy data with density-guided iterative local refinement._\n",
" - https://www.ncbi.nlm.nih.gov/pubmed/25707030\n",
" \n",
" \n",
"- _De novo protein structure determination from near-atomic-resolution cryo-EM maps._\n",
" - https://www.ncbi.nlm.nih.gov/pubmed/25707029\n",
" \n",
" \n",
"- _Tools for Model Building and Optimization into Near-Atomic Resolution Electron Cryo-Microscopy Density Maps._\n",
" - https://www.ncbi.nlm.nih.gov/pubmed/27572730\n",
" \n",
" \n",
"- _Automated structure refinement of macromolecular assemblies from cryo-EM maps using Rosetta._\n",
" - https://www.ncbi.nlm.nih.gov/pubmed/27669148\n",
" \n",
" \n",
"- _Rosetta Structure Prediction as a Tool for Solving Difficult Molecular Replacement Problems._\n",
" - https://www.ncbi.nlm.nih.gov/pubmed/28573585\n",
" \n",
" \n",
"- _RosettaES: a sampling strategy enabling automated interpretation of difficult cryo-EM maps._\n",
" - https://www.ncbi.nlm.nih.gov/pubmed/28628127\n",
" \n",
" \n",
"- _Automatically Fixing Errors in Glycoprotein Structures with Rosetta_\n",
" - https://www.ncbi.nlm.nih.gov/pubmed/30344107\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"!pip install pyrosettacolabsetup\n",
"import pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()\n",
"import pyrosetta; pyrosetta.init()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Creating a Density Map\n",
"\n",
"We won't actually do this in the tutorial as it requires a third-party application, but the (.ccp4) density map you will be using was created this way. \n",
"\n",
"1) Download and install phenix.maps: https://www.phenix-online.org/documentation/reference/maps.html \n",
"\n",
" - Make sure phenix.maps is in your path.\n",
"\n",
"2) Download the CIF file from the Protein Data Bank for the structure you are interested in.\n",
"\n",
"3) Use this command to create a map: `phenix.maps pdb_path cif_path` \n",
"\n",
" - Note that depending on the cif file and structure, you may need to rarely edit the defaults to get it work properly, especially for glycan structures. Please refer to the phenix documentation for this. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setup for Density Scoring\n",
"\n",
"Here, we will make a scorefunction and set `fast_elec_dens` to a proper value and use the `LoadDensityMapMover` to actually load the density map. Note that (currently) the density map is GLOBAL data within Rosetta - so only a single structure can be modeled/refined at a time. \n",
"\n",
"### From the docs:\n",
"\n",
"Several scoring functions have been added to Rosetta which describe how well a structure agrees to experimental density data. Density map data is read in CCP4/MRC format (the density has to minimally cover the asymmetric unit). The various scoring functions trade off speed versus accuracy, and their use should be primarily determined by the resolution of the density map data:\n",
"\n",
"- **elec\\_dens\\_fast** is recommended for most cases.\n",
"\n",
"Additionally, a slower but more precise scoring function is available. This is only recommended if **elec\\_dens\\_fast** performs poorly (for example, if map quality varies significantly throughout the map):\n",
"- **elec\\_dens\\_window** - Uses the sum of correlations of a sliding window of residues versus the experimental data; structure density only uses all heavy atoms.\n",
"\n",
"The weights to use vary depending on resolution of data but the following give reasonable ranges:\n",
"\n",
"- **elec\\_dens\\_fast**: ~25 is generally good, higher for high-resolution (<3Å) and lower for low-resolution (>6Å)\n",
"- **elec\\_dens\\_window**: ~0.2 is generally good, higher for high-resolution (<3Å) and lower for low-resolution (>6Å)\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"PyRosetta-4 2019 [Rosetta PyRosetta4.Release.python36.mac 2019.39+release.93456a567a8125cafdf7f8cb44400bc20b570d81 2019-09-26T14:24:44] retrieved from: http://www.pyrosetta.org\n",
"(C) Copyright Rosetta Commons Member Institutions. Created in JHU by Sergey Lyskov and PyRosetta Team.\n",
"\u001b[0mcore.init: \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags\n",
"\u001b[0mcore.init: \u001b[0mReading fconfig.../Users/jadolfbr/.rosetta/flags/common\n",
"\u001b[0mcore.init: \u001b[0m\n",
"\u001b[0mcore.init: \u001b[0m\n",
"\u001b[0mcore.init: \u001b[0mRosetta version: PyRosetta4.Release.python36.mac r233 2019.39+release.93456a567a8 93456a567a8125cafdf7f8cb44400bc20b570d81 http://www.pyrosetta.org 2019-09-26T14:24:44\n",
"\u001b[0mcore.init: \u001b[0mcommand: PyRosetta -ignore_unrecognized_res -load_PDB_components false -ignore_zero_occupancy false @inputs/glycan_flags -database /Users/jadolfbr/Library/Python/3.6/lib/python/site-packages/pyrosetta-2019.39+release.93456a567a8-py3.6-macosx-10.6-intel.egg/pyrosetta/database\n",
"\u001b[0mbasic.random.init_random_generator: \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=-370139418 seed_offset=0 real_seed=-370139418\n",
"\u001b[0mbasic.random.init_random_generator: \u001b[0mRandomGenerator:init: Normal mode, seed=-370139418 RG_type=mt19937\n"
]
}
],
"source": [
"from pyrosetta import *\n",
"from pyrosetta.rosetta import *\n",
"from pyrosetta.teaching import *\n",
"import os\n",
"\n",
"init('-ignore_unrecognized_res -load_PDB_components false -ignore_zero_occupancy false @inputs/glycan_flags')"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0mcore.import_pose.import_pose: \u001b[0mFile 'inputs/1jnd.pdb' automatically determined to be of type PDB\n",
"\u001b[0mcore.io.pdb.pdb_reader: \u001b[0mParsing 82 .pdb records with unknown format to search for Rosetta-specific comments.\n",
"\u001b[0mcore.io.util: \u001b[0mAutomatic glycan connection is activated.\n",
"\u001b[0mcore.io.util: \u001b[0mStart reordering residues.\n",
"\u001b[0mcore.io.util: \u001b[0mCorrected glycan residue order (internal numbering): [401, 402, 403, 404]\n",
"\u001b[0mcore.io.util: \u001b[0m\n",
"\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mSetting chain termination for 404\n",
"\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m Glc401 has an unfavorable ring conformation; the coordinates for this input structure may have been poorly assigned.\n",
"\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m Glc402 has an unfavorable ring conformation; the coordinates for this input structure may have been poorly assigned.\n",
"\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m Man403 has an unfavorable ring conformation; the coordinates for this input structure may have been poorly assigned.\n",
"\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m Man404 has an unfavorable ring conformation; the coordinates for this input structure may have been poorly assigned.\n",
"\u001b[0mcore.chemical.AtomICoor: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m IcoorAtomID::atom_id(): Cannot get atom_id for POLYMER_LOWER of residue ->4)-beta-D-Glcp:2-AcNH 401. Returning BOGUS ID instead.\n",
"\u001b[0mcore.conformation.Residue: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing an atom: 401 H1 that depends on a nonexistent polymer connection!\n",
"\u001b[0mcore.conformation.Residue: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m --> generating it using idealized coordinates.\n",
"\u001b[0mcore.chemical.AtomICoor: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m IcoorAtomID::atom_id(): Cannot get atom_id for POLYMER_LOWER of residue ->4)-beta-D-Glcp:2-AcNH 401. Returning BOGUS ID instead.\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0mFound disulfide between residues 5 32\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 5 CYS\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 32 CYS\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 5 CYD\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 32 CYD\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0mFound disulfide between residues 302 385\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 302 CYS\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 385 CYS\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 302 CYD\n",
"\u001b[0mcore.conformation.Conformation: \u001b[0mcurrent variant for 385 CYD\n",
"\u001b[0mcore.conformation.carbohydrates.GlycanTreeSet: \u001b[0mSetting up Glycan Trees\n",
"\u001b[0mcore.conformation.carbohydrates.GlycanTreeSet: \u001b[0mFound 1 glycan trees.\n",
"\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: \u001b[0mGenerating XML Schema for rosetta_scripts...\n",
"\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: \u001b[0m...done\n",
"\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: \u001b[0mInitializing schema validator...\n",
"\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: \u001b[0m...done\n",
"\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: \u001b[0mValidating input script...\n",
"\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: \u001b[0m...done\n",
"\u001b[0mprotocols.rosetta_scripts.RosettaScriptsParser: \u001b[0mParsed script:\n",
" "
]
}
],
"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.1"
},
"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": 1
}