示例#1
0
文件: test_dof.py 项目: AljGaber/imp
    def test_mc_super_rigid_body(self):
        mdl = IMP.Model()
        m1,m2,m3 = self.init_topology3(mdl)
        dof = IMP.pmi.dof.DegreesOfFreedom(mdl)

        h1 = m1.get_hierarchy()
        h2 = m1.get_hierarchy()
        h3 = m1.get_hierarchy()
        srb = dof.create_super_rigid_body([h1,h2,h3],chain_min_length=2,chain_max_length=2)
        self.assertEqual(len(srb.get_movers()),2)
示例#2
0
文件: test_dof.py 项目: AljGaber/imp
    def test_mc_super_rigid_body(self):
        mdl = IMP.Model()
        m1, m2, m3 = self.init_topology3(mdl)
        dof = IMP.pmi.dof.DegreesOfFreedom(mdl)

        h1 = m1.get_hierarchy()
        h2 = m1.get_hierarchy()
        h3 = m1.get_hierarchy()
        srb = dof.create_super_rigid_body([h1, h2, h3],
                                          chain_min_length=2,
                                          chain_max_length=2)
        self.assertEqual(len(srb.get_movers()), 2)
示例#3
0
文件: test_dof.py 项目: salilab/imp
 def test_mc_super_rigid_body(self):
     mdl = IMP.Model()
     s,mols = self.init_topology3(mdl)
     dof = IMP.pmi.dof.DegreesOfFreedom(mdl)
     rb1_mov,rb1 = dof.create_rigid_body(mols[0],
                                     nonrigid_parts = mols[0].get_non_atomic_residues())
     rb2_mov,rb2 = dof.create_rigid_body(mols[1],
                                     nonrigid_parts = mols[1].get_non_atomic_residues())
     rb3_mov,rb3 = dof.create_rigid_body(mols[2],
                                     nonrigid_parts = mols[2].get_non_atomic_residues())
     srb_mover = dof.create_super_rigid_body(mols,chain_min_length=2,
                                             chain_max_length=2)
     ### rbX = dof.create_rigid_body([mols[0],mols[1]]) should fail
     # rb1:4, rb2:1, rb3:4, srbs:2
     mvs = dof.get_movers()
     self.assertEqual(len(mvs),11)
示例#4
0
 def test_mc_super_rigid_body(self):
     mdl = IMP.Model()
     s, mols = self.init_topology3(mdl)
     dof = IMP.pmi.dof.DegreesOfFreedom(mdl)
     rb1_mov, rb1 = dof.create_rigid_body(
         mols[0], nonrigid_parts=mols[0].get_non_atomic_residues())
     rb2_mov, rb2 = dof.create_rigid_body(
         mols[1], nonrigid_parts=mols[1].get_non_atomic_residues())
     rb3_mov, rb3 = dof.create_rigid_body(
         mols[2], nonrigid_parts=mols[2].get_non_atomic_residues())
     srb_mover = dof.create_super_rigid_body(mols,
                                             chain_min_length=2,
                                             chain_max_length=2)
     ### rbX = dof.create_rigid_body([mols[0],mols[1]]) should fail
     # rb1:4, rb2:1, rb3:4, srbs:2
     mvs = dof.get_movers()
     self.assertEqual(len(mvs), 11)
示例#5
0
# State 2: ProtA (chainA), ProtC (chainC)
m2A = st2.create_molecule('ProtA', sequence, chain_id='A')
m2A.add_representation(m2A, resolutions=[1])
m2C = st2.create_molecule('ProtC', sequence, chain_id='C')
m2C.add_representation(m2C, resolutions=[1])
root_hier = s.build()

### Display all the states, molecules, representations
IMP.atom.show_with_representations(root_hier)

### Setup all molecules to move as flexible beads and super rigid bodies
#  "Super rigid bodies" aren't really rigid, it's just a mover that moves the whole body together
dof = IMP.pmi.dof.DegreesOfFreedom(mdl)
for mol in (m1A, m1B, m1C, m2A, m2C):
    dof.create_flexible_beads(mol, max_trans=0.1)
    dof.create_super_rigid_body(mol)

###################### RESTRAINTS #####################
output_objects = []  # keep a list of functions that need to be reported

### Crosslinks setup
# 1) Create file. This one XL has 3 ambiguity options: State1 has 2, State2 has 1
lines = '''id,mol1,res1,mol2,res2,score
1,ProtA,3,ProtC,9,1.0
'''
tf = tempfile.NamedTemporaryFile(delete=False, mode='w')
tf.write(lines)
tf.close()

# 2) Define the columns
kw = IMP.pmi.io.crosslink.CrossLinkDataBaseKeywordsConverter()
示例#6
0
    def test_mc_super_rigid_body_disable(self):
        """test disable super rigid bodies, floppy bodies and rigid bodies"""
        mdl = IMP.Model()
        s, mols = self.init_topology3(mdl)
        dof = IMP.pmi.dof.DegreesOfFreedom(mdl)
        rb1_mov, rb1 = dof.create_rigid_body(
            mols[0], nonrigid_parts=mols[0].get_non_atomic_residues())
        rb2_mov, rb2 = dof.create_rigid_body(
            mols[1], nonrigid_parts=mols[1].get_non_atomic_residues())
        rb3_mov, rb3 = dof.create_rigid_body(
            mols[2], nonrigid_parts=mols[2].get_non_atomic_residues())
        srb_mover = dof.create_super_rigid_body(mols,
                                                chain_min_length=2,
                                                chain_max_length=2)
        ### rbX = dof.create_rigid_body([mols[0],mols[1]]) should fail
        # rb1:4, rb2:1, rb3:4, srbs:2
        mvs = dof.get_movers()
        self.assertEqual(len(mvs), 11)

        #fixing all particles
        particles = IMP.atom.Selection(s.hier).get_selected_particles()
        xyzs, rbs = dof.disable_movers(particles)
        self.assertEqual(len(xyzs), 6)
        self.assertEqual(len(rbs), 3)
        mvs = dof.get_movers()
        self.assertEqual(len(mvs), 0)

        #enabling everything
        dof.enable_all_movers()
        mvs = dof.get_movers()
        self.assertEqual(len(mvs), 11)

        #fixing prot1
        particles = IMP.atom.Selection(
            s.hier, molecule="Prot1").get_selected_particles()
        xyzs, rbs = dof.disable_movers(particles)
        self.assertEqual(len(xyzs), 3)
        self.assertEqual(len(rbs), 1)
        mvs = dof.get_movers()
        self.assertEqual(len(mvs), 6)

        #fixing prot1 rb
        dof.enable_all_movers()
        particles = IMP.atom.Selection(
            s.hier, molecule="Prot1").get_selected_particles()
        xyzs, rbs = dof.disable_movers(particles,
                                       mover_types=[IMP.core.RigidBodyMover])
        self.assertEqual(len(xyzs), 0)
        self.assertEqual(len(rbs), 1)
        mvs = dof.get_movers()
        self.assertEqual(len(mvs), 10)

        #fixing prot1 fbs
        dof.enable_all_movers()
        particles = IMP.atom.Selection(
            s.hier, molecule="Prot1").get_selected_particles()
        xyzs, rbs = dof.disable_movers(particles,
                                       mover_types=[IMP.core.BallMover])
        self.assertEqual(len(xyzs), 3)
        self.assertEqual(len(rbs), 0)
        mvs = dof.get_movers()
        self.assertEqual(len(mvs), 8)

        #removing super rigid body
        dof.enable_all_movers()
        particles = IMP.atom.Selection(
            s.hier, molecule="Prot1").get_selected_particles()
        xyzs, rbs = dof.disable_movers(particles,
                                       mover_types=[IMP.pmi.TransformMover])
        self.assertEqual(len(xyzs), 0)
        self.assertEqual(len(rbs), 0)
        mvs = dof.get_movers()
        self.assertEqual(len(mvs), 10)

        #removing rbmv, ballmovers and super rigid movers involving prot1
        dof.enable_all_movers()
        particles = IMP.atom.Selection(
            s.hier, molecule="Prot1").get_selected_particles()
        xyzs, rbs = dof.disable_movers(particles,
                                       mover_types=[
                                           IMP.core.RigidBodyMover,
                                           IMP.core.BallMover,
                                           IMP.pmi.TransformMover
                                       ])
        self.assertEqual(len(xyzs), 3)
        self.assertEqual(len(rbs), 1)
        mvs = dof.get_movers()
        self.assertEqual(len(mvs), 6)

        #removing rbmv, ballmovers and super rigid movers involving prot2
        dof.enable_all_movers()
        particles = IMP.atom.Selection(
            s.hier, molecule="Prot2").get_selected_particles()
        xyzs, rbs = dof.disable_movers(particles,
                                       mover_types=[
                                           IMP.core.RigidBodyMover,
                                           IMP.core.BallMover,
                                           IMP.pmi.TransformMover
                                       ])
        self.assertEqual(len(xyzs), 0)
        self.assertEqual(len(rbs), 1)
        mvs = dof.get_movers()
        self.assertEqual(len(mvs), 8)
示例#7
0
文件: ambiguity.py 项目: salilab/imp
m2A = st2.create_molecule('ProtA',sequence,chain_id='A')
m2A.add_representation(m2A,resolutions=[1])
m2C = st2.create_molecule('ProtC',sequence,chain_id='C')
m2C.add_representation(m2C,resolutions=[1])
root_hier = s.build()

### Display all the states, molecules, representations
IMP.atom.show_with_representations(root_hier)

### Setup all molecules to move as flexible beads and super rigid bodies
#  "Super rigid bodies" aren't really rigid, it's just a mover that moves the whole body together
dof = IMP.pmi.dof.DegreesOfFreedom(mdl)
for mol in (m1A,m1B,m1C,m2A,m2C):
    dof.create_flexible_beads(mol,
                              max_trans=0.1)
    dof.create_super_rigid_body(mol)


###################### RESTRAINTS #####################
output_objects = [] # keep a list of functions that need to be reported
rmf_restraints = [] # display these restraints as springs in the RMF

### Crosslinks setup
# 1) Create file. This one XL has 3 ambiguity options: State1 has 2, State2 has 1
lines = '''id,mol1,res1,mol2,res2,score
1,ProtA,3,ProtC,9,1.0
'''
tf = tempfile.NamedTemporaryFile(delete=False, mode='w')
tf.write(lines)
tf.close()
示例#8
0
文件: test_dof.py 项目: salilab/imp
    def test_mc_super_rigid_body_disable(self):
        """test disable super rigid bodies, floppy bodies and rigid bodies"""
        mdl = IMP.Model()
        s,mols = self.init_topology3(mdl)
        dof = IMP.pmi.dof.DegreesOfFreedom(mdl)
        rb1_mov,rb1 = dof.create_rigid_body(mols[0],
                                        nonrigid_parts = mols[0].get_non_atomic_residues())
        rb2_mov,rb2 = dof.create_rigid_body(mols[1],
                                        nonrigid_parts = mols[1].get_non_atomic_residues())
        rb3_mov,rb3 = dof.create_rigid_body(mols[2],
                                        nonrigid_parts = mols[2].get_non_atomic_residues())
        srb_mover = dof.create_super_rigid_body(mols,chain_min_length=2,
                                                chain_max_length=2)
        ### rbX = dof.create_rigid_body([mols[0],mols[1]]) should fail
        # rb1:4, rb2:1, rb3:4, srbs:2
        mvs = dof.get_movers()
        self.assertEqual(len(mvs),11)

        #fixing all particles
        particles=IMP.atom.Selection(s.hier).get_selected_particles()
        xyzs,rbs=dof.disable_movers(particles)
        self.assertEqual(len(xyzs),6)
        self.assertEqual(len(rbs),3)
        mvs = dof.get_movers()
        self.assertEqual(len(mvs),0)

        #enabling everything
        dof.enable_all_movers()
        mvs = dof.get_movers()
        self.assertEqual(len(mvs),11)

        #fixing prot1
        particles=IMP.atom.Selection(s.hier,molecule="Prot1").get_selected_particles()
        xyzs,rbs=dof.disable_movers(particles)
        self.assertEqual(len(xyzs),3)
        self.assertEqual(len(rbs),1)
        mvs = dof.get_movers()
        self.assertEqual(len(mvs),6)

        #fixing prot1 rb
        dof.enable_all_movers()
        particles=IMP.atom.Selection(s.hier,molecule="Prot1").get_selected_particles()
        xyzs,rbs=dof.disable_movers(particles,mover_types=[IMP.core.RigidBodyMover])
        self.assertEqual(len(xyzs),0)
        self.assertEqual(len(rbs),1)
        mvs = dof.get_movers()
        self.assertEqual(len(mvs),10)

        #fixing prot1 fbs
        dof.enable_all_movers()
        particles=IMP.atom.Selection(s.hier,molecule="Prot1").get_selected_particles()
        xyzs,rbs=dof.disable_movers(particles,mover_types=[IMP.core.BallMover])
        self.assertEqual(len(xyzs),3)
        self.assertEqual(len(rbs),0)
        mvs = dof.get_movers()
        self.assertEqual(len(mvs),8)

        #removing super rigid body
        dof.enable_all_movers()
        particles=IMP.atom.Selection(s.hier,molecule="Prot1").get_selected_particles()
        xyzs,rbs=dof.disable_movers(particles,mover_types=[IMP.pmi.TransformMover])
        self.assertEqual(len(xyzs),0)
        self.assertEqual(len(rbs),0)
        mvs = dof.get_movers()
        self.assertEqual(len(mvs),10)

        #removing rbmv, ballmovers and super rigid movers involving prot1
        dof.enable_all_movers()
        particles=IMP.atom.Selection(s.hier,molecule="Prot1").get_selected_particles()
        xyzs,rbs=dof.disable_movers(particles,mover_types=[IMP.core.RigidBodyMover,IMP.core.BallMover,IMP.pmi.TransformMover])
        self.assertEqual(len(xyzs),3)
        self.assertEqual(len(rbs),1)
        mvs = dof.get_movers()
        self.assertEqual(len(mvs),6)

        #removing rbmv, ballmovers and super rigid movers involving prot2
        dof.enable_all_movers()
        particles=IMP.atom.Selection(s.hier,molecule="Prot2").get_selected_particles()
        xyzs,rbs=dof.disable_movers(particles,mover_types=[IMP.core.RigidBodyMover,IMP.core.BallMover,IMP.pmi.TransformMover])
        self.assertEqual(len(xyzs),0)
        self.assertEqual(len(rbs),1)
        mvs = dof.get_movers()
        self.assertEqual(len(mvs),8)