mittinatten / freesasa

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

calcCoord #26

Closed npolizzi closed 7 years ago

npolizzi commented 7 years ago

Hi,

I just updated freesasa to 2.0.1 and think the calcCoord function should be very useful for me. However, is there a way to use the function such that the coordinates of some atoms (say, a residue) are considered within the context of a larger number of coordinates (say, the whole protein)? My main motivation is to get freesasa to work with the python package Prody, and I see a way to do this if I can use coordinates in freesasa, but only if in the context of a larger group of coordinates. (Prody has a getCoords() function for atom selections.)

Thanks

Nick

mittinatten commented 7 years ago

Hi Nick, If I understand your question correctly, the way you would have to do it is supply all the coordinates to calcCoord(), and then sum up the total SASA only for the indexes you want. Say your selection contains atoms 20-30 of a 100 atom structure. Then you would do something like (pseudocode)

sasa = calcCoord(protein.getCoord(), protein.getRadii())
selectionSasa = 0
for atomIndex in selection.getIndexes():
    selectionSasa += sasa[atomIndex]

# or, with the numbers above
for atomIndex in range(20, 30):
    selectionSasa += sasa[atomIndex]

I'm not familiar with Prody, so not sure if it has function that meets these requirements. But you should somehow be able to access the atom indexes of a selection.

Hope this helps!

Simon

mittinatten commented 7 years ago

Closing this for now, reopen if you have more questions