PyRosetta (4) Rosetta Scripts Parser

PyRosetta (4): Rosetta Scripts Parser

1
2
3
!pip install pyrosettacolabsetup
import pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()
import pyrosetta; pyrosetta.init()
1
2
3
4
from pyrosetta import *
from rosetta.protocols.rosetta_scripts import *

init('-no_fconfig @inputs/rabd/common')

Introduction

rosetta.protocols.rosetta_scripts.RosettaScriptsParser parses a Rosetta Script so that it can be called in PyRosetta.

Rosetta Scripts are in XML format.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<ROSETTASCRIPTS>
<SCOREFXNS>
</SCOREFXNS>
<RESIDUE_SELECTORS>
</RESIDUE_SELECTORS>
<TASKOPERATIONS>
</TASKOPERATIONS>
<SIMPLE_METRICS>
</SIMPLE_METRICS>
<FILTERS>
</FILTERS>
<MOVERS>
</MOVERS>
<PROTOCOLS>
</PROTOCOLS>
<OUTPUT />
</ROSETTASCRIPTS>

Rosetta will carry out the order of operations specified in <PROTOCOLS></PROTOCOLS>.

SimpleMetrics (<SIMPLE_METRICS></SIMPLE_METRICS>) and Filters (<FILTERS></FILTERS>) do not change the sequence or conformation of the structure.

The movers (<MOVERS></MOVERS>) do change the pose, and the output file will be the result of sequentially applying the movers in the protocols section.

The standard scores of the output will be carried over from any protocol doing scoring, unless the OUTPUT tag (<OUTPUT></OUTPUT>) is specified, in which case the corresponding score function from the <SCOREFXNS></SCOREFXNS> block will be used.

Instantiation

1
2
3
4
5
6
my_parser = RosettaScriptsParser()
# my_parser is an instanse of `RosettaScriptsParser`
my_pose = pose_from_pdb("inputs/rabd/my_ab.pdb")
# my_pose is an instance of `Pose`; it is generated by calling `pyrosetta.pose_from_pdb`
my_pose_clone = my_pose.clone()
# Always clone a copy as an archive before editing

Load a protocol

Load from file

1
2
# load from file
my_protocol = parser.generate_mover("inputs/min_L1.xml")

Load from string (construct a XML object)

1
2
3
min_L1 = "<ROSETTASCRIPTS>...</ROSETTASCRIPTS>" # min_L1 is a string that is in XML format
xml = XmlObjects.create_from_string(min_L1)
my_protocol = xml.get_mover("ParsedProtocol")

Apply a protocol

1
my_protocol.apply(my_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:

请我喝杯咖啡吧~

支付宝
微信