예제 #1
0
    def test_ccs_value(self):
        """Test the calculation of the collision cross section of a complex"""
        IMP.base.set_log_level(IMP.base.TERSE)
        m = IMP.kernel.Model()

        fn = self.get_input_file_name("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))
        ccs_calculated = ccs.get_ccs()
        ccs_value = 3838  # A**2
        # good within 2%
        self.assertAlmostEqual(
            ccs_calculated,
            ccs_value,
            delta=ccs_value * 0.02)
예제 #2
0
def read_component(model,fn_pdb, name=False):
    """ Read a PDB molecule, add atoms, and set a name
    """
    log.debug("reading component %s from %s", name, fn_pdb)
    hierarchy =  atom.read_pdb(fn_pdb, model,
                                  atom.NonWaterNonHydrogenPDBSelector())
    if(name):
        hierarchy.set_name(name)
    atom.add_radii(hierarchy)
    return hierarchy
예제 #3
0
def read_component(model, fn_pdb, name=False):
    """ Read a PDB molecule, add atoms, and set a name
    """
    if name:
        log.debug("reading component %s from %s", name, fn_pdb)
    else:
        log.debug("reading component from %s", fn_pdb)

    hierarchy = atom.read_pdb(fn_pdb, model,
                              atom.NonWaterNonHydrogenPDBSelector())
    if name:
        hierarchy.set_name(name)
    atom.add_radii(hierarchy)
    return hierarchy
예제 #4
0
def create_assembly_from_pdb(model, fn_pdb, names=False):
    """
        Builds the assembly setting the chains in the PDB file as components
    """
    temp = read_component(model, fn_pdb)
    hchains = atom.get_by_type(temp, atom.CHAIN_TYPE)
    ids = [atom.Chain(h).get_id() for h in hchains]
    log.debug("Creating assembly from pdb %s,names: %s. Chains %s",
                                                        fn_pdb, names, ids)
    atom.add_radii(temp)
    if(names):
        for i, h in enumerate(hchains):
            h.set_name(names[i])
    assembly = IMP.atom.Molecule.setup_particle(temp)
    return assembly
예제 #5
0
def create_assembly_from_pdb(model, fn_pdb, names=False):
    """
        Builds the assembly setting the chains in the PDB file as components
    """
    temp = read_component(model, fn_pdb)
    hchains = atom.get_by_type(temp, atom.CHAIN_TYPE)
    ids = [atom.Chain(h).get_id() for h in hchains]
    log.debug("Creating assembly from pdb %s,names: %s. Chains %s", fn_pdb,
              names, ids)
    atom.add_radii(temp)
    if (names):
        for i, h in enumerate(hchains):
            h.set_name(names[i])
    assembly = IMP.atom.Molecule.setup_particle(temp)
    return assembly
예제 #6
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)
예제 #7
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"
예제 #8
0
## 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.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"