def test_gaussian_rb(self): mdl = IMP.Model() s, m1, m2, m3 = self.init_topology_densities(mdl) densities = [r.get_hierarchy() for r in m3.get_non_atomic_residues()] gem_xtal = IMP.pmi.restraints.em.GaussianEMRestraint( densities, self.get_input_file_name('prot_gmm.txt'), target_is_rigid_body=True) gem_xtal.get_restraint_set().set_was_used(True) em_rb = gem_xtal.get_rigid_body() em_rb.set_coordinates_are_optimized(False) dof = IMP.pmi.dof.DegreesOfFreedom(mdl) movers, rb = dof.create_rigid_body(em_rb) # Check assigning of names to existing rigid bodies self.assertEqual(movers[0].get_name(), 'created rigid body') movers, rb = dof.create_rigid_body(em_rb, name='foo') self.assertEqual(movers[0].get_name(), 'foo') self.assertTrue(em_rb in dof.get_rigid_bodies()) self.assertEqual(len(dof.get_rigid_bodies()), 2) self.assertTrue(em_rb.get_coordinates_are_optimized()) self.assertEqual(len(dof.get_movers()), 2)
def test_gaussian_rb(self): mdl = IMP.Model() m1, m2, m3 = self.init_topology_densities(mdl) densities = [r.get_hierarchy() for r in m3.get_non_atomic_residues()] gem_xtal = IMP.pmi.restraints.em.GaussianEMRestraint(densities, self.get_input_file_name('prot_gmm.txt'), target_is_rigid_body=True) em_rb = gem_xtal.get_rigid_body() em_rb.set_coordinates_are_optimized(False) dof = IMP.pmi.dof.DegreesOfFreedom(mdl) dof.create_rigid_body(em_rb) self.assertTrue(em_rb in dof.get_rigid_bodies()) self.assertEqual(len(dof.get_rigid_bodies()), 1) self.assertTrue(em_rb.get_coordinates_are_optimized()) self.assertEqual(len(dof.get_movers()), 1)
def test_gaussian_rb(self): mdl = IMP.Model() m1, m2, m3 = self.init_topology_densities(mdl) densities = [r.get_hierarchy() for r in m3.get_non_atomic_residues()] gem_xtal = IMP.pmi.restraints.em.GaussianEMRestraint( densities, self.get_input_file_name('prot_gmm.txt'), target_is_rigid_body=True) em_rb = gem_xtal.get_rigid_body() em_rb.set_coordinates_are_optimized(False) dof = IMP.pmi.dof.DegreesOfFreedom(mdl) dof.create_rigid_body(em_rb) self.assertTrue(em_rb in dof.get_rigid_bodies()) self.assertEqual(len(dof.get_rigid_bodies()), 1) self.assertTrue(em_rb.get_coordinates_are_optimized()) self.assertEqual(len(dof.get_movers()), 1)
def test_gaussian_rb(self): mdl = IMP.Model() s, m1, m2, m3 = self.init_topology_densities(mdl) densities = [r.get_hierarchy() for r in m3.get_non_atomic_residues()] gem_xtal = IMP.pmi.restraints.em.GaussianEMRestraint(densities, self.get_input_file_name('prot_gmm.txt'), target_is_rigid_body=True) gem_xtal.get_restraint_set().set_was_used(True) em_rb = gem_xtal.get_rigid_body() em_rb.set_coordinates_are_optimized(False) dof = IMP.pmi.dof.DegreesOfFreedom(mdl) movers, rb = dof.create_rigid_body(em_rb) # Check assigning of names to existing rigid bodies self.assertEqual(movers[0].get_name(), 'created rigid body') movers, rb = dof.create_rigid_body(em_rb, name='foo') self.assertEqual(movers[0].get_name(), 'foo') self.assertTrue(em_rb in dof.get_rigid_bodies()) self.assertEqual(len(dof.get_rigid_bodies()), 2) self.assertTrue(em_rb.get_coordinates_are_optimized()) self.assertEqual(len(dof.get_movers()), 2)
def test_shuffle(self): """Test moving rbs, fbs""" mdl = IMP.Model() s = IMP.pmi.topology.System(mdl) seqs = IMP.pmi.topology.Sequences(self.get_input_file_name('chainA.fasta')) st1 = s.create_state() mol = st1.create_molecule("GCP2_YEAST",sequence=seqs["GCP2_YEAST"][:100],chain_id='A') atomic_res = mol.add_structure(self.get_input_file_name('chainA.pdb'), chain_id='A', res_range=(1,100)) mol.add_representation(mol.get_atomic_residues(),resolutions=[10]) mol.add_representation(mol.get_non_atomic_residues(), resolutions=[10]) hier = s.build() dof = IMP.pmi.dof.DegreesOfFreedom(mdl) dof.create_rigid_body(mol, nonrigid_parts=mol.get_non_atomic_residues()) rbs = dof.get_rigid_bodies() IMP.pmi.tools.shuffle_configuration(hier)
def test_shuffle(self): """Test moving rbs, fbs""" mdl = IMP.Model() s = IMP.pmi.topology.System(mdl) seqs = IMP.pmi.topology.Sequences( self.get_input_file_name('chainA.fasta')) st1 = s.create_state() mol = st1.create_molecule("GCP2_YEAST", sequence=seqs["GCP2_YEAST"][:100], chain_id='A') atomic_res = mol.add_structure(self.get_input_file_name('chainA.pdb'), chain_id='A', res_range=(1, 100)) mol.add_representation(mol.get_atomic_residues(), resolutions=[10]) mol.add_representation(mol.get_non_atomic_residues(), resolutions=[10]) hier = s.build() dof = IMP.pmi.dof.DegreesOfFreedom(mdl) dof.create_rigid_body(mol, nonrigid_parts=mol.get_non_atomic_residues()) rbs = dof.get_rigid_bodies() IMP.pmi.tools.shuffle_configuration(hier)
output_objects.append(crA) sample_objects.append(crA) crs.append(crA) atomic = mol.get_atomic_residues() dof.create_rigid_body(atomic, max_trans=0, max_rot=0, resolution='all') dof.create_flexible_beads(mol.get_non_atomic_residues(), max_trans=1.0, resolution=1) active_tri_mol.append(mol) # ______Composite Restraint for Fibril___________________________________________________________________ shuffle_exclude_rbs = dof.get_rigid_bodies()[:-1] # Constrain the fibril trimer unit copies with z-trans. symmetry ### This is very important for i in range(0, len(chains)): for t in range(0, len(fibril_transforms)): threefold_trans = fibril_transforms[t] dof.constrain_symmetry(protofil_mols[i][0], protofil_mols[i][t + 1], threefold_trans) mdl.update() print("||||| All sym constraints added |||||") # Write a single-frame RMF to view the system out = IMP.pmi.output.Output() out.init_rmf("symmetry_test1.rmf3", hierarchies=[root_hier]) out.write_rmf("symmetry_test1.rmf3")