foldseek icon indicating copy to clipboard operation
foldseek copied to clipboard

Generate alignments/give rotation&translation matrix

Open gezmi opened this issue 3 years ago • 12 comments
trafficstars

Hi,

It is a very nice software and extremely fast, thank you! One question: would it be possible that the server provides the superimposed structures and/or the translation-rotation matrix for the query vs hits? That would be super useful!

Thank you for your great work!

gezmi avatar Feb 22 '22 15:02 gezmi

Thank you! This is quite high on our todo list but it still might need a bit of time to be built.

martin-steinegger avatar Feb 22 '22 16:02 martin-steinegger

Hi, are these alignments already available using the command line tool @martin-steinegger , eg to visualise/ superimpose the 3D models of a pair of proteins?

phiweger avatar Mar 07 '22 09:03 phiweger

foldseek createdb example/ targetDB
foldseek createdb example/ queryDB
foldseek search queryDB targetDB aln tmpFolder -a
foldseek aln2tmscore queryDB targetDB aln aln_tmscore
foldseek createtsv queryDB targetDB aln_tmscore aln_tmscore.tsv

The aln2tmscore command should contain a rotation computed by TMscore. Be careful this is still not well tested.

martin-steinegger avatar Mar 07 '22 14:03 martin-steinegger

@martin-steinegger I get 12 coords in one line; I have not been able to figure out which 3 correspond to translation and which 9 to rotation.

I want to feed this info to rotate the structures "manually" using

https://biopython.org/docs/1.75/api/Bio.PDB.Atom.html#Bio.PDB.Atom.Atom.transform

which takes a 3x3 rotation matrix, however, I am not sure about which value in aln_tmscore.tsv goes where (the array indices).

Thanks for the patient help!

phiweger avatar Mar 09 '22 09:03 phiweger

If anyone stumbles upon this: The first 3 entries are translation, the remaining ones rotation, so this

query ref 4.711E-01 59.289 21.504 63.313 -0.707 -0.706 0.041 -0.695 0.704 0.151 -0.135 0.078 -0.988

becomes this:

import numpy as np

rotation = np.array([[-0.707, -0.706, 0.041], [-0.695, 0.704, 0.151], [-0.135, 0.078, -0.988]])
translation = np.array([59.289, 21.504, 63.313])

phiweger avatar Mar 09 '22 14:03 phiweger

Is it possible to get these using API?

The json contains tCa for each alignment, list of floats with 3*n_res elements. Plotted a few, turns out they're not the aligned CAs:

Screenshot 2022-06-02 at 14 51 31

mrauha avatar Jun 02 '22 11:06 mrauha

We don't compute the rotation matrix server-side in the API. We solved the issue by running TMalign as webassembly on the client.

We will have to discuss if and how we can expose the transformed coordinates in the API. Currently we don't have a solution for that.

milot-mirdita avatar Jun 02 '22 12:06 milot-mirdita

I see. Not a big problem, I can download the structures and do it locally. Thanks for the quick reply & awesome work!

mrauha avatar Jun 02 '22 20:06 mrauha

@gezmi we added a structural viewer to the foldseek server. You can also get a static HTML using the binary using --format-mode 3

martin-steinegger avatar Jun 16 '22 07:06 martin-steinegger

Should the output html from --format-mode 3 include a visualization of the overlaid alignment like the web server does?

jmrussell avatar Oct 03 '22 21:10 jmrussell

It should, does it not work for you? Can you try a different browser?

milot-mirdita avatar Oct 04 '22 02:10 milot-mirdita

Thanks for the quick response! It wasn't a browser issue, but your suggestion made me realize it likely due to the way I was serving the html from a webserver; downloading the html and opening it directly worked in all browsers. Awesome software btw! Thanks

jmrussell avatar Oct 04 '22 16:10 jmrussell