Exemplo n.º 1
0
 def test_transform_update(self):
     """ Test update of rotation and translation using selection """
     pdb_inp = iotbx.pdb.input(source_info=None, lines=pdb_answer_0)
     ncs_obj = ncs.input(hierarchy=pdb_inp.construct_hierarchy())
     pdb_inp = iotbx.pdb.input(lines=pdb_answer_0, source_info=None)
     nrgl = ncs_obj.get_ncs_restraints_group_list()
     asu_site_cart = pdb_inp.atoms().extract_xyz()
     # reference matrices
     r1 = nrgl[0].copies[0].r
     t1 = nrgl[0].copies[0].t
     r2 = nrgl[0].copies[1].r
     t2 = nrgl[0].copies[1].t
     # modify matrices in the ncs group list
     nrgl[0].copies[0].r = r1 + r2
     nrgl[0].copies[0].t = t1 + t2
     nrgl[0].copies[1].r = r1 + r2
     nrgl[0].copies[1].t = t1 + t2
     nu.recalculate_ncs_transforms(nrgl, asu_site_cart)
     # Get the updated values
     r1_n = nrgl[0].copies[0].r
     t1_n = nrgl[0].copies[0].t
     r2_n = nrgl[0].copies[1].r
     t2_n = nrgl[0].copies[1].t
     #
     self.assertTrue(is_same_transform(r1, t1, r1_n, t1_n))
     self.assertTrue(is_same_transform(r2, t2, r2_n, t2_n))
Exemplo n.º 2
0
 def test_transform_update(self):
   """ Test update of rotation and translation using selection """
   pdb_inp = iotbx.pdb.input(source_info=None, lines=pdb_answer_0)
   ncs_obj = ncs.input(hierarchy=pdb_inp.construct_hierarchy())
   pdb_inp = iotbx.pdb.input(lines=pdb_answer_0,source_info=None)
   nrgl = ncs_obj.get_ncs_restraints_group_list()
   asu_site_cart = pdb_inp.atoms().extract_xyz()
   # reference matrices
   r1 = nrgl[0].copies[0].r
   t1 = nrgl[0].copies[0].t
   r2 = nrgl[0].copies[1].r
   t2 = nrgl[0].copies[1].t
   # modify matrices in the ncs group list
   nrgl[0].copies[0].r = r1 + r2
   nrgl[0].copies[0].t = t1 + t2
   nrgl[0].copies[1].r = r1 + r2
   nrgl[0].copies[1].t = t1 + t2
   nu.recalculate_ncs_transforms(nrgl,asu_site_cart)
   # Get the updated values
   r1_n = nrgl[0].copies[0].r
   t1_n = nrgl[0].copies[0].t
   r2_n = nrgl[0].copies[1].r
   t2_n = nrgl[0].copies[1].t
   #
   self.assertTrue(is_same_transform(r1,t1,r1_n,t1_n))
   self.assertTrue(is_same_transform(r2,t2,r2_n,t2_n))
Exemplo n.º 3
0
 def test_proper_biomat_application(self):
   """ Test that when building bio-molecule and then finding NCS relatin
   from it, we get the same rotation and translation"""
   pdb_strings = [pdb_test_data7,pdb_test_data8]
   methods = ['ba','cau']
   for method,pdb_string in zip(methods,pdb_strings):
     print "method:", method
     pdb_inp = pdb.input(source_info=None, lines=pdb_string)
     crystal_symmetry = pdb_inp.crystal_symmetry()
     m = multimer(
       pdb_str=pdb_string,
       round_coordinates=False,
       reconstruction_type=method,
       error_handle=True,eps=1e-2)
     # The exact transforms from pdb_string
     r1_expected = matrix.sqr(
       [0.309017, -0.951057, 0.0,0.951057, 0.309017,-0.0,0.0,0.0,1.0])
     r2_expected = matrix.sqr(
       [-0.809017,-0.587785,0.0,0.587785,-0.809017,-0.0,0.0,0.0,1.0])
     t1_expected = matrix.col([0,0,7])
     t2_expected = matrix.col([0,0,0])
     # Look at biomt records retrieved from PDB file
     if method == 'ba':
       rec = pdb_inp.process_BIOMT_records()
     else:
       rec = pdb_inp.process_mtrix_records()
     r1 = rec.r[1]
     r2 = rec.r[2]
     t1 = rec.t[1]
     t2 = rec.t[2]
     (the_same, transpose) = is_same_transform(r1,t1,r1_expected,t1_expected)
     self.assertTrue(the_same)
     (the_same, transpose)= is_same_transform(r2,t2,r2_expected,t2_expected)
     self.assertTrue(the_same)
     # Look at the rotation and translation found by the NCS search
     s = m.assembled_multimer.as_pdb_string(crystal_symmetry=crystal_symmetry)
     print "new h:", s
     ncs_obj = ncs.input(pdb_string=s)
     print "ncs_obj.number_of_ncs_groups", ncs_obj.number_of_ncs_groups
     r1 = ncs_obj.ncs_transform['002'].r
     t1 = ncs_obj.ncs_transform['002'].t
     r2 = ncs_obj.ncs_transform['003'].r
     t2 = ncs_obj.ncs_transform['003'].t
     (the_same, transpose) = is_same_transform(r1,t1,r1_expected,t1_expected)
     self.assertTrue(the_same)
     (the_same, transpose)= is_same_transform(r2,t2,r2_expected,t2_expected)
     self.assertTrue(the_same)
     if method == 'ba':
       self.assertEqual(ncs_obj.number_of_ncs_groups,1)
     elif method == 'cau':
       self.assertEqual(ncs_obj.number_of_ncs_groups,2)
Exemplo n.º 4
0
def exercise_06():
    """ Test that when building bio-molecule and then finding NCS relatin
  from it, we get the same rotation and translation"""
    pdb_strings = [pdb_str_4, pdb_str_5]
    for method, pdb_string in enumerate(pdb_strings):
        pdb_inp = pdb.input(source_info=None, lines=pdb_string)
        crystal_symmetry = pdb_inp.crystal_symmetry()
        # The exact transforms from pdb_string
        r1_expected = matrix.sqr([
            0.309017, -0.951057, 0.0, 0.951057, 0.309017, -0.0, 0.0, 0.0, 1.0
        ])
        r2_expected = matrix.sqr([
            -0.809017, -0.587785, 0.0, 0.587785, -0.809017, -0.0, 0.0, 0.0, 1.0
        ])
        t1_expected = matrix.col([0, 0, 7])
        t2_expected = matrix.col([0, 0, 0])
        # Look at biomt records retrieved from PDB file
        if method == 0:
            rec = pdb_inp.process_BIOMT_records()
            h = pdb_inp.construct_hierarchy_BIOMT_expanded()
        else:
            rec = pdb_inp.process_MTRIX_records()
            h = pdb_inp.construct_hierarchy_MTRIX_expanded()
        r1 = rec.r[1]
        r2 = rec.r[2]
        t1 = rec.t[1]
        t2 = rec.t[2]
        (the_same, transpose) = is_same_transform(r1, t1, r1_expected,
                                                  t1_expected)
        assert the_same
        (the_same, transpose) = is_same_transform(r2, t2, r2_expected,
                                                  t2_expected)
        assert the_same
        # Look at the rotation and translation found by the NCS search
        s = h.as_pdb_string(crystal_symmetry=crystal_symmetry)
        ncs_obj = ncs.input(hierarchy=pdb.input(source_info=None,
                                                lines=s).construct_hierarchy())
        r1 = ncs_obj.ncs_transform['0000000002'].r
        t1 = ncs_obj.ncs_transform['0000000002'].t
        r2 = ncs_obj.ncs_transform['0000000003'].r
        t2 = ncs_obj.ncs_transform['0000000003'].t
        (the_same, transpose) = is_same_transform(r1, t1, r1_expected,
                                                  t1_expected)
        assert the_same
        (the_same, transpose) = is_same_transform(r2, t2, r2_expected,
                                                  t2_expected)
        assert the_same
        if method == 0:
            assert ncs_obj.number_of_ncs_groups == 1
        elif method == 1:
            assert ncs_obj.number_of_ncs_groups == 2