google-deepmind / alphafold

Open source code for AlphaFold.
Apache License 2.0
12.1k stars 2.16k forks source link

AlphaFold uses the wrong resolution field during structure parsing #915

Closed ljarosch closed 2 months ago

ljarosch commented 3 months ago

AlphaFold uses these lines for parsing the resolution of structures:

for res_key in ('_refine.ls_d_res_high', '_em_3d_reconstruction.resolution',
                '_reflns.d_resolution_high'):
  if res_key in parsed_info:
    try:
      raw_resolution = parsed_info[res_key][0]
      header['resolution'] = float(raw_resolution)
    except ValueError:
      logging.debug('Invalid resolution format: %s', parsed_info[res_key])

return header

This means that effectively _reflns.d_resolution_high will be used to set resolution whenever it is available, however this reflects the resolution limit in the raw data and not the final PDB model (see https://mmcif.wwpdb.org/dictionaries/mmcif_pdbx_v50.dic/Items/_reflns.d_resolution_high.html), effectively overestimating the resolution for many structures. Instead, _refine.ls_d_res_high should be used (https://mmcif.wwpdb.org/dictionaries/mmcif_pdbx_v50.dic/Items/_refine.ls_d_res_high.html).

It's likely that this was the intended behavior but the loop is missing a break statement in the try-block.

Augustin-Zidek commented 3 months ago

Thanks for reporting, this is indeed a bug and I will send a fix.

Augustin-Zidek commented 2 months ago

Fixed in https://github.com/google-deepmind/alphafold/commit/6d95d1982ed825c5b4428a371ee31aa536fcfa39. Thanks again!