ccp4 / dimple

:large_blue_diamond: MX pipeline. Refinement and ligand screening.
http://ccp4.github.io/dimple/
Apache License 2.0
6 stars 5 forks source link

KeyError: '112' in calculate_z_order #17

Open pmiddend opened 2 months ago

pmiddend commented 2 months ago

I'm getting this error:

  File "/opt/xray/ccp4-8.0/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/opt/xray/ccp4-8.0/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/xray/ccp4-8.0/lib/python3.7/site-packages/dimple/__main__.py", line 4, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/opt/xray/ccp4-8.0/lib/python3.7/site-packages/dimple/main.py", line 894, in main
    dimple(wf=wf, opt=options)
  File "/opt/xray/ccp4-8.0/lib/python3.7/site-packages/dimple/main.py", line 197, in dimple
    vol_ratio = (mtz_meta.asu_volume() /
  File "/opt/xray/ccp4-8.0/lib/python3.7/site-packages/dimple/cell.py", line 26, in asu_volume
    z = calculate_z_order(self.symmetry)
  File "/opt/xray/ccp4-8.0/lib/python3.7/site-packages/dimple/cell.py", line 290, in calculate_z_order
    return _centering_n[hm[0]] * _pg_symop[pg]
KeyError: '112'

Using the ccp4-8.0 version of dimple. You can reproduce the problem with the two files inside this zip file and with this command line:

dimple --hklout output-dimple.mtz --xyzout output-dimple.pdb input-mtz-rescut.mtz base-model.pdb .

Is it something about the mtz file (specifically the unit cell info) that's tripping dimple up? mtzdmp gives:

Space group = 'P 1 1 2' (number     1003)

So the code then tries to do _pg_symop['112'] in

def calculate_z_order(hm):
    pg = ''.join(a[0] for a in hm.split()[1:])
    return _centering_n[hm[0]] * _pg_symop[pg]

(with hm = "P 1 1 2"), but _pg_symop:

_pg_symop = {'1': 1,
             '2': 2, '121': 2,
             '222': 4,
             '4': 4,
             '422': 8,
             '3': 3,
             '32': 6, '312': 6, '321': 6,
             '6': 6,
             '622': 12,
             '23': 12,
             '432': 24,
             }

does not contain this key. Should it?

taw10 commented 2 months ago

I investigated this with @pmiddend just now. The unique axis c setting of the space group (P 1 1 2) turned out to be an upstream processing error. The unit cell and space group in the MTZ file don't match and obviously should do.

However, I would say that Dimple should be able to handle the P 1 1 2 form, and perhaps P 2 1 1 as well. Or at least give a more helpful error message?

wojdyr commented 2 months ago

Yes, I agree. I've been planning major changes in Dimple for long time. The code for handling the space groups and many other functions will be replaced with gemmi. Refmac will be replaced with refmacat and servalcat.

It's high time for it, but I don't know when I'll manage to get to it.

pmiddend commented 2 months ago

Well, this isn't a critical bug or anything (hardly a bug even, now that we know why the dimple call fails). Do you want to keep this issue open, just to track it, or should we close it?

wojdyr commented 2 months ago

It can stay open, no worries, I can close it.