Ejemplo n.º 1
0
    def test_relative_position_mover(self, ):
        """ Test the RelativePositionMover """
        log.info("test RelativePositionMover")
        fn_rec1 = self.get_input_file_name("1suvA_xlinked.pdb")
        fn_rec2 = self.get_input_file_name("1suvC_xlinked.pdb")
        fn_lig = self.get_input_file_name("1suvE_xlinked.pdb")
        fn_tr1  = \
            self.get_input_file_name("transforms-1suvA-1suvE_reduced.txt")
        fn_tr2  = \
            self.get_input_file_name("transforms-1suvC-1suvE_filtered.txt")
        m = IMP.kernel.Model()
        sel = atom.ATOMPDBSelector()
        h_rec1 = atom.read_pdb(fn_rec1, m, sel)
        rb_rec1 = atom.create_rigid_body(h_rec1)
        rec1_coords = [core.XYZ(l).get_coordinates()
                       for l in atom.get_leaves(h_rec1)]
        h_rec2 = atom.read_pdb(fn_rec2, m, sel)
        rb_rec2 = atom.create_rigid_body(h_rec2)
        rec2_coords = [core.XYZ(l).get_coordinates()
                       for l in atom.get_leaves(h_rec2)]
        h_ligand = atom.read_pdb(fn_lig, m, sel)
        rb_lig = atom.create_rigid_body(h_ligand)

        Ts = get_relative_transforms(fn_tr1)
        Tis1 = []
        for i, T in enumerate(Ts):
            V = get_internal_transform3(T, rb_rec1, rb_lig)
            Tis1.append(V)
        docked_refs1 = get_docked_reference_frames(Ts, rb_lig)

        Ts = get_relative_transforms(fn_tr2)
        Tis2 = []
        for i, T in enumerate(Ts):
            V = get_internal_transform3(T, rb_rec2, rb_lig)
            Tis2.append(V)
        docked_refs2 = get_docked_reference_frames(Ts, rb_lig)

        mv = em2d.RelativePositionMover(rb_lig, 10, 20)
        mv.add_internal_transformations(rb_rec1, Tis1)
        mv.add_internal_transformations(rb_rec2, Tis2)

        for i in range(2):
#            prob_random = 0
            ref_before = rb_lig.get_reference_frame()
            ps = mv.propose()  # _move(prob_random)
            ref_after = rb_lig.get_reference_frame()
            found = False
            current_coords = [core.XYZ(l).get_coordinates()
                              for l in atom.get_leaves(h_ligand)]
            # check all possible reference frames where the ligand could be
            for r in itertools.chain(docked_refs1, docked_refs2):
                rb_lig.set_reference_frame(r)
                docked_coords = [core.XYZ(l).get_coordinates()
                                 for l in atom.get_leaves(h_ligand)]
                rmsd = alg.get_rmsd(current_coords, docked_coords)
                if rmsd < 0.1:
                    found = True
            self.assertTrue(found, msg="the proposed move is not "
                            "in the relative solutions")
            mv.accept()
Ejemplo n.º 2
0
 def set_pdbs(self, fn_receptor, fn_ligand):
     """
         Set the name of the PDB files of the receptor and the ligand
         @param fn_receptor
         @param fn_ligand
     """
     sel = atom.ATOMPDBSelector()
     self.m_receptor = IMP.kernel.Model()
     self.h_receptor = atom.read_pdb(fn_receptor, self.m_receptor, sel)
     self.m_ligand = IMP.kernel.Model()
     self.h_ligand = atom.read_pdb(fn_ligand, self.m_ligand, sel)
Ejemplo n.º 3
0
    def test_ccs_value(self):
        """Test the calculation of the collision cross section of a complex"""
        IMP.set_log_level(IMP.TERSE)
        m = IMP.Model()

        fn = self.get_input_file_name("1z5s.pdb")
        prot = atom.read_pdb(fn, m, atom.ATOMPDBSelector())
        atom.add_radii(prot)
        projections = 20
        resolution = 7.0
        pixel_size = 1.5
        img_size = 80
        ccs = em2d.CollisionCrossSection(projections, resolution, pixel_size,
                                         img_size)
        ccs.set_model_particles(IMP.atom.get_leaves(prot))
        ccs_calculated = ccs.get_ccs()
        ccs_value = 3838  # A**2
        # good within 2%
        self.assertAlmostEqual(ccs_calculated,
                               ccs_value,
                               delta=ccs_value * 0.02)
Ejemplo n.º 4
0
## \example em2d/collision_cross_section.py
# Example of how to compute the collision cross section of a molecule.
#

import IMP
import IMP.em2d as em2d
import IMP.atom as atom
"""

Example of how to compute the collision cross section of a molecule

"""

IMP.base.set_log_level(IMP.base.TERSE)
m = IMP.kernel.Model()

fn = em2d.get_example_path("1z5s.pdb")
prot = atom.read_pdb(fn, m, atom.ATOMPDBSelector())
atom.add_radii(prot)

projections = 20
resolution = 1.0
pixel_size = 1.5
img_size = 80
ccs = em2d.CollisionCrossSection(projections, resolution, pixel_size, img_size)
ccs.set_model_particles(IMP.atom.get_leaves(prot))
print "CCS", ccs.get_ccs(), "A**2"