From fe3bb12746fb2a743868061140360047979bac61 Mon Sep 17 00:00:00 2001 From: Mohit Kumar Date: Thu, 29 Jun 2023 11:15:26 +0530 Subject: [PATCH 01/19] Align.py --- package/MDAnalysis/analysis/align.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index 9bb9f4798e2..aff9c504c70 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -246,8 +246,11 @@ def rotation_matrix(a, b, weights=None): :meth:`MDAnalysis.core.groups.AtomGroup.rotate` to generate a rotated selection, e.g. :: + >>> from MDAnalysisTests.datafiles import TPR, TRR + >>> A = mda.Universe('topol.tpr','traj.trr') + >>> B = A.copy() >>> R = rotation_matrix(A.select_atoms('backbone').positions, - >>> B.select_atoms('backbone').positions)[0] + ... B.select_atoms('backbone').positions)[0] >>> A.atoms.rotate(R) >>> A.atoms.write("rotated.pdb") From 4b7e9fd2791664d68edaf3211d4889b4e7feece6 Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Sat, 1 Jul 2023 19:30:31 +0530 Subject: [PATCH 02/19] Update align.py --- package/MDAnalysis/analysis/align.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index aff9c504c70..c468924f42a 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -247,11 +247,12 @@ def rotation_matrix(a, b, weights=None): selection, e.g. :: >>> from MDAnalysisTests.datafiles import TPR, TRR - >>> A = mda.Universe('topol.tpr','traj.trr') + >>> from MDAnalysis.analysis import align + >>> A = mda.Universe(TPR, TRR) >>> B = A.copy() - >>> R = rotation_matrix(A.select_atoms('backbone').positions, - ... B.select_atoms('backbone').positions)[0] - >>> A.atoms.rotate(R) + >>> R = align.rotation_matrix(A.select_atoms('backbone').positions, + ... B.select_atoms('backbone').positions)[0] + >>> A.atoms.rotate(R) # doctest: +SKIP >>> A.atoms.write("rotated.pdb") Notes From 3516f2e2fecd6f30b40cd1f036e78bc5b692b51e Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Sun, 2 Jul 2023 12:53:38 +0530 Subject: [PATCH 03/19] Update align.py --- package/MDAnalysis/analysis/align.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index c468924f42a..8d4e39370e4 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -90,7 +90,7 @@ minimized RMSD between the reference and mobile structure. >>> rmsd(mobile.select_atoms('name CA').positions, ref.select_atoms('name CA').positions, - >>> superposition=True) + ... superposition=True) 6.809396586471815 The rotation matrix that superimposes *mobile* on *ref* while @@ -100,18 +100,21 @@ >>> mobile0 = mobile.select_atoms('name CA').positions - mobile.select_atoms('name CA').center_of_mass() >>> ref0 = ref.select_atoms('name CA').positions - ref.select_atoms('name CA').center_of_mass() >>> R, rmsd = align.rotation_matrix(mobile0, ref0) - >>> print rmsd + >>> rmsd 6.809396586471805 - >>> print R - [[ 0.14514539 -0.27259113 0.95111876] - [ 0.88652593 0.46267112 -0.00268642] - [-0.43932289 0.84358136 0.30881368]] + >>> R + array([[ 0.14514539, -0.27259113, 0.95111876], + [ 0.88652593, 0.46267112, -0.00268642], + [-0.43932289, 0.84358136, 0.30881368]]) Putting all this together one can superimpose all of *mobile* onto *ref*:: >>> mobile.atoms.translate(-mobile.select_atoms('name CA').center_of_mass()) + >>> mobile.atoms.rotate(R) + >>> mobile.atoms.translate(ref.select_atoms('name CA').center_of_mass()) + >>> mobile.atoms.write("mobile_on_ref.pdb") @@ -123,6 +126,7 @@ >>> ref = mda.Universe(PSF, PDB_small) >>> mobile = mda.Universe(PSF, DCD) # we use the first frame >>> align.alignto(mobile, ref, select="protein and name CA", weights="mass") + (21.892591663632704, 6.809396586471809) This will change *all* coordinates in *mobile* so that the protein C-alpha atoms are optimally superimposed (translation and rotation). @@ -133,7 +137,7 @@ >>> ref = mda.Universe(PSF, PDB_small) # reference structure 1AKE >>> trj = mda.Universe(PSF, DCD) # trajectory of change 1AKE->4AKE >>> alignment = align.AlignTraj(trj, ref, filename='rmsfit.dcd') - >>> alignment.run() + >>> alignment.run() # doctest:+SKIP It is also possible to align two arbitrary structures by providing a mapping between atoms based on a sequence alignment. This allows @@ -143,9 +147,9 @@ the appropriate MDAnalysis selections with the :func:`fasta2select` function and then feed the resulting dictionary to :class:`AlignTraj`:: - >>> seldict = align.fasta2select('sequences.aln') - >>> alignment = align.AlignTraj(trj, ref, filename='rmsfit.dcd', select=seldict) - >>> alignment.run() + >>> seldict = align.fasta2select('sequences.aln') # doctest:+SKIP + >>> alignment = align.AlignTraj(trj, ref, filename='rmsfit.dcd', select=seldict) # doctest:+SKIP + >>> alignment.run() # doctest:+SKIP (See the documentation of the functions for this advanced usage.) @@ -252,7 +256,8 @@ def rotation_matrix(a, b, weights=None): >>> B = A.copy() >>> R = align.rotation_matrix(A.select_atoms('backbone').positions, ... B.select_atoms('backbone').positions)[0] - >>> A.atoms.rotate(R) # doctest: +SKIP + >>> A.atoms.rotate(R) + >>> A.atoms.write("rotated.pdb") Notes From 847eb5b6613d46031dd8fa9e65b72e2787ece287 Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Sun, 2 Jul 2023 13:33:31 +0530 Subject: [PATCH 04/19] Update AUTHORS --- package/AUTHORS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/AUTHORS b/package/AUTHORS index 0b0a4b3e9d8..cc5c80974c9 100644 --- a/package/AUTHORS +++ b/package/AUTHORS @@ -202,6 +202,8 @@ Chronological list of authors - Utsav Khatu - Patricio Barletta - Mikhail Glagolev +2023 + - Mohit Kumar External code From 2a2caecd7cf86d1c0a9ad7bfe7c0882784a2a256 Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Sun, 2 Jul 2023 13:47:39 +0530 Subject: [PATCH 05/19] Update AUTHORS --- package/AUTHORS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/AUTHORS b/package/AUTHORS index cc5c80974c9..3b5f891d734 100644 --- a/package/AUTHORS +++ b/package/AUTHORS @@ -203,7 +203,9 @@ Chronological list of authors - Patricio Barletta - Mikhail Glagolev 2023 +<<<<<<< 3365 - Mohit Kumar +>>>>>>> develop External code From d41d38ded1ca108029809e145dbb63fb2875d719 Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Sun, 2 Jul 2023 13:53:11 +0530 Subject: [PATCH 06/19] Update AUTHORS --- package/AUTHORS | 4 ---- 1 file changed, 4 deletions(-) diff --git a/package/AUTHORS b/package/AUTHORS index 3b5f891d734..0b0a4b3e9d8 100644 --- a/package/AUTHORS +++ b/package/AUTHORS @@ -202,10 +202,6 @@ Chronological list of authors - Utsav Khatu - Patricio Barletta - Mikhail Glagolev -2023 -<<<<<<< 3365 - - Mohit Kumar ->>>>>>> develop External code From 3925b0ea63361c6e760ecc6440bc0a12e55e981e Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Sun, 2 Jul 2023 14:25:02 +0530 Subject: [PATCH 07/19] Update CHANGELOG --- package/CHANGELOG | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/package/CHANGELOG b/package/CHANGELOG index 149642ab566..b1361d5543b 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -13,6 +13,17 @@ The rules for this file: * release numbers follow "Semantic Versioning" http://semver.org ------------------------------------------------------------------------------ +07/02/23 Mohit Kumar + + * 2.5.0 + +Fixes + * Fix doctest errors in analysis/align.py (Issue #3365) + +Changes + * Add missed output in docstring. + + ??/??/?? IAlibay, pgbarletta, mglagolev, hmacdope * 2.5.0 From baefd3d1ff8ebef76359fc9c146cb722e8f90634 Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Sun, 2 Jul 2023 15:19:45 +0530 Subject: [PATCH 08/19] Update align.py --- package/MDAnalysis/analysis/align.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index 8d4e39370e4..156028e2d3d 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -134,10 +134,14 @@ To **fit a whole trajectory** to a reference structure with the :class:`AlignTraj` class:: + >>> import doctest + >>> doctest.ELLIPSIS_MARKER = '-etc-' >>> ref = mda.Universe(PSF, PDB_small) # reference structure 1AKE >>> trj = mda.Universe(PSF, DCD) # trajectory of change 1AKE->4AKE >>> alignment = align.AlignTraj(trj, ref, filename='rmsfit.dcd') - >>> alignment.run() # doctest:+SKIP + >>> alignment.run() # doctest:+ELLIPSIS + -etc- + It is also possible to align two arbitrary structures by providing a mapping between atoms based on a sequence alignment. This allows From 33609dfcf8e6b8ecff0ed96fb293e76f59cb2c97 Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Mon, 3 Jul 2023 06:05:11 +0530 Subject: [PATCH 09/19] Update AUTHORS --- package/AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/package/AUTHORS b/package/AUTHORS index 0279ba7dde5..ba4164e49bc 100644 --- a/package/AUTHORS +++ b/package/AUTHORS @@ -217,6 +217,7 @@ Chronological list of authors - Egor Marin - Shaivi Malik - Daniel J. Evans + - Mohit Kumar External code ------------- From 66ddafc0e3fd4f145009c6a3df2bd5306459101e Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Mon, 3 Jul 2023 08:06:58 +0530 Subject: [PATCH 10/19] Update package/MDAnalysis/analysis/align.py Co-authored-by: Oliver Beckstein --- package/MDAnalysis/analysis/align.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index 156028e2d3d..e38ec70e75a 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -134,8 +134,6 @@ To **fit a whole trajectory** to a reference structure with the :class:`AlignTraj` class:: - >>> import doctest - >>> doctest.ELLIPSIS_MARKER = '-etc-' >>> ref = mda.Universe(PSF, PDB_small) # reference structure 1AKE >>> trj = mda.Universe(PSF, DCD) # trajectory of change 1AKE->4AKE >>> alignment = align.AlignTraj(trj, ref, filename='rmsfit.dcd') From 3257d085ec9b0d1067aaf1556726978e621de5b6 Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Mon, 3 Jul 2023 08:07:06 +0530 Subject: [PATCH 11/19] Update package/MDAnalysis/analysis/align.py Co-authored-by: Oliver Beckstein --- package/MDAnalysis/analysis/align.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index e38ec70e75a..37d3bc15eb3 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -137,8 +137,8 @@ >>> ref = mda.Universe(PSF, PDB_small) # reference structure 1AKE >>> trj = mda.Universe(PSF, DCD) # trajectory of change 1AKE->4AKE >>> alignment = align.AlignTraj(trj, ref, filename='rmsfit.dcd') - >>> alignment.run() # doctest:+ELLIPSIS - -etc- + >>> alignment.run() + It is also possible to align two arbitrary structures by providing a From 7b0378e30b82e8cec0040071687a1559a2e9a54e Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Mon, 3 Jul 2023 10:41:12 +0530 Subject: [PATCH 12/19] Update align.py Literal block issue --- package/MDAnalysis/analysis/align.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index 37d3bc15eb3..846eef3585f 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -74,7 +74,7 @@ two structures, using :func:`rmsd`:: >>> ref = mda.Universe(PDB_small) - >>> mobile = mda.Universe(PSF,DCD) + >>> mobile = mda.Universe(PSF, DCD) >>> rmsd(mobile.select_atoms('name CA').positions, ref.select_atoms('name CA').positions) 28.20178579474479 From 3cdef3e12634abf2ffaec321da82bda9e48037fd Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Mon, 3 Jul 2023 10:50:44 +0530 Subject: [PATCH 13/19] Update align.py --- package/MDAnalysis/analysis/align.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index 846eef3585f..09d06b576af 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -138,8 +138,7 @@ >>> trj = mda.Universe(PSF, DCD) # trajectory of change 1AKE->4AKE >>> alignment = align.AlignTraj(trj, ref, filename='rmsfit.dcd') >>> alignment.run() - - + It is also possible to align two arbitrary structures by providing a mapping between atoms based on a sequence alignment. This allows From 59552d8ea264dd7731ee8a204bef90557b4a9542 Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Mon, 3 Jul 2023 11:28:05 +0530 Subject: [PATCH 14/19] Update align.py skip --- package/MDAnalysis/analysis/align.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index 09d06b576af..c14ee5e2fe1 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -148,9 +148,9 @@ the appropriate MDAnalysis selections with the :func:`fasta2select` function and then feed the resulting dictionary to :class:`AlignTraj`:: - >>> seldict = align.fasta2select('sequences.aln') # doctest:+SKIP - >>> alignment = align.AlignTraj(trj, ref, filename='rmsfit.dcd', select=seldict) # doctest:+SKIP - >>> alignment.run() # doctest:+SKIP + >>> seldict = align.fasta2select('sequences.aln') # doctest: +SKIP + >>> alignment = align.AlignTraj(trj, ref, filename='rmsfit.dcd', select=seldict) # doctest: +SKIP + >>> alignment.run() # doctest: +SKIP (See the documentation of the functions for this advanced usage.) From 164bad160743535af9d5e4a5c6574e81b1f39871 Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Mon, 3 Jul 2023 11:36:12 +0530 Subject: [PATCH 15/19] Update align.py --- package/MDAnalysis/analysis/align.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index c14ee5e2fe1..8100f185ed3 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -104,8 +104,8 @@ 6.809396586471805 >>> R array([[ 0.14514539, -0.27259113, 0.95111876], - [ 0.88652593, 0.46267112, -0.00268642], - [-0.43932289, 0.84358136, 0.30881368]]) + ... [ 0.88652593, 0.46267112, -0.00268642], + ... [-0.43932289, 0.84358136, 0.30881368]]) Putting all this together one can superimpose all of *mobile* onto *ref*:: From 0288406ff8f41bb8f3a4fb4d38e30fc23baf40ec Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Mon, 3 Jul 2023 11:46:11 +0530 Subject: [PATCH 16/19] Update align.py --- package/MDAnalysis/analysis/align.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index 8100f185ed3..29c27ee6b82 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -254,7 +254,7 @@ def rotation_matrix(a, b, weights=None): >>> from MDAnalysisTests.datafiles import TPR, TRR >>> from MDAnalysis.analysis import align >>> A = mda.Universe(TPR, TRR) - >>> B = A.copy() + >>> B = mda.Universe(TPR, TRR) >>> R = align.rotation_matrix(A.select_atoms('backbone').positions, ... B.select_atoms('backbone').positions)[0] >>> A.atoms.rotate(R) From 17b0dfa6856a8e4699a1c47b6e28f552c221a371 Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Mon, 3 Jul 2023 12:11:46 +0530 Subject: [PATCH 17/19] Update align.py --- package/MDAnalysis/analysis/align.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index 29c27ee6b82..98e8bd3bf49 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -89,8 +89,8 @@ rotational superposition use the superposition keyword. This will calculate a minimized RMSD between the reference and mobile structure. - >>> rmsd(mobile.select_atoms('name CA').positions, ref.select_atoms('name CA').positions, - ... superposition=True) + >>> rmsd(mobile.select_atoms('name CA').positions, + ... ref.select_atoms('name CA').positions, superposition=True) 6.809396586471815 The rotation matrix that superimposes *mobile* on *ref* while From 643260502bacdc11d65d2312e88ea3bbf4736a13 Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Mon, 3 Jul 2023 12:30:30 +0530 Subject: [PATCH 18/19] Update align.py --- package/MDAnalysis/analysis/align.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index 98e8bd3bf49..f5499c73e06 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -89,8 +89,8 @@ rotational superposition use the superposition keyword. This will calculate a minimized RMSD between the reference and mobile structure. - >>> rmsd(mobile.select_atoms('name CA').positions, - ... ref.select_atoms('name CA').positions, superposition=True) + >>> rmsd(mobile.select_atoms('name CA').positions, ref.select_atoms('name CA').positions, + ... superposition=True) 6.809396586471815 The rotation matrix that superimposes *mobile* on *ref* while From 85b78ec5c9cae6d00d1ef841f8a077a954f5a20a Mon Sep 17 00:00:00 2001 From: Mohit Kumar <120097428+MohitKumar020291@users.noreply.github.com> Date: Mon, 3 Jul 2023 12:39:22 +0530 Subject: [PATCH 19/19] Update align.py --- package/MDAnalysis/analysis/align.py | 33 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index f5499c73e06..acb3943c576 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -227,15 +227,15 @@ def rotation_matrix(a, b, weights=None): Parameters ---------- a : array_like - coordinates that are to be rotated ("mobile set"); array of N atoms - of shape N*3 as generated by, e.g., - :attr:`MDAnalysis.core.groups.AtomGroup.positions`. + coordinates that are to be rotated ("mobile set"); array of N atoms + of shape N*3 as generated by, e.g., + :attr:`MDAnalysis.core.groups.AtomGroup.positions`. b : array_like - reference coordinates; array of N atoms of shape N*3 as generated by, - e.g., :attr:`MDAnalysis.core.groups.AtomGroup.positions`. + reference coordinates; array of N atoms of shape N*3 as generated by, + e.g., :attr:`MDAnalysis.core.groups.AtomGroup.positions`. weights : array_like (optional) - array of floats of size N for doing weighted RMSD fitting (e.g. the - masses of the atoms) + array of floats of size N for doing weighted RMSD fitting (e.g. the + masses of the atoms) Returns ------- @@ -251,15 +251,15 @@ def rotation_matrix(a, b, weights=None): :meth:`MDAnalysis.core.groups.AtomGroup.rotate` to generate a rotated selection, e.g. :: - >>> from MDAnalysisTests.datafiles import TPR, TRR - >>> from MDAnalysis.analysis import align - >>> A = mda.Universe(TPR, TRR) - >>> B = mda.Universe(TPR, TRR) - >>> R = align.rotation_matrix(A.select_atoms('backbone').positions, - ... B.select_atoms('backbone').positions)[0] - >>> A.atoms.rotate(R) - - >>> A.atoms.write("rotated.pdb") + >>> from MDAnalysisTests.datafiles import TPR, TRR + >>> from MDAnalysis.analysis import align + >>> A = mda.Universe(TPR,TRR) + >>> B = A.copy() + >>> R = rotation_matrix(A.select_atoms('backbone').positions, + ... B.select_atoms('backbone').positions)[0] + >>> A.atoms.rotate(R) + + >>> A.atoms.write("rotated.pdb") Notes ----- @@ -273,6 +273,7 @@ def rotation_matrix(a, b, weights=None): AlignTraj: Fit a whole trajectory. """ + a = np.asarray(a, dtype=np.float64) b = np.asarray(b, dtype=np.float64)