Пример #1
0
 def set_native_assembly_for_benchmark(self, params):
     """
         Sets the native model for benchmark, by reading the native
         structure and set the rigid bodies.
         @param fn_pdb_native PDB with the native structure
         @param anchored List of True/False values indicating
             if the components of the assembly are anchored. The function
             sets the FIRST anchored component in the (0,0,0) coordinate
             and moves the other components with the same translation
     """
     self.measure_models = True
     self.native_model = IMP.Model()
     if hasattr(params.benchmark, "fn_pdb_native"):
         self.native_assembly = \
             representation.create_assembly_from_pdb(self.native_model,
                           params.benchmark.fn_pdb_native, params.names)
     elif hasattr(params.benchmark, "fn_pdbs_native"):
         self.native_assembly = \
             representation.create_assembly(self.native_model,
                       params.benchmark.fn_pdbs_native, params.names)
     else:
         raise ValueError("set_native_assembly_for_benchmark: Requested " \
             "to set a native assembly for benchmark but did not provide " \
             "its pdb, or the pdbs of the components" )
     self.native_rbs = representation.create_rigid_bodies(self.native_assembly)
     anchor_assembly(self.native_rbs, params.anchor)
Пример #2
0
 def do_clustering(self, confs_RFs, max_rmsd):
     """
         Cluster configurations for a model based on RMSD.
         An IMP.ConfigurationSet is built using the reference frames for
         of the components of the assembly for each solution
         @param confs_RFs A lsit containing a tuples of reference frames.
             Each tuple contains the reference frame for the rigid body
             of one component of the assembly
         @param max_rmsd Maximum RMSD tolerated when clustering
     """
     model = IMP.Model()
     assembly = representation.create_assembly(model, self.exp.fn_pdbs)
     rbs = representation.create_rigid_bodies(assembly)
     configuration_set = IMP.ConfigurationSet(model)
     for RFs in confs_RFs:
         representation.set_reference_frames(rbs, RFs)
         configuration_set.save_configuration()
     particles_container = container.ListSingletonContainer(model)
     particles_container.add_particles(atom.get_leaves(assembly))
     metric = stats.ConfigurationSetRMSDMetric(
                             configuration_set,particles_container, True)
     log.info("Clustering ... ")
     maximum_centrality = 10
     self.pclus = stats.create_centrality_clustering( metric, max_rmsd,
                                             maximum_centrality)
     n = self.pclus.get_number_of_clusters()
     log.info("Number of clusters found: %s", n)
Пример #3
0
Файл: io.py Проект: sirusb/imp
def write_pdb_for_reference_frames(fn_pdbs, refs_texts, fn_output):
    """
        Read the PDB files, apply reference frames to them, and write a pdb
    """
    model = IMP.kernel.Model()
    assembly = representation.create_assembly(model, fn_pdbs)
    rbs = representation.create_rigid_bodies(assembly)
    for t, rb in zip(refs_texts, rbs):
        r = TextToReferenceFrame(t).get_reference_frame()
        rb.set_reference_frame(r)
    atom.write_pdb(assembly, fn_output)
Пример #4
0
def write_pdb_for_reference_frames(fn_pdbs, refs_texts, fn_output):
    """
        Read the PDB files, apply reference frames to them, and write a pdb
    """
    model = IMP.Model()
    assembly = representation.create_assembly(model, fn_pdbs)
    rbs = representation.create_rigid_bodies(assembly)
    for t, rb in zip(refs_texts, rbs):
        r = TextToReferenceFrame(t).get_reference_frame()
        rb.set_reference_frame(r)
    atom.write_pdb(assembly, fn_output)
Пример #5
0
 def set_assembly(self, fn_pdb, names):
     """
         Sets an assembly from a single PDB file. The function assumes that
         the components of the assembly are the chains of the PDB file.
         @param fn_pdb PDB with the file for the asembly
         @param names Names for each of the components (chains)
             of the asembly
     """
     self.assembly = representation.create_assembly_from_pdb(self.model,
                                                          fn_pdb,
                                                          names)
     self.components_rbs = representation.create_rigid_bodies(self.assembly)
     self.not_optimized_rbs = []
Пример #6
0
 def set_assembly_components(self, fn_pdbs, names):
     """
         Sets the components of an assembly, each one given as a separate
         PDB file.
         @param fn_pdbs List with the names of the pdb files
         @param names List with the names of the components of the assembly.
     """
     if len(fn_pdbs) != len(names):
         raise ValueError("Each PDB file needs a name")
     self.names = names
     self.assembly = representation.create_assembly(self.model, fn_pdbs,
                                                                     names)
     self.components_rbs = representation.create_rigid_bodies(self.assembly)
     self.not_optimized_rbs = []
Пример #7
0
 def set_native_assembly_for_benchmark(self, fn_pdb_native, anchored, names):
     """
         Sets the native model for benchmark, by reading the native
         structure and set the rigid bodies.
         @param fn_pdb_native PDB with the native structure
         @param anchored List of True/False values indicating
             if the components of the assembly are anchored. The function
             sets the FIRST anchored component in the (0,0,0) coordinate
             and moves the other components with the same translation
     """
     self.measure_models = True
     self.native_model = IMP.Model()
     self.native_assembly = \
             representation.create_assembly_from_pdb(self.native_model,
                                                   fn_pdb_native, names)
     self.native_rbs = representation.create_rigid_bodies(
                                             self.native_assembly)
     anchor_assembly(self.native_rbs, anchored)
Пример #8
0
 def set_native_assembly_for_benchmark(self, params):
     """
         Sets the native model for benchmark, by reading the native
         structure and set the rigid bodies.
     """
     self.measure_models = True
     self.native_model = IMP.kernel.Model()
     if hasattr(params.benchmark, "fn_pdb_native"):
         self.native_assembly = \
             representation.create_assembly_from_pdb(self.native_model,
                           params.benchmark.fn_pdb_native, params.names)
     elif hasattr(params.benchmark, "fn_pdbs_native"):
         self.native_assembly = \
             representation.create_assembly(self.native_model,
                       params.benchmark.fn_pdbs_native, params.names)
     else:
         raise ValueError("set_native_assembly_for_benchmark: Requested " \
             "to set a native assembly for benchmark but did not provide " \
             "its pdb, or the pdbs of the components" )
     self.native_rbs = representation.create_rigid_bodies(self.native_assembly)
     anchor_assembly(self.native_rbs, params.anchor)