Example #1
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 assembly
         @param names Names for each of the components (chains)
             of the assembly
     """
     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 = []
Example #2
0
File: io.py Project: newtonjoo/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)
Example #3
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.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)
Example #4
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 = []
Example #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 assembly
         @param names Names for each of the components (chains)
             of the assembly
     """
     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 = []
Example #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 = []
Example #7
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.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)
Example #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.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)