Hi,
I try to do superimposition u2 into u1 using CA only. These structures have the same number of atoms.
After translating and rotating u1_ca, I found u1 coordinate also changed as well, even copy() functions had used.
Is this a normal situation or a bug? How could I make a complete independent entity?
Thanks
Please download the files here: u1.pdb and u2.pdb
import MDAnalysis as mda
from MDAnalysis.analysis import align
pdb1 = 'u1.pdb'
pdb2 = 'u2.pdb'
u1 = mda.Universe(pdb1)
u2 = mda.Universe(pdb2)
u1_ca = u1.select_atoms('name CA').copy()
u2_ca = u2.select_atoms('name CA').copy()
print(u1.select_atoms('name CA').positions[1:3,1:3], u1_ca.positions[1:3,1:3])
Before superimposition,
(array([[-5.735, 28.569],
[-4.479, 26.143]], dtype=float32),
array([[-5.735, 28.569],
[-4.479, 26.143]], dtype=float32))
mobile0 = u1_ca.positions - u1_ca.atoms.center_of_mass()
ref0 = u2_ca.positions - u2_ca.atoms.center_of_mass()
R, rmsd_value = align.rotation_matrix(mobile0, ref0)
print("Rotation matrix = \n", R)
print("RMSD = ", rmsd_value)
u1_ca.atoms.translate(-u1_ca.atoms.center_of_mass())
u1_ca.atoms.rotate(R)
u1_ca.atoms.translate(u2_ca.atoms.center_of_mass())
print(u1.select_atoms('name CA').positions[1:3,1:3], u1_ca.positions[1:3,1:3])
After superimposition,
(array([[ 9.291354, -24.866745],
[ 8.894788, -21.551838]], dtype=float32),
array([[ 9.291354, -24.866745],
[ 8.894788, -21.551838]], dtype=float32))
Hi,
I try to do superimposition u2 into u1 using CA only. These structures have the same number of atoms.
After translating and rotating u1_ca, I found u1 coordinate also changed as well, even copy() functions had used.
Is this a normal situation or a bug? How could I make a complete independent entity?
Thanks
Please download the files here: u1.pdb and u2.pdb
Before superimposition,
After superimposition,