def get_rmsd(pdb1, pdb2, segments1, segments2, atom_types): polymer1 = polymer.Polymer(pdb1) atoms1 = get_superposable_atoms(polymer1, segments1, atom_types) polymer2 = polymer.Polymer(pdb2) atoms2 = get_superposable_atoms(polymer2, segments2, atom_types) center1 = molecule.get_center(atoms1) polymer1.transform(vector3d.Translation(-center1)) polymer2.transform(vector3d.Translation(-molecule.get_center(atoms2))) crds1 = get_crds(atoms1) crds2 = get_crds(atoms2) return rmsd(crds1, crds2)
def get_best_alignment_with_residues(pdb1, pdb2, segments1, segments2, atom_types): polymer1 = polymer.Polymer(pdb1) atoms1 = get_superposable_atoms(polymer1, segments1, atom_types) polymer2 = polymer.Polymer(pdb2) atoms2 = get_superposable_atoms(polymer2, segments2, atom_types) center1 = molecule.get_center(atoms1) polymer1.transform(vector3d.Translation(-center1)) polymer2.transform(vector3d.Translation(-molecule.get_center(atoms2))) polymer2.transform(calculate_superposition_matrix(atoms1, atoms2)) residue_rmsd, overall_rmsd = residues_rmsd(atoms1, atoms2) return residue_rmsd, overall_rmsd
def get_best_alignment(pdb1, pdb2, segments1, segments2, atom_types): """Returns rmsd and filename of transformed pdb2.""" polymer1 = polymer.Polymer(pdb1) atoms1 = get_superposable_atoms(polymer1, segments1, atom_types) polymer2 = polymer.Polymer(pdb2) atoms2 = get_superposable_atoms(polymer2, segments2, atom_types) center1 = molecule.get_center(atoms1) polymer1.transform(vector3d.Translation(-center1)) polymer2.transform(vector3d.Translation(-molecule.get_center(atoms2))) polymer2.transform(calculate_superposition_matrix(atoms1, atoms2)) rmsd = sum_rmsd(atoms1, atoms2) return rmsd
def com_to_zero(self): self.transform(vector3d.Translation(-self.com()))
def center_box(self): sys.stderr.write("Centering the box around " + str(self._box_center.x) + " " + str(self._box_center.y) + " " + str(self._box_center.z) + "\n") self.transform(vector3d.Translation(-self._box_center))