mittinatten / freesasa

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

option to read in radii via PDB occupancies? #12

Closed demianriccardi closed 8 years ago

demianriccardi commented 8 years ago

Thank you for your work on freesasa! Finally, an open source sasa calculator.

When running freesasa with the -B option, the SASA and radii are printed in the Bfact and occupancy columns. Is there any way to add an option for reading in the radii into freesasa via the occupancies? From docs, it is clear that you can read in a config file, but having this option would be convenient (for me... and maybe others!) for on the fly changes.

I'm writing an interface to freesasa to my Perl molecular object system (HackaMol::X::SASA).

mittinatten commented 8 years ago

Hi, glad you like it!

I think your suggestion makes sense, and I will try to add it. If you are using the C API from Perl you can use the function freesasa_structure_set_radius() to set all the radii at once given an array of radii. But I will think of a way to add it natively to both the API and the CLI.

I have thought about adding Perl bindings at some point, but it might be more convenient for most users to interact with the CLI rather than a Perl module.

demianriccardi commented 8 years ago

Great! Thank you. I played around with using Inline::C to interface with the freesasa library, and I got enough to work to know it's possible. It's on the todo list for me!

mittinatten commented 8 years ago

I have added this option to the dev branch. I did some basic tests, and it seems to work as expected, but I want to play around with it some more before I merge with master (and I have other changes in that branch that need to be worked out properly first). Also it's not in any documentation yet. But feel free to play around with it and say what you think!

So the solution is to either call the CLI with the option --radius-from-occupancy, or if using the API call

freesasa_structure_from_pdb(pdb, classifier, options)

where

options |= FREESASA_RADIUS_FROM_OCCUPANCY

I also added options to do the same using B-factors, but I might remove that again, since it is possibly just confusing. The idea was that NACCESS writes it's radii to the B-factor field, but I don't think it's properly aligned, which means parsing becomes ambiguous in this setting.

mittinatten commented 8 years ago

Btw, let me know if you make Perl bindings that are modular enough to be shipped with the library. I have no experience interfacing Perl and C myself.

demianriccardi commented 8 years ago

Fantastic!

mittinatten commented 8 years ago

Added a short command line option '-O' as well

mittinatten commented 8 years ago

Now merged with master in f6f2d43c39.

I will close the issue, just reopen if you encounter any problems.