PyRosetta (7) Side Chain Packing & Designing

PyRosetta (7): Side Chain Packing & Designing

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Python
from pyrosetta import *
from pyrosetta.rosetta import *
from pyrosetta.teaching import *

# Core Includes
from pyrosetta.rosetta.core.kinematics import MoveMap
from pyrosetta.rosetta.core.kinematics import FoldTree
from pyrosetta.rosetta.core.pack.task import TaskFactory
## The operations of a TaskFactory:
from pyrosetta.rosetta.core.pack.task import operation
from pyrosetta.rosetta.core.simple_metrics import metrics
from pyrosetta.rosetta.core.select import residue_selector as selections
from pyrosetta.rosetta.core import select
from pyrosetta.rosetta.core.select.movemap import *

# Protocol Includes
from pyrosetta.rosetta.protocols import minimization_packing as pack_min
from pyrosetta.rosetta.protocols import relax as rel
from pyrosetta.rosetta.protocols.antibody.residue_selector import CDRResidueSelector
from pyrosetta.rosetta.protocols.antibody import *
from pyrosetta.rosetta.protocols.loops import *
from pyrosetta.rosetta.protocols.relax import FastRelax

https://docs.rosettacommons.org/docs/latest/full-options-list

Basic Concepts

Terms of pose operations

  1. “Folding”: Folding of the backbone, optimizing values of $ \phi $and $ \psi $and $ \omega $.
  2. “Packing”: Packing of the side chains of residues, optimizing values of $ \chi $etc.
  3. “Designing”: Designing of the protein sequence, optimizing the total energy by changing the identities of amino acids.
    (e.g. substitute an Arg with a Gly).

Monte Carlo simulation is the most basic and classic folding algorithm.

The basic process of the Monte Carlo simulation is shared by all folding, packing and design process.

Basic Folding Process using Monte Carlo simulation

Note | PyRosetta Basics (6): Mover

Making a trial move

Apply a move (change) to the pose (structure).

Scoring the move

Compare the energy scores before and after the move.

(Therefore, the pose should be cloned as a backup before the move.)

And, compare the energy score after the move and the lowest energy score in history.

If the score after this move is the lowest, store the pose after this move as the best pose, and renew the lowest energy score in history.

Desiding whether or not to accept the move: Metropolis criterion

For the decision step, we need to make a subroutine that either accepts or rejects the new conformatuon based on the Metropolis criterion.

The difference between the energy scores after (t+1) and before (t) a move is .

The Metropolis criterion has a probability of accepting a move as .

When , the Metropolis criterion probability of accepting the move is .

When , the Metropolis criterion probability of accepting the move is .

Use .

If the move is accepted, the pose after the move will be used for the next round of trial move.

If not, the pose before the move will be used for the next round of trial move.

Iterations

For each iteration, the 3 steps above are excuted.

The final output of this program should be the lowest energy conformation that is achieved at any point during the simulation.

NOTICE: Search "greedy algorithm" and "Monte Carlo" for more information about the algorithm design.

### Simulated annealing Simulated anealing refer to the ramping of temperature `kT`in Python looping.
  1. Set a high initial temperature, so that more barriers can be easily overcome.
  2. By gradually decreasing the temperarture after each Python loop, the barriers becomes harder to overcome, and the search range gradually narrows down to a local minimum.
  3. In this process, after a period of “heated” (active) searching across the energy landscape, the energy of a pose is expected to be gradually trapped in a deep trough (valley), which is a reliable local energy minimum (a possible global minimum).

Simulated relaxing

Simulated relaxing refer to the ramping of energy score E(and the differences between scores delta_E) in Python looping.

  1. Set a small initial weight of an energy term, so that the free energy (and the barriers) are underestimated, and thus the energy barriers are easier to be overcome.
  2. By gradually increasing the weight after each Python loop, the energy estimation becomes more realistic, and the search range gradually narrows down to a local minimum.
  3. In this process, after a period of the “relaxed” (loose) evaluation, energy of a pose is expected to be gradually trapped in a deep trough (valley), which is a reliable local energy minimum (a possible global minimum).

Introduction to Packing

“Packing” is the process of optimizing the conformation of side chains (values of $ \chi_{n} $and other angles).

The “packer“ is a subset of _movers that apply packing operations to a pose.

We use “task operations” to configure the behaviors of packers:

  • The “task operations” are provided to a TaskFactoryobject.
  • The TaskFactory is then passed to a packer.

init():Initialize From Rosetta Commandline

We can change some defalt Rosetta (C++) commandline settings through

1
pyrosetta.rosetta.init()

E.g.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# we can change some defalt settings through
# pyrosetta.rosetta.init()
# or, write as:
# pyrosetta.init()
# For example
init('-use_input_sc -input_ab_scheme AHo_Scheme -ignore_unrecognized_res \
-ignore_zero_occupancy false -load_PDB_components false -relax:default_repeats 5 -no_fconfig')

'''
In this initialization, we
1. input the scheme for antibody nomenclature;
2. use the PDB ligand definitions to load all standard residue descriptions;
3. keep the relax mode as `FastRelax` (which is default);
4. and set the `FastRelax` repeat times to 5 (by default it is already 5, can be customized);
5. and do not load the [common] config file if present.
'''

TaskFacrtory class: prototype of PackerTask

Introduction

Instances ofPackerTaskclass are used to determine the specific tasks in packing.

TaskFactoryis the prototype of PackerTask class.

Every time the protein is packed for a single round, the TaskFactory will generate what is called the PackerTask.

We do NOT use PackerTask directly.

We can set TaskOperationsto the TaskFactory, and all PackerTaskgenerated by thisTaskFactory will be controlled by these TaskOpterations.

So bascically a TaskFactoryobject can be seen as “a list of task operations”.

Some TaskOperationscan respond to changes in the pose, so we do not set TaskOperations directly to PackerTaskin each packing step.

Instead, we use TaskFactoryto dynamically generate PackerTaskobjects in each round, behind the scene.

Instantiation & Configuration(push_back)

1
2
3
4
5
6
7
my_tf = TaskFactory() # Create an empty task factory

# And set task operations to the task factory:
my_tf.push_back(operation.InitializeFromCommandline())
# IMPORTANT! Use configurations declared in `init()`
my_tf.push_back(operation.RestrictToRepacking())
# Disable "designing of side chains" so that the sequence will be untouched

Regional Packing: selections & PreventRepackingRLT

We can also use selectionsfor regional packing

E.g. Selecting CDR H1 region of an antibody

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Selecting CDR H1 region of an antibody
cdr_selector = CDRResidueSelector() # Instantiation
cdr_selector.set_cdr(h1) # Select the H1 loop only
# the namespace of `h1` was imported by commandlines that were passed to init()

# Selecting the Neiborhood (in 3D space) residue of CDR H1
nbr_selector = selections.NeighborhoodResidueSelector() # Instantiation
nbr_selector.set_focus_selector(cdr_selector) # Find neighbors of cdr_selector (which is the H1 loop)
nbr_selector.set_include_focus_in_subset(True) # Include the H1 loop in `nbr_selector` as well

#"RLT": Residue Level Task Operation
prevent_repacking_rlt = operation.PreventRepackingRLT() # Instantication

prevent_subset_repacking = operation.OperateOnResidueSubset(prevent_repacking_rlt, nbr_selector, True)
#`True` indicates here that we are flipping the selection.
# So that we are turning off everything but the CDR and its neighbors.

# Assume that we have a `TaskFactory` named `my_tf`
my_tf.push_back(prevent_subset_repacking)

Note | PyRosetta Basics (8): FastRelax

PackRotamersMover class

A packer is a mover that carries out packing under the instruction of PackerTask.

Use a Resfile

1
2
operation_resfile = pyrosetta.rosetta.core.pack.task.operation.ReadResfile(resfile)
my_tf.push_back(operation_resfile)

Resfile syntax and conventions

A Resfile may conflict with operations.

Instantiation & Configurations

1
2
3
4
5
6
7
# Assume that we have a `TaskFactory` object called `my_tf`
my_packer = pack_min.PackRotamersMover() # Create a `PackRotamersMover` object
my_packer.task_factory(my_tf) # Pass the `TaskFactory` object to the packer

#Note that we are not passing a scorefunction here. We will use the default, cmd-line scorefunction,
# which can be accessed through `rosetta.core.scoring.get_score_function()`
# We use a scorefunction later.

Apply the packer to a pose

1
2
#Run the packer. (Note this may take a few minutes)
my_packer.apply(pose)
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
  • Copyrights © 2024-2025 Michael Lau
  • Visitors: | Views:

请我喝杯咖啡吧~

支付宝
微信