Keywords: crystal, density, refinement, LoadDensityMapMover, map, EM, X-ray
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.
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.
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.
Note that symmetry and density can be used together!
More information on Density Scoring and relavent applications can be found here:
Atomic-accuracy models from 4.5-Å cryo-electron microscopy data with density-guided iterative local refinement.
De novo protein structure determination from near-atomic-resolution cryo-EM maps.
Tools for Model Building and Optimization into Near-Atomic Resolution Electron Cryo-Microscopy Density Maps.
Automated structure refinement of macromolecular assemblies from cryo-EM maps using Rosetta.
Rosetta Structure Prediction as a Tool for Solving Difficult Molecular Replacement Problems.
RosettaES: a sampling strategy enabling automated interpretation of difficult cryo-EM maps.
Automatically Fixing Errors in Glycoprotein Structures with Rosetta
!pip install pyrosettacolabsetup
import pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()
import pyrosetta; pyrosetta.init()
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.
Download the CIF file from the Protein Data Bank for the structure you are interested in.
Use this command to create a map: phenix.maps pdb_path cif_path
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.
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:
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):
The weights to use vary depending on resolution of data but the following give reasonable ranges:
from pyrosetta import *
from pyrosetta.rosetta import *
from pyrosetta.teaching import *
import os
init('-ignore_unrecognized_res -load_PDB_components false -ignore_zero_occupancy false @inputs/glycan_flags')
from rosetta.protocols.cryst import *
from rosetta.protocols.rosetta_scripts import *
p = pose_from_pdb('inputs/1jnd.pdb')
original = p.clone()
#The LoadDensityMapMover unfortunately does not have getters and setters yet.
# This has been updated in the Rosetta C++ code, but for now, we have to use the XML interface.
#setup_dens = LoadDensityMapMover("inputs/1jnd_2mFo-DFc_map.ccp4")
setup_dens = XmlObjects.static_get_mover('<LoadDensityMap name="loaddens" mapfile="inputs/1jnd_2mFo-DFc_map.ccp4"/>')
setup_dens.apply(p)
Now, we need to set the pose up for density scoring. The SetupForDensityScoring
mover sets a specific foldtree to the pose to allow scoring properly. We will then load a scorefunction with our density scoreterm, and load a pre-refined pose that was refined into the density using the pareto-optimal protocol with density.
setup_dens_pose = rosetta.protocols.electron_density.SetupForDensityScoringMover()
ref = pose_from_pdb('inputs/1jnd_refined.pdb.gz')
setup_dens_pose.apply(p)
setup_dens_pose.apply(ref)
score = get_score_function()
score_dens = get_score_function()
score_dens.set_weight(rosetta.core.scoring.elec_dens_fast, 25)
print("crystal", score_dens(p))
print("refined", score_dens(ref))
Now lets minimize our pose.
minmover = MinMover()
mm = MoveMap()
mm.set_bb(True)
mm.set_chi(True)
minmover.set_movemap(mm)
if not os.getenv("DEBUG"):
for i in range(1, 5):
minmover.apply(p)
print(score_dens.score(p))
Why has the score gotten worse here?? Because we are minimizing in dihedral space instead of cartesian space - so we make certain energies better, but crystal refinement works best in cartesian space. Lets now minimize in cartesian and see what happens.
p = original.clone()
setup_dens_pose.apply(p)
score_dens_cart = create_score_function("ref2015_cart")
score_dens_cart.set_weight(rosetta.core.scoring.elec_dens_fast, 25)
#Set Bondlengths and angles to true. This is easier and more straightforward to do if using a MoveMapFactory.
mm.set(rosetta.core.id.THETA, True)
minmover.cartesian(True)
minmover.score_function(score_dens_cart)
minmover.set_movemap(mm)
if not os.getenv("DEBUG"):
for i in range(1, 5):
minmover.apply(p)
(print(score_dens.score(p)))
Is this closer to the pre-refined model (which was pre-refined in Relax)? Do they fit the density better? Are they much more within the density? How does the glycan density compare to the full protein density?
That should get you started using density with typical Rosetta modeling tasks! See the references for more complex protocols.
Chapter contributors: