Skip to content
Snippets Groups Projects
Commit e080a990 authored by Christian Faber's avatar Christian Faber
Browse files

added rmsd per residue

parent f15583ba
Branches
Tags
No related merge requests found
...@@ -117,10 +117,10 @@ def rmsd_from_rot_tran( ...@@ -117,10 +117,10 @@ def rmsd_from_rot_tran(
:return: RMSD like value (:math:`\sqrt{E}`) :return: RMSD like value (:math:`\sqrt{E}`)
:rtype: float :rtype: float
""" """
print(trans.shape) num_vec = x.shape[1]
print(np.matmul(rot, x).shape, y.shape) intermediate = np.matmul(rot, x) + trans[:, np.newaxis] + y
squared = np.trace(np.matmul(np.transpose(intermediate), intermediate)) / num_vec
return 0.0 return np.sqrt(squared)
def rmsd(x: np.ndarray, y: np.ndarray) -> float: def rmsd(x: np.ndarray, y: np.ndarray) -> float:
...@@ -220,9 +220,9 @@ def rmsd_per_residue(file1: str, file2: str) -> list[float]: ...@@ -220,9 +220,9 @@ def rmsd_per_residue(file1: str, file2: str) -> list[float]:
res2_AA = [list(a.get_vector()) for a in res2.get_atoms()] res2_AA = [list(a.get_vector()) for a in res2.get_atoms()]
res1_AA = np.transpose(np.array(res1_AA)) res1_AA = np.transpose(np.array(res1_AA))
res2_AA = np.transpose(np.array(res2_AA)) res2_AA = np.transpose(np.array(res2_AA))
rmsd_from_rot_tran(res1_AA, res2_AA, rot, trans) values.append(rmsd_from_rot_tran(res1_AA, res2_AA, rot, trans))
return [0.0] return values
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -32,7 +32,6 @@ def main(): ...@@ -32,7 +32,6 @@ def main():
rot, tran = sup.get_rotran() rot, tran = sup.get_rotran()
# rmsd per residue # rmsd per residue
print(rmsd.rmsd_per_residue(file1, file2)) print(rmsd.rmsd_per_residue(file1, file2))
print("Hallo Welt", val, val2)
if __name__ == "__main__": if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment