mittinatten / freesasa

C-library for calculating Solvent Accessible Surface Areas
http://freesasa.github.io/
MIT License
110 stars 36 forks source link

Generate Surface map (mesh)? #36

Closed paconius closed 6 years ago

paconius commented 6 years ago

Helo,

First let me thank you for this package. The SASA calcs are very useful.

Next, let me ask if there is a way to generate a Solvent-Accessible Surface mesh (or similar point array) that could be visualized or used for further calculations. A glance at the code suggests no, but I thought I would ask. If no, are you aware of any other code out there that does this?

Thank you.

mittinatten commented 6 years ago

Hi, I'm glad it's useful!

Short answer: it's not possible, but it isn't too hard to achieve by rewriting the code a bit.

Long answer: I used to have debug code that printed the points of the S&R surface and the arcs of the L&R surface. Both are straightforward to add, especially S&R, but need to be injected into performance sensitive code, so I never considered making it a permanent option. Also at the point were this data is available we are only dealing with anonymous arrays of coordinates, so atom identity is not available.

To illustrate, the last lines of sasa_sr.c would need to be changed from

for (k = 0; k < n_points; ++k) {
    if (spcount[k]) ++n_surface;
}

to something like

for (k = 0; k < n_points; ++k) {
    if (spcount[k]) {
         ++n_surface;
         printf("%i %f %f %f\n", i, tp[k*3], tp[k*3+1], tp[k*3+2]);
    }
}

for a simple print to stdout of the index of the atom (i, starting form 0, i.e. irrespective of what's used in the input file) and coordinates of exposed test points. But one would probably like to pass a file pointer and a pointer to a freesasa_structure object with atom identities, for richer output, which requires more extensive rewiring.

I don't have a very good overview of other tools, but perhaps EDTSurf would work for you https://zhanglab.ccmb.med.umich.edu/EDTSurf/, although it seems to output an anonymous mesh, i.e. purely geometrical output (which could be ok, depending on what you're after).

Simon

paconius commented 6 years ago

Anonymous arrays of coords would work fine in my case, so your response appears to be what I need to move forward. Thank you!