示例#1
0
    def set_BBBB_dihe(self, pose, angle):
        """
        set initial B-B-B angle for each residue to a certain value
        pose : pyrosetta.Pose() object
        angle : angle in degrees

        works for any object with 1-bead backbone
        """
        for i in range(2, pose.size() - 1):
            pose.conformation().set_torsion_angle(
                pyrosetta.AtomID(1, int(i - 1)), pyrosetta.AtomID(1, int(i)),
                pyrosetta.AtomID(1, int(i + 1)),
                pyrosetta.AtomID(1, int(i + 2)), angle * np.pi / 180)

        return (pose)
示例#2
0
    def random_BBBB_dihe(self, pose):
        """
        set random initial B-B-B-B angle for each residue
        pose : pyrosetta.Pose() object
        angle : angle in degrees

        works for any object with 1-bead backbone
        """
        for i in range(2, pose.size() - 1):
            angle = np.random.rand() * 2 * np.pi
            pose.conformation().set_torsion_angle(
                pyrosetta.AtomID(1, int(i - 1)), pyrosetta.AtomID(1, int(i)),
                pyrosetta.AtomID(1, int(i + 1)),
                pyrosetta.AtomID(1, int(i + 2)), angle)

        return (pose)
示例#3
0
 def __init__(self, pose, angle=180):
     pyrosetta.rosetta.protocols.moves.Mover.__init__(self)
     self.pose = pose
     self.angle = angle
     self.conf = pose.conformation()
     self.torsions = []
     self.atoms = [pyrosetta.AtomID(1, 1)]
     for atom_1 in self.atoms:
         # print("Working on", atom_1)
         for atom_2 in self.get_neighbors(atom_1):
             if self.is_new_atom(atom_2):
                 self.atoms.append(atom_2)
             for atom_3 in self.get_neighbors(atom_2):
                 if [atom_1.rsd(), atom_1.atomno()
                     ] == [atom_3.rsd(), atom_3.atomno()]:
                     continue
                 for atom_4 in self.get_neighbors(atom_3):
                     if [atom_2.rsd(), atom_2.atomno()
                         ] == [atom_4.rsd(), atom_4.atomno()]:
                         continue
                     if pose.has_dof(
                             self.conf.atom_tree().torsion_angle_dof_id(
                                 atom_1, atom_2, atom_3, atom_4, 0)):
                         if self.is_new_torsion(
                             [atom_1, atom_2, atom_3, atom_4]):
                             self.torsions.append(
                                 [atom_1, atom_2, atom_3, atom_4])
                         else:
                             continue
示例#4
0
 def __init__(self, pose, angle=5):
     pyrosetta.rosetta.protocols.moves.Mover.__init__(self)
     self.pose = pose
     self.angle = angle
     self.conf = pose.conformation()
     self.bond_angles = []
     self.atoms = [pyrosetta.AtomID(1, 1)]
     for atom_1 in self.atoms:
         # print("Working on", atom_1)
         for atom_2 in self.get_neighbors(atom_1):
             if self.is_new_atom(atom_2):
                 self.atoms.append(atom_2)
             for atom_3 in self.get_neighbors(atom_2):
                 # print("Angle Candidate:", atom_1, atom_2, atom_3)
                 if [atom_1.rsd(), atom_1.atomno()
                     ] == [atom_3.rsd(), atom_3.atomno()]:
                     continue
                 if pose.has_dof(self.conf.atom_tree().bond_angle_dof_id(
                         atom_1, atom_2, atom_3, 0)):
                     if self.is_new_angle([atom_1, atom_2, atom_3]):
                         self.bond_angles.append([atom_1, atom_2, atom_3])
                         # print("Adding Bond Angle!")
                         # print("A1:", atom_1)
                         # print("A2:", atom_2)
                         # print("A3:", atom_3)
                     else:
                         continue
示例#5
0
 def __init__(self, pose, d_bond=0.1):
     pyrosetta.rosetta.protocols.moves.Mover.__init__(self)
     self.pose = pose
     self.d_bond = d_bond
     self.conf = pose.conformation()
     self.bond_lengths = []
     self.atoms = [pyrosetta.AtomID(1, 1)]
     for atom_1 in self.atoms:
         for atom_2 in self.get_neighbors(atom_1):
             if self.is_new_atom(atom_2):
                 self.atoms.append(atom_2)
             if pose.has_dof(self.conf.atom_tree().bond_length_dof_id(
                     atom_1, atom_2)):
                 if self.is_new_bond([atom_1, atom_2]):
                     self.bond_lengths.append([atom_1, atom_2])
                 else:
                     continue
def testCGSmallAngleMover():
    pose = pyrosetta.pose_from_sequence(
        'X[CG11x3:CGLower]X[CG11x3]X[CG11x3][CG11x3:CGUpper]')

    x_old = pose.xyz(pyrosetta.AtomID(1, pose.size())).x
    y_old = pose.xyz(pyrosetta.AtomID(1, pose.size())).y
    z_old = pose.xyz(pyrosetta.AtomID(1, pose.size())).z

    small_angle_mover = cg_pyrosetta.CG_movers.CGSmallAngleMover(pose)

    for _ in range(200):
        small_angle_mover.apply(pose)

    x_new = pose.xyz(pyrosetta.AtomID(1, pose.size())).x
    y_new = pose.xyz(pyrosetta.AtomID(1, pose.size())).y
    z_new = pose.xyz(pyrosetta.AtomID(1, pose.size())).z

    assert x_new != x_old
    assert y_new != y_old
    assert z_new != z_old
示例#7
0
 def get_neighbors(self, atom):
     return (self.conf.bonded_neighbor_all_res(
         pyrosetta.AtomID(atom.atomno(), atom.rsd())))
示例#8
0
# Build PyMol visualizer
pymol = pyrosetta.PyMOLMover()
# pymol.apply(polyA)
pymol.apply(polyCG)

# Build Score Function
sf = pyrosetta.ScoreFunction()
sf.set_weight(pyrosetta.rosetta.core.scoring.mm_bend, 1)
sf.set_weight(pyrosetta.rosetta.core.scoring.mm_twist, 1)
sf.set_weight(pyrosetta.rosetta.core.scoring.fa_atr, 1)
sf.set_weight(pyrosetta.rosetta.core.scoring.fa_rep, 1)

# Build MoveMap
mm = pyrosetta.MoveMap()
mm.set(
    pyrosetta.rosetta.core.id.DOF_ID(pyrosetta.AtomID(3, 2),
                                     pyrosetta.rosetta.core.id.THETA), True)

# Build Minimizer
mini = pyrosetta.rosetta.protocols.minimization_packing.MinMover()
mini.score_function(sf)
mini.movemap(mm)

# Perturb angle
polyA.conformation().set_bond_angle(pyrosetta.AtomID(3, 2),
                                    pyrosetta.AtomID(2, 2),
                                    pyrosetta.AtomID(1, 2), 0.5)

polyCG.conformation().set_bond_angle(pyrosetta.AtomID(3, 2),
                                     pyrosetta.AtomID(2, 2),
                                     pyrosetta.AtomID(1, 2), 0.5)