コード例 #1
0
    def test_symmetry_disables_movers(self):
        """Test the creation of symmetries"""
        import math
        mdl = IMP.Model()
        s, m1, m2, m3 = self.init_topology_clones(mdl)
        dof = IMP.pmi.dof.DegreesOfFreedom(mdl)
        rb1_movers, rb1 = dof.create_rigid_body(
            m1, nonrigid_parts=m1.get_non_atomic_residues(), name="test RB 1")
        rb2_movers, rb2 = dof.create_rigid_body(
            m2, nonrigid_parts=m2.get_non_atomic_residues(), name="test RB 2")
        rb3_movers, rb3 = dof.create_rigid_body(
            m3, nonrigid_parts=m3.get_non_atomic_residues(), name="test RB 3")
        mvs = dof.get_movers()
        self.assertEqual(len(mvs), 12)

        rotational_axis = IMP.algebra.Vector3D(0, 0, 1.0)

        rotation_angle_12 = 2.0 * math.pi / float(3) * float(1)
        rotation3D_12 = IMP.algebra.get_rotation_about_axis(
            rotational_axis, rotation_angle_12)
        dof.constrain_symmetry([m1], [m2], rotation3D_12, resolution='all')

        rotation_angle_13 = 2.0 * math.pi / float(3) * float(2)
        rotation3D_13 = IMP.algebra.get_rotation_about_axis(
            rotational_axis, rotation_angle_13)
        dof.constrain_symmetry([m1], [m3], rotation3D_13, resolution='all')
        mvs = dof.get_movers()
        mdl.update()
        self.assertEqual(len(mvs), 4)
コード例 #2
0
ファイル: test_dof.py プロジェクト: salilab/imp
    def test_constraint_symmetry(self):
        """Test setup and activity of symmetry constraint"""
        ### create representation
        mdl = IMP.Model()
        s = IMP.pmi.topology.System(mdl)
        st1 = s.create_state()
        seqs = IMP.pmi.topology.Sequences(self.get_input_file_name('seqs.fasta'))

        m1 = st1.create_molecule("Prot1",sequence=seqs["Protein_1"])
        a1 = m1.add_structure(self.get_input_file_name('prot.pdb'),
                              chain_id='A',res_range=(55,63),offset=-54)
        m1.add_representation(a1,resolutions=[0,1])
        m1.add_representation(m1.get_non_atomic_residues(),resolutions=[1])
        m3 = m1.create_clone(chain_id='C')

        m2 = st1.create_molecule("Prot2",sequence=seqs["Protein_2"])
        a2 = m2.add_structure(self.get_input_file_name('prot.pdb'),
                              chain_id='B',res_range=(180,192),offset=-179)
        m2.add_representation(a2,resolutions=[0,1])
        m4 = m2.create_clone(chain_id='D')
        root = s.build()


        ### create movers and constraints
        dof = IMP.pmi.dof.DegreesOfFreedom(mdl)
        rb1_movers = dof.create_rigid_body(m1,
                                           nonrigid_parts = m1.get_non_atomic_residues())
        rb2_movers = dof.create_rigid_body(m2,
                                           nonrigid_parts = m2.get_non_atomic_residues())
        dof.create_rigid_body(m3,
                              nonrigid_parts = m3.get_non_atomic_residues())
        dof.create_rigid_body(m4,
                              nonrigid_parts = m4.get_non_atomic_residues())

        sym_trans = IMP.algebra.get_random_local_transformation(IMP.algebra.Vector3D(0,0,0))
        inverse_sym_trans=sym_trans.get_inverse()
        dof.constrain_symmetry([m1,m2],[m3,m4],sym_trans)

        m1_leaves = IMP.pmi.tools.select_at_all_resolutions(m1.get_hierarchy())
        m3_leaves = IMP.pmi.tools.select_at_all_resolutions(m3.get_hierarchy())

        ### test symmetry initially correct
        mdl.update()
        for p1,p3 in zip(m1_leaves,m3_leaves):
            c1 = IMP.core.XYZ(p1).get_coordinates()
            c3 = inverse_sym_trans*IMP.core.XYZ(p3).get_coordinates()
            print("AAA",c1,c3)
            #for i in range(3):
            #    self.assertAlmostEqual(c1[i],c3[i])

        ### test transformation propagates
        rbs,beads = IMP.pmi.tools.get_rbs_and_beads(m1_leaves)
        test_trans = IMP.algebra.get_random_local_transformation(IMP.algebra.Vector3D(0,0,0))
        IMP.core.transform(rbs[0],test_trans)
        mdl.update()
        for p1,p3 in zip(m1_leaves,m3_leaves):
            c1 = IMP.core.XYZ(p1).get_coordinates()
            c3 = inverse_sym_trans*IMP.core.XYZ(p3).get_coordinates()
            for i in range(3):
                self.assertAlmostEqual(c1[i],c3[i])
コード例 #3
0
ファイル: test_dof.py プロジェクト: salilab/imp
    def test_symmetry_disables_movers(self):
        """Test the creation of symmetries"""
        import math
        mdl = IMP.Model()
        s,m1,m2,m3 = self.init_topology_clones(mdl)
        dof = IMP.pmi.dof.DegreesOfFreedom(mdl)
        rb1_movers,rb1 = dof.create_rigid_body(m1,
                                             nonrigid_parts = m1.get_non_atomic_residues(),
                                             name="test RB 1")
        rb2_movers,rb2 = dof.create_rigid_body(m2,
                                             nonrigid_parts = m2.get_non_atomic_residues(),
                                             name="test RB 2")
        rb3_movers,rb3 = dof.create_rigid_body(m3,
                                             nonrigid_parts = m3.get_non_atomic_residues(),
                                             name="test RB 3")
        mvs = dof.get_movers()
        self.assertEqual(len(mvs),12)

        rotational_axis=IMP.algebra.Vector3D(0, 0, 1.0)

        rotation_angle_12 = 2.0 * math.pi / float(3) * float(1)
        rotation3D_12 = IMP.algebra.get_rotation_about_axis(rotational_axis, rotation_angle_12)
        dof.constrain_symmetry(
                           [m1],
                           [m2],
                           rotation3D_12,
                           resolution='all')

        rotation_angle_13 = 2.0 * math.pi / float(3) * float(2)
        rotation3D_13 = IMP.algebra.get_rotation_about_axis(rotational_axis, rotation_angle_13)
        dof.constrain_symmetry(
                           [m1],
                           [m3],
                           rotation3D_13,
                           resolution='all')
        mvs = dof.get_movers()
        mdl.update()
        self.assertEqual(len(mvs),4)
コード例 #4
0
ファイル: docking.py プロジェクト: Pellarin/T6SS_Base_Plate.2
copies = bs.get_molecules()[0]['TssK']

rotational_axis = IMP.algebra.Vector3D(0, 0, 1.0)

for n, c in enumerate(copies[1:]):
    print(n, c)
    rotation_angle = 2.0 * math.pi / float(len(copies)) * float(n + 1)
    rotation3D = IMP.algebra.get_rotation_about_axis(rotational_axis,
                                                     rotation_angle)
    transformation3D = IMP.algebra.get_rotation_about_point(
        IMP.algebra.Vector3D(126.41989953, 126.03652216, 0.00000000),
        rotation3D)

    dof.constrain_symmetry([copies[0]], [c],
                           transformation3D,
                           resolution='all')

import IMP.pmi.io
import IMP.pmi.io.crosslink
import IMP.pmi.restraints
import IMP.pmi.restraints.crosslinking
from IMP.pmi.io.crosslink import FilterOperator as FO
import operator

rplp = IMP.pmi.io.crosslink.ResiduePairListParser("MSSTUDIO")
cldbkc = IMP.pmi.io.crosslink.CrossLinkDataBaseKeywordsConverter(rplp)
cldbkc.set_protein1_key("Protein 1")
cldbkc.set_protein2_key("Protein 2")
cldbkc.set_site_pairs_key("Selected Sites")
cldbkc.set_id_score_key("E")
コード例 #5
0
    def test_constraint_symmetry(self):
        """Test setup and activity of symmetry constraint"""
        ### create representation
        mdl = IMP.Model()
        s = IMP.pmi.topology.System(mdl)
        st1 = s.create_state()
        seqs = IMP.pmi.topology.Sequences(
            self.get_input_file_name('seqs.fasta'))

        m1 = st1.create_molecule("Prot1", sequence=seqs["Protein_1"])
        a1 = m1.add_structure(self.get_input_file_name('prot.pdb'),
                              chain_id='A',
                              res_range=(55, 63),
                              offset=-54)
        m1.add_representation(a1, resolutions=[0, 1])
        m1.add_representation(m1.get_non_atomic_residues(), resolutions=[1])
        m3 = m1.create_clone(chain_id='C')

        m2 = st1.create_molecule("Prot2", sequence=seqs["Protein_2"])
        a2 = m2.add_structure(self.get_input_file_name('prot.pdb'),
                              chain_id='B',
                              res_range=(180, 192),
                              offset=-179)
        m2.add_representation(a2, resolutions=[0, 1])
        m4 = m2.create_clone(chain_id='D')
        root = s.build()

        ### create movers and constraints
        dof = IMP.pmi.dof.DegreesOfFreedom(mdl)
        rb1_movers = dof.create_rigid_body(
            m1, nonrigid_parts=m1.get_non_atomic_residues())
        rb2_movers = dof.create_rigid_body(
            m2, nonrigid_parts=m2.get_non_atomic_residues())
        dof.create_rigid_body(m3, nonrigid_parts=m3.get_non_atomic_residues())
        dof.create_rigid_body(m4, nonrigid_parts=m4.get_non_atomic_residues())

        sym_trans = IMP.algebra.get_random_local_transformation(
            IMP.algebra.Vector3D(0, 0, 0))
        inverse_sym_trans = sym_trans.get_inverse()
        dof.constrain_symmetry([m1, m2], [m3, m4], sym_trans)

        m1_leaves = IMP.pmi.tools.select_at_all_resolutions(m1.get_hierarchy())
        m3_leaves = IMP.pmi.tools.select_at_all_resolutions(m3.get_hierarchy())

        ### test symmetry initially correct
        mdl.update()
        for p1, p3 in zip(m1_leaves, m3_leaves):
            c1 = IMP.core.XYZ(p1).get_coordinates()
            c3 = inverse_sym_trans * IMP.core.XYZ(p3).get_coordinates()
            print("AAA", c1, c3)
            #for i in range(3):
            #    self.assertAlmostEqual(c1[i],c3[i])

        ### test transformation propagates
        rbs, beads = IMP.pmi.tools.get_rbs_and_beads(m1_leaves)
        test_trans = IMP.algebra.get_random_local_transformation(
            IMP.algebra.Vector3D(0, 0, 0))
        IMP.core.transform(rbs[0], test_trans)
        mdl.update()
        for p1, p3 in zip(m1_leaves, m3_leaves):
            c1 = IMP.core.XYZ(p1).get_coordinates()
            c3 = inverse_sym_trans * IMP.core.XYZ(p3).get_coordinates()
            for i in range(3):
                self.assertAlmostEqual(c1[i], c3[i])
コード例 #6
0
                                  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")

# -----------------------------ADD RESTRAINTS ------------------------------------

# ______External Barrier Restraint__________________________________________________________________________
# get the center of mass of the fibril
Fibril_sel = IMP.atom.Selection(root_hier, molecule="Abeta")
fib_particles = Fibril_sel.get_selected_particles()
コード例 #7
0
ファイル: symmetry.py プロジェクト: Stochastic13/pmi
chains='BCDEFGHI'
for nc in range(7):
    clone = mol.create_clone(chains[nc])
    mols.append(clone)

hier = s.build()

# Create a symmetry constraint
#  A constrant is invariant: IMP will automatically move all clones to match the reference
#  If instead you want some more flexiblity, consider IMP.pmi.restraints.stereochemistry.SymmetryRestraint
dof = IMP.pmi.dof.DegreesOfFreedom(mdl)
center = IMP.algebra.Vector3D([50,0,0])
for nc in range(7):
    rot = IMP.algebra.get_rotation_about_axis([0,0,1],2*math.pi*(nc+1)/8)
    transform = IMP.algebra.get_rotation_about_point(center,rot)
    dof.constrain_symmetry(mols[0],mols[nc+1],transform)
mdl.update() # propagates coordinates


############ Make stuff look cool with restraints ###########

# set up the original molecule as flexible beads
dof.create_flexible_beads(mols[0])

# Create a connectivity restraint for the first molecule
cr = IMP.pmi.restraints.stereochemistry.ConnectivityRestraint(objects=mol)
cr.add_to_model()

# Create excluded volume for all particles
evr = IMP.pmi.restraints.stereochemistry.ExcludedVolumeSphere(included_objects=mols)
evr.add_to_model()
コード例 #8
0
ファイル: symmetry.py プロジェクト: j-ma-bu-l-l-ock/imp
chains='BCDEFGHI'
for nc in range(7):
    clone = mol.create_clone(chains[nc])
    mols.append(clone)

hier = s.build()

# Create a symmetry constraint
#  A constrant is invariant: IMP will automatically move all clones to match the reference
#  If instead you want some more flexiblity, consider IMP.pmi.restraints.stereochemistry.SymmetryRestraint
dof = IMP.pmi.dof.DegreesOfFreedom(mdl)
center = IMP.algebra.Vector3D([50,0,0])
for nc in range(7):
    rot = IMP.algebra.get_rotation_about_axis([0,0,1],2*math.pi*(nc+1)/8)
    transform = IMP.algebra.get_rotation_about_point(center,rot)
    dof.constrain_symmetry(mols[0],mols[nc+1],transform)
mdl.update() # propagates coordinates


############ Make stuff look cool with restraints ###########

# set up the original molecule as flexible beads
dof.create_flexible_beads(mols[0])

# Create a connectivity restraint for the first molecule
cr = IMP.pmi.restraints.stereochemistry.ConnectivityRestraint(objects=mol)
cr.add_to_model()

# Create excluded volume for all particles
evr = IMP.pmi.restraints.stereochemistry.ExcludedVolumeSphere(included_objects=mols)
evr.add_to_model()