Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: '112' in calculate_z_order #17

Open
pmiddend opened this issue Jun 11, 2024 · 4 comments
Open

KeyError: '112' in calculate_z_order #17

pmiddend opened this issue Jun 11, 2024 · 4 comments

Comments

@pmiddend
Copy link

pmiddend commented Jun 11, 2024

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
Copy link

taw10 commented Jun 11, 2024

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
Copy link
Contributor

wojdyr commented Jun 11, 2024

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
Copy link
Author

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
Copy link
Contributor

wojdyr commented Jun 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants