def get_restraints_for_native(self, restraints_names): """ Get values of the restraints for the native structure @param restraints_names Names of the restraints requested @return a list with the values of all scores, and the total score """ saved = [rb.get_reference_frame() for rb in self.components_rbs] # Set the state of the model to native for rb, rn in zip(self.components_rbs, self.native_rbs): # remove sub-rigid bodies rb_members = [m for m in rb.get_members() if not core.RigidBody.get_is_setup(m.get_particle())] rn_members = [m for m in rn.get_members() if not core.RigidBody.get_is_setup(m.get_particle())] rb_coords = [m.get_coordinates() for m in rb_members] rn_coords = [m.get_coordinates() for m in rn_members] # align and put rb in the position of rn if len(rn_coords) != len(rb_coords): raise ValueError("Mismatch in the number of members. " "Reference %d Aligned %d " % (len(rn_coords), len(rb_coords))) T = alg.get_transformation_aligning_first_to_second(rb_coords, rn_coords) t = rb.get_reference_frame().get_transformation_to() new_t = alg.compose(T, t) rb.set_reference_frame(alg.ReferenceFrame3D(new_t)) scores = [] for name in restraints_names: scores.append(self.restraints[name].evaluate(False)) total_score = sum(scores) representation.set_reference_frames(self.components_rbs, saved) return scores, total_score
def get_restraints_for_native(self, restraints_names): """ Get values of the restraints for the native structure @param restraints_names Names of the restraints requested @return a list with the values of all scores, and the total score """ saved = [rb.get_reference_frame() for rb in self.components_rbs] # Set the state of the model to native for rb, rn in zip(self.components_rbs, self.native_rbs): # remove sub-rigid bodies rb_members = [m for m in rb.get_members() if not core.RigidBody.get_is_setup(m.get_particle())] rn_members = [m for m in rn.get_members() if not core.RigidBody.get_is_setup(m.get_particle())] rb_coords = [m.get_coordinates() for m in rb_members] rn_coords = [m.get_coordinates() for m in rn_members] # align and put rb in the position of rn if len(rn_coords) != len(rb_coords): raise ValueError("Mismatch in the number of members. " "Reference %d Aligned %d " % (len(rn_coords), len(rb_coords))) T = alg.get_transformation_aligning_first_to_second(rb_coords, rn_coords) t = rb.get_reference_frame().get_transformation_to() new_t = alg.compose(T, t) rb.set_reference_frame(alg.ReferenceFrame3D(new_t)) scores = [] for name in restraints_names: scores.append(self.restraints[name].evaluate(False)) total_score = sum(scores) representation.set_reference_frames(self.components_rbs, saved) return scores, total_score
def write_pdb_for_reference_frames(self, RFs, fn_pdb): """ Write a PDB file with a solution given by a set of reference frames @param RFs Reference frames for the elements of the complex @param fn_pdb File to write the solution """ log.debug("Writting PDB %s for reference frames %s", fn_pdb, RFs) representation.set_reference_frames(self.components_rbs, RFs) atom.write_pdb(self.assembly, fn_pdb)
def write_pdb_for_reference_frames(self, RFs, fn_pdb): """ Write a PDB file with a solution given by a set of reference frames @param RFs Reference frames for the elements of the complex @param fn_pdb File to write the solution """ log.debug("Writting PDB %s for reference frames %s", fn_pdb, RFs) representation.set_reference_frames(self.components_rbs, RFs) atom.write_pdb(self.assembly, fn_pdb)
def write_pdbs_for_reference_frames(self, RFs, fn_base): """ Write a separate PDB for each of the elements @param RFs Reference frames for the elements of the complex @param fn_base base string to build the names of the PDBs files """ log.debug("Writting PDBs with basename %s", fn_base) representation.set_reference_frames(self.components_rbs, RFs) for i, ch in enumerate(self.assembly.get_children()): atom.write_pdb(ch, fn_base + "component-%02d.pdb" % i)
def write_pdbs_for_reference_frames(self, RFs, fn_base): """ Write a separate PDB for each of the elements @param RFs Reference frames for the elements of the complex @param fn_base base string to build the names of the PDBs files """ log.debug("Writting PDBs with basename %s", fn_base) representation.set_reference_frames(self.components_rbs, RFs) for i, ch in enumerate(self.assembly.get_children()): atom.write_pdb(ch, fn_base + "component-%02d.pdb" % i)