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)
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)
def get_residues_distance(hierarchy1, chain_id1, residue1, hierarchy2, chain_id2, residue2): """ Distance between two residues. See the help for get_residue_particle() @param hierarchy1 @param chain_id1 @param residue1 @param hierarchy2 @param chain_id2 @param residue2 """ coords1 = get_residue_coordinates(hierarchy1, chain_id1, residue1) coords2 = get_residue_coordinates(hierarchy2, chain_id2, residue2) d = alg.get_distance(coords1, coords2) return d
def get_xlinks_are_good(coords_rec, coords_lig, distances): """ Compare distances between points in coords_rec and coords_lig @param coords_rec A set of Vector3D objects containing coordinates from the receptor @param coords_lig Coordinates from the ligand @param distances The set of maximum distances for each pair of (coord_rec, coord_lig) @return True if all the distances between the pairs of coordinates are below the thresholds contained in the argument "distances"" """ for vi,vj,d in zip(coords_rec, coords_lig, distances): if alg.get_distance(vi, vj) > d: return False return True
# rotate and translate the chains for rbd in rigid_bodies: # rotation rotation= alg.get_random_rotation_3d() transformation1=alg.get_rotation_about_point(rbd.get_coordinates(),rotation) # translation transformation2=alg.Transformation3D(alg.get_random_vector_in(bb)) # Apply final_transformation = alg.compose(transformation1,transformation2) core.transform(rbd,final_transformation) print "Writing transformed assembly" atom.write_pdb (prot,"1z5s-transformed.pdb") # set distance restraints measusring some distances between rigid bodies # for the solution. d01 = alg.get_distance(native_chain_centers[0],native_chain_centers[1]) r01 = core.DistanceRestraint(core.Harmonic(d01,1),chains[0],chains[1]) r01.set_name("distance 0-1") d12 = alg.get_distance(native_chain_centers[1],native_chain_centers[2]) r12 = core.DistanceRestraint(core.Harmonic(d12,1),chains[1],chains[2]) r12.set_name("distance 1-2") d23 = alg.get_distance(native_chain_centers[2],native_chain_centers[3]) r23 = core.DistanceRestraint(core.Harmonic(d23,1),chains[2],chains[3]) r23.set_name("distance 2-3") d30 = alg.get_distance(native_chain_centers[3],native_chain_centers[0]) r30 = core.DistanceRestraint(core.Harmonic(d30,1),chains[3],chains[0]) r30.set_name("distance 3-0") print "Distances in the solution: d01 =", \ d01,"d12 =",d12,"d23 =",d23,"d30 =",d30 # set distance restraints