Pyrosetta Selectors

Pyrosetta Selectors

ResidueSelectors

residue_selector — PyRosetta 4.0 documentation

1
2
3
4
# import all selectors via:
from pyrosetta.rosetta.core.select.residue_selector import *
# For previewing selected residues
from pyrosetta.rosetta.core.select import get_residues_from_subset

Select a type of residues by their name (symbol)

1
2
# E.g. Select all cysteines
cys_res = ResidueNameSelector("CYS")

Select a residue by its index, and select its neighbors

1
2
3
4
5
6
7
8
9
10
11
12
13
# Select Mutate Position
mut_posi = ResidueIndexSelector()
mut_posi.set_index(130)
# Or, select multiple positions to be mutated
# Note: The residue index is that of poses, not pdb indexes
# You can pass in pdb indexes. See official document listed above
mut_posi = ResidueIndexSelector("163,164,165")


# Then Select Neighboring Position
nbr_selector = pyrosetta.rosetta.core.select.residue_selector.NeighborhoodResidueSelector()
nbr_selector.set_focus_selector(mut_posi)
nbr_selector.set_include_focus_in_subset(True)

Select a chain by its name

1
2
# Select chain A (in pdb)
chain_A = ChainSelector("A")

Select a chain by its ID in pose

Chain ID: automatically numbered, starting from 1

1
2
# Select the first chain in pose
chain_A = ChainSelector(1)

Select interface

1
interface_selector = InterGroupInterfaceByVectorSelector(chain1, chain2)

Select all

1
all_true_selector = TrueResidueSelector() 

Logic

1
2
3
4
5
6
7
8
9
10
11
12
13
14
'''
# AND
Select all residues that match both conditions:
1. it is a Cys;
2. it is in chain A.
'''
chain_A_cys_res = AndResidueSelector(selector1=cys_res, selector2=chain_A)

'''
# NOT
Invert selection.
Works well when used with RestrictToRepackingRLT()
'''
not_chain_A_cys_res = NotResidueSelector(chain_A_cys_res)

Preview selected residues ID

1
2
3
# E.g. 
print(get_residues_from_subset(cys_res.apply(my_pose)))
print(get_residues_from_subset(chain_A.apply(my_pose)))

Interface selector

The InterGroupInterfaceByVectorSelector identifies residues at the interface between two groups of residues using two distance cutoffs: the first, shorter cutoff is based on atom-atom distances, the second, longer cutoff is used if the c-alpha/c-beta vector of the residues in the first group point toward the c-alphas of the other group.

1
2
# Select the interface between chain A and chain B
interface_selector = InterGroupInterfaceByVectorSelector(chain_A, chain_B)
  • 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:

请我喝杯咖啡吧~

支付宝
微信