steineggerlab / foldseek

Foldseek enables fast and sensitive comparisons of large structure sets.
https://foldseek.com
GNU General Public License v3.0
780 stars 99 forks source link

Rotation matrix #238

Closed yonatan212 closed 7 months ago

yonatan212 commented 7 months ago

Hi,

If I want to visualize the alignment in PyMOL, which structure do I need to rotate using the Rotation matrix and Translation vector that I obtained — the target or the query? I perform Translation first and then Rotation and the Rotation matrix result is 9 numbers. Are the first 3 numbers representing the first vector in the matrix and so on?

Thanks, Yonatan

martin-steinegger commented 7 months ago

We rotate target on to query. You could try this awk script: https://github.com/steineggerlab/foldseek/wiki#how-to-apply-U-and-T-to-a-pdb-file

JacksonLab commented 7 months ago

For rotating and translating in Pymol itself, use:

cmd.transform_selection("object to move", (rotation1, rotation2, rotation3, translation1, rotation4, rotation5, rotation6, translation2, rotation7, rotation8, rotation9, trnaslation3, unused post-rotation translation1, unused post-rotation translation2, unused post-rotation translation3, always=1))

Example:

U matrix

-0.115,-0.396,0.911,-0.988,-0.053,-0.148,0.107,-0.917,-0.385

T vector

42.318,-23.511,-26.576

cmd.transform_selection("6o0u_1_B", (-0.115, -0.396, 0.911, 42.318, -0.988, -0.053, -0.148, -23.511, 0.107, -0.917, -0.385, -26.576, 0, 0, 0, 1))

martin-steinegger commented 7 months ago

@JacksonLab thanks for the code. Is it okay if I add it to the wiki?

JacksonLab commented 7 months ago

Go for it.