freesasa / freesasa-python

FreeSASA Python Module
MIT License
47 stars 12 forks source link

Tolerate hydrogens #13

Closed raphtown closed 4 years ago

raphtown commented 4 years ago

Hello,

Is it possible for this module to work with hydrogens or unknown residue types (i.e., like the --hydrogen and --unknown flags in the underlying module)?

Currently, it fails due to hydrogen atoms on structures such as 4p4h.pdb1 when I run a command such as result, sasa_classes = freesasa.calcBioPDB(bp)

Thank you for your time!

mittinatten commented 4 years ago

Hi, Yes, it's possible, but not very well documented, you can pass an options parameter to the Structure constructor, if you look at the defaultOptions in the source it illustrates the format: https://github.com/freesasa/freesasa-python/blob/master/freesasa.pyx#L421.

I should try to make this more explicit in the docs.

The BioPDB module is experimental, and I haven't had time to do anything about hydrogens there, there is an old open issue on this, which is posted in the wrong repo: https://github.com/mittinatten/freesasa/issues/35.

raphtown commented 4 years ago

Great, thank you!

I got it working pretty simply with:

structure = freesasa.structureFromBioPDB(
     bp, options={'hydrogen': True, 'skip-unknown': True})
result = freesasa.calc(structure)
raphtown commented 4 years ago

Actually, after looking at this more, that didn't actually work. I ended up doing

structure = freesasa.Structure(options={'hydrogen': True, 'skip-unknown': True})

and then doing

structure.addAtom