Uncategorized PyRosetta Utils

Uncategorized PyRosetta Utils

Clean ATOM

1
2
3
4
from pyrosetta import *
from pyrosetta.teaching import *
cleanATOM('./my_file.pdb')
# It will generate a file named 'my_file.clean.pdb'

Evaluate how much is a pose changed

1
pyrosetta.rosetta.core.scoring.CA_rmsd(start_pose, end_pose)

Convert sequence of a pose to Poly-X

1
2
polyA_chA = pyrosetta.rosetta.protocols.pose_creation.MakePolyXMover(aa="ALA", keep_pro=0, keep_gly=0, keep_disulfide_cys=0)
polyA_chA.apply(pose)

Extract a region (a chain, etc.)

1
keep_chA = pyrosetta.rosetta.protocols.grafting.simple_movers.KeepRegionMover(res_start=str(my_pose.chain_begin(1)), res_end=str(my_pose.chain_end(1)))

Concatenate 2 poses into one pose

1
pyrosetta.rosetta.core.pose.append_pose_to_pose(pose1=pose_A, pose2=pose_BC, new_chain=True)

Vector1

In PyRosetta, Vector1 is a special object that acts like a Python list but is used to pass arguments to underlying C++ Rosetta functions. Rosetta’s C++ code uses a 1-based indexing convention, whereas Python lists use 0-based indexing. Vector1 bridges this gap by creating a list-like object that is internally compatible with Rosetta’s C++ logic.

Vector1 is a convenience class that handles the necessary type conversion for you, so you can write a natural-looking list [1] in your Python code, and PyRosetta handles the rest.

1
pyrosetta.rosetta.utility.Vector1([1])

Setup FoldTree

setup_foldtree requires a Vector1 object as input, not a standard Python list, because the underlying C++ code is expecting a utility::vector1<unsigned long> data type.

1
setup_foldtree(pose, "A_B", Vector1([1]))
  • 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:

请我喝杯咖啡吧~

支付宝
微信