Beispiel #1
0
 def _test_fast_local_refinement(self):
     """test that local rigid fitting work well with rigid bodies"""
     self.ps_all = []  # all the molecules together as one particle
     for n in range(3):
         self.ps_all += self.pss[n]
     d_map = IMP.em.particles2density(self.ps_all, 8, 1.5)
     d_map.calcRMS()
     fnames = ["1atiB01.pdb", "1arsA01.pdb", "1ab4A02.pdb"]
     self.radius_key = IMP.core.XYZR.get_radius_key()
     self.weight_key = IMP.atom.Mass.get_mass_key()
     self.mhs = []  # 3 molecular hierarchies
     self.pss = []  # 3 particles
     # 3 copies of the molecular hierarchies used later as rigid bodies
     self.mhs_copy = []
     sel = IMP.atom.NonWaterPDBSelector()
     mh = IMP.atom.read_pdb(self.open_input_file("1atiB01.pdb"),
                            self.imp_model, sel)
     IMP.atom.add_radii(mh)
     rb = IMP.atom.setup_as_rigid_body(mh)
     ps = IMP.Particles(IMP.core.get_leaves(IMP.atom.Hierarchy(mh)))
     score_before = IMP.em.compute_fitting_score(ps, d_map)
     rand_t = IMP.algebra.Transformation3D(
         IMP.algebra.get_random_rotation_3d(),
         IMP.algebra.get_random_vector_in(
             IMP.algebra.BoundingBox3D(IMP.algebra.Vector3D(-5., -5., -5.),
                                       IMP.algebra.Vector3D(5., 5., 5.))))
     IMP.core.transform(self.rbs_of_copy[0], rand_t)
     fs = IMP.em.local_rigid_fitting(rb, self.radius_key, self.weight_key,
                                     d_map, None, 3, 5, 20, 2, 3, True)
     score_after = IMP.em.compute_fitting_score(ps, d_map)
     print("score_after:", score_after, " score_before:", score_before)
     self.assertAlmostEqual(score_after, score_before, delta=0.05)
     self.assertGreater(fs.get_number_of_solutions(), 0)
     print(fs.get_score(0))