Exemplo n.º 1
0
    def test_docking_one_crosslink(self):
        """
        Test the initial docking that is done based on minimizing the
        distances of the cross-linking restraints
        """
        mydock = bx.InitialDockingFromXlinks()
        xl = self.xlinks.get_xlinks_for_pair(("3sfdB", "3sfdA"))
        mydock.set_xlinks(xl)
        self.assertEqual(len(mydock.xlinks_list), 1)
        mydock.clear_xlinks()
        self.assertEqual(len(mydock.xlinks_list), 0)
        model = IMP.kernel.Model()
        fn_receptor = self.get_input_file_name("3sfdB.pdb")
        h_receptor = atom.read_pdb(fn_receptor, model,
                                   atom.NonWaterNonHydrogenPDBSelector())
        fn_ligand = self.get_input_file_name("3sfdA.pdb")
        h_ligand = atom.read_pdb(fn_ligand, model,
                                 atom.NonWaterNonHydrogenPDBSelector())
        mydock.set_xlinks(xl)
        mydock.set_hierarchies(h_receptor, h_ligand)
        p = IMP.kernel.Particle(model)
        core.RigidBody.setup_particle(p, atom.get_leaves(h_receptor))
        rb_receptor = core.RigidBody(p)
        p = IMP.kernel.Particle(model)
        core.RigidBody.setup_particle(p, atom.get_leaves(h_ligand))
        rb_ligand = core.RigidBody(p)
        mydock.set_rigid_bodies(rb_receptor, rb_ligand)
        mydock.move_ligand()

        c1 = mydock.get_residue_coordinates(h_ligand, "A", 456)
        c2 = mydock.get_residue_coordinates(h_receptor, "B", 23)
        dist = alg.get_distance(c1, c2)
        self.assertLessEqual(dist, self.max_distance)
Exemplo n.º 2
0
    def test_docking_multiple_crosslinks(self):
        """
        Test the initial docking that is done based on minimizing the
        distances of the cross-linking restraints
        """
        mydock = bx.InitialDockingFromXlinks()
        xl = self.xlinks.get_xlinks_for_pair(("3sfdC", "3sfdD"))
        mydock.set_xlinks(xl)
        model = IMP.kernel.Model()
        fn_receptor = self.get_input_file_name("3sfdC.pdb")
        h_receptor = atom.read_pdb(fn_receptor, model,
                                   atom.NonWaterNonHydrogenPDBSelector())
        fn_ligand = self.get_input_file_name("3sfdD.pdb")
        h_ligand = atom.read_pdb(fn_ligand, model,
                                 atom.NonWaterNonHydrogenPDBSelector())
        mydock.set_hierarchies(h_receptor, h_ligand)
        p = IMP.kernel.Particle(model)
        core.RigidBody.setup_particle(p, atom.get_leaves(h_receptor))
        rb_receptor = core.RigidBody(p)
        p = IMP.kernel.Particle(model)
        core.RigidBody.setup_particle(p, atom.get_leaves(h_ligand))
        rb_ligand = core.RigidBody(p)
        mydock.set_rigid_bodies(rb_receptor, rb_ligand)
        mydock.move_ligand()

        for res1, res2 in zip([9, 78], [37, 128]):
            c1 = mydock.get_residue_coordinates(h_receptor, "C", res1)
            c2 = mydock.get_residue_coordinates(h_ligand, "D", res2)
            dist = alg.get_distance(c1, c2)
            self.assertLessEqual(dist, self.max_distance + 4.0)
Exemplo n.º 3
0
def create_rigid_bodies(assembly):
    """ set the children of a molecule type hierarchy as rigid bodies
        In this case, all the children are the components of the complex.
        I use the function create_rigid_body(), that creates a lot of
        sub-rigid bodies.

        I have changed the function and now build the rigid body directly from
        the leaves of each of the components. With this I guarantee that the
        number of rigid members is going to be the same if the components have
        the same number of atoms.
    """
    molecule = assembly.get_as_molecule()
    if (not molecule.get_is_valid(True)):
        raise TypeError("create_rigid_bodies(): The argument is not a valid "
                        "hierarchy")
    rbs = []
    for c in molecule.get_children():
        p = IMP.kernel.Particle(c.get_model())
        core.RigidBody.setup_particle(p, atom.get_leaves(c))
        rb = core.RigidBody(p)
        #        rb = atom.create_rigid_body(c)
        rb.set_name(get_rb_name(c.get_name()))
        rbs.append(rb)
    return rbs