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

Wrong conversion from CCP4 to DX #76

Closed
nezix opened this issue Dec 5, 2019 · 5 comments · Fixed by #100
Closed

Wrong conversion from CCP4 to DX #76

nezix opened this issue Dec 5, 2019 · 5 comments · Fixed by #100
Labels
defect format-MRC MRC/CCP4 file format format-OpenDX OpenDX file format

Comments

@nezix
Copy link

nezix commented Dec 5, 2019

Importing a CCP4 map to convert it to a DX file outputs an inverted DX file.

from gridData import Grid
g = Grid("1cbs.ccp4")
g.export("1cbs.dx")

When displaying the DX file in Pymol or VMD, the molecule does not fit in the iso-surface

Level 1 of the exported DX file in Pymol:
image

Level 1 of the CCP4 file in Pymol:
image

Did I miss something ?

@orbeckst
Copy link
Member

That looks wrong... do you have an example file that you can add to the issue or link?

@nezix
Copy link
Author

nezix commented Feb 19, 2020

You can find the ccp4 file here https://www.ebi.ac.uk/pdbe/coordinates/files/1cbs.ccp4

@orbeckst
Copy link
Member

I can confirm this bug.

Furthermore, the DX density appears to be stretched (see Chimera image, contours at 0.362)

  • gray: 1cbs.ccp4
  • yellow: DX file from gridDataFormats
  • licorice (barely visible) 1cbs.pdb

1cbs_ccp4_dx

@orbeckst orbeckst added format-MRC MRC/CCP4 file format format-OpenDX OpenDX file format labels Sep 10, 2021
@orbeckst
Copy link
Member

Do we know if the problem is with

  • CCP4 reading
  • CCP4 interpretation (conversion to Grid)
  • something else (probably not DX writing because that's been used widely)

@orbeckst
Copy link
Member

PR #100 does not fix this bug. In ChimeraX loading the densities gives

  • CCP4 file: 81 x 70 x 96
  • dx file: 70 x 81 x 96

Clearly there's something wrong in how gridData interprets the data in some(?) CCP4 files.

orbeckst added a commit that referenced this issue Feb 19, 2022
- mrcfile only reshapes the data to nz,ny,nx but does not take
  the mapc, mapr, maps into account. For gridData we need to
  do the coordinate system reorientation after transposing the
  mrcfile.data to nx, ny, nz.
- add test (using CCP4_1JZV from the test data which contains
  mapc, mapr, maps = 2, 1, 3
- manually checked 1cbs.ccp4 from issue #76 (also a 2, 1, 3)
  and orientation is now correct but there is still an offset error
  that needs to be fixed
orbeckst added a commit that referenced this issue Feb 19, 2022
@orbeckst orbeckst linked a pull request Feb 19, 2022 that will close this issue
orbeckst added a commit that referenced this issue Feb 20, 2022
- mrcfile stores data in z,y,x format: we use the information
  of the axis orientation in mapc, mapr. maps to orient the
  data in the GridDataFormats x,y,z coordinate system
- correctly reorient and center coordinates from MRC
  - fix #76
  - add tests
- mrcfile only reshapes the data to nz,ny,nx but does not take
  the mapc, mapr, maps into account. For gridData we need to
  do the coordinate system reorientation after transposing the
  mrcfile.data to nx, ny, nz.
- add test (using CCP4_1JZV from the test data which contains
  mapc, mapr, maps = 2, 1, 3
- manually checked 1cbs.ccp4 from issue #76 (also a 2, 1, 3)
  and orientation is now correct but there is still an offset error
  that needs to be fixed
- update CHANGELOG (and add @tluchko)

Co-authored-by: tluchko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect format-MRC MRC/CCP4 file format format-OpenDX OpenDX file format
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants