pypdb icon indicating copy to clipboard operation
pypdb copied to clipboard

Access structure pH

Open stepdasha opened this issue 3 years ago • 3 comments

Can we access structure's pH with something like pypdb.describe_pdb(pdb_id)? Thank you very much.

stepdasha avatar Feb 25 '22 22:02 stepdasha

Hello, would you mind posting an example query and desired output? If you can share the XML associated with doing a query on the PDB website, that would be super handy, so that I can see if I can figure this out.

williamgilpin avatar Mar 01 '22 01:03 williamgilpin

Hi @williamgilpin . In PDB file there is a line "REMARK 245 PH : 8.00" with ph information of the experiment. I would like to extract this '8.00'information from the pdb file in the same way as pypdb.describe_pdb(pdb_id) extract all other information about the structure and experiment. But I didn't find any command for it so far. I am sorry, I not sure I understand what "share the XML associated with doing a query " mean. Thank you very much

stepdasha avatar Mar 02 '22 16:03 stepdasha

@williamgilpin I think this can be closed as this is already possible with the existing code, I was playing with pypdb to solve some of the outstanding issues and this issue is easy to accomplish:

[1] >>> from pypdb.pypdb import get_info
[2] >>> pdb_info = get_info('1ae1')
[3] >>> pH = pdb_info["exptl_crystal_grow"][0]["p_h"]
[4] >>> print(pH)
        4.5

or equivalently pH = pdb_info["exptl_crystal_grow"][0]['pdbx_details'][3:] (removing the first 3 characters which are 'ph '). The user could write a custom function to extract it along these lines using a try ... except block for IndexError's if the field is not defined.

jthornton-0 avatar Jun 17 '23 13:06 jthornton-0