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 mode in MrcParser with MRC density map file #1078

Closed
jeesay opened this issue Sep 21, 2023 · 12 comments
Closed

Wrong mode in MrcParser with MRC density map file #1078

jeesay opened this issue Sep 21, 2023 · 12 comments

Comments

@jeesay
Copy link

jeesay commented Sep 21, 2023

Hi all,

When I try to run the script below in jupyterlab, the MRC file wasn't loaded and the browser console displays the following error message:

MrcParser unknown mode 1010723949                                                     664.8a35b9da8e921c96bddb.js:2:1362848
STAGE LOG error loading file: 'TypeError: r[a[1]] is undefined'                       664.8a35b9da8e921c96bddb.js:2:1109224
Uncaught (in promise) error loading file: 'TypeError: r[a[1]] is undefined'           49.13801d0d3acfe1244269.js:1:80728


  • I checked with the Python package mrcfile and the file is correctly read with a MRC mode of 2 (float32)
  • I tried with a swap-byte file but the error message is the same (wrong mode).
  • I reproduced the error with other MRC files (downloaded from the EMDB databank).

Thanks in advance, Jean-Christophe.

Here is the script:

import nglview as nv

view = nv.NGLWidget()

# Parameters of viewport
view.background = '#333'
view.parameters = {'clip_near': 0, 'clip_far': 10000}

# https://scipion.cnb.csic.es/downloads/scipion/data/tests/resmap/
view.add_component('data/map/betaGal.mrc')

print(view.n_components)
# Display 0

# Display...
view

Versions

jupyterlab                4.0.6                    pypi_0    pypi
nglview                   3.0.8                    pypi_0    pypi
@hainm
Copy link
Collaborator

hainm commented Sep 21, 2023

hi @jeesay: thanks for your report.
Would you mind trying with the NGL (that nglview uses) to see if you can view your file?
https://nglviewer.org/ngl/?script=showcase/ferredoxin

If yes, it's nglview issue. We will try to fix.
If no, it's NGL issue, and please help file a case in https://github.com/nglviewer/ngl

thanks.

@jeesay
Copy link
Author

jeesay commented Sep 21, 2023

Hi @hainm,

  1. Works perfectly in NGL.

  2. I don't know if it can help. I tested several scripts:

  • The function add_component(url) returns the wrong MODE only if the url is set like:
view.add_component('http://localhost:8888/lab/data/map/betaGal.mrc',ext="mrc")
  • . The add_component(path/filename) returns a 'Not found file'. For example,
view.add_component('data/map/betaGal.mrc',ext="mrc")

Thanks. Jean-Christophe

@hainm
Copy link
Collaborator

hainm commented Sep 21, 2023

Hi @hainm,

  1. Works perfectly in NGL.
  2. I don't know if it can help. I tested several scripts:
  • The function add_component(url) returns the wrong MODE only if the url is set like:
view.add_component('http://localhost:8888/lab/data/map/betaGal.mrc',ext="mrc")
  • . The add_component(path/filename) returns a 'Not found file'. For example,
view.add_component('data/map/betaGal.mrc',ext="mrc")

Thanks. Jean-Christophe

oh then it's an issue for nglview with jupyterlab then.
If possible, please try with traditional notebook since it (notebook) will accept data/map/betaGal.mrc path.

@jeesay
Copy link
Author

jeesay commented Sep 22, 2023

Hi @hainm,

  1. Works perfectly in NGL.
  2. I don't know if it can help. I tested several scripts:
  • The function add_component(url) returns the wrong MODE only if the url is set like:
view.add_component('http://localhost:8888/lab/data/map/betaGal.mrc',ext="mrc")
  • . The add_component(path/filename) returns a 'Not found file'. For example,
view.add_component('data/map/betaGal.mrc',ext="mrc")

Thanks. Jean-Christophe

oh then it's an issue for nglview with jupyterlab then. If possible, please try with traditional notebook since it (notebook) will accept data/map/betaGal.mrc path.

jupyter notebook finds the file with path but I got the same wrong MODE message:

MrcParser unknown mode   171863149                 664.8a35b9da8e921c96bddb.js:2:1362848
    _parse        http://localhost:8888/lab/extensions/nglview-js-widgets/static/664.8a35b9da8e921c96bddb.js?v=8a35b9da8e921c96bddb:2
    parse         http://localhost:8888/lab/extensions/nglview-js-widgets/static/664.8a35b9da8e921c96bddb.js?v=8a35b9da8e921c96bddb:2

@hainm
Copy link
Collaborator

hainm commented Sep 22, 2023

noted. thanks @jeesay.

Do you have a .mcr file to share to reproduce it here? thanks.

@jeesay
Copy link
Author

jeesay commented Sep 22, 2023

noted. thanks @jeesay.

Do you have a .mcr file to share to reproduce it here? thanks.

The test map betaGal.mrc in ngl repository at https://github.com/nglviewer/ngl/blob/master/data/betaGal.mrc

@hainm
Copy link
Collaborator

hainm commented Sep 22, 2023

thanks @jeesay

@jeesay
Copy link
Author

jeesay commented Oct 4, 2023

Hi @hainm,

Did you reproduce the bug?

Jean-Christophe

@hainm
Copy link
Collaborator

hainm commented Oct 4, 2023

Hi @hainm,

Did you reproduce the bug?

Jean-Christophe

Dear @jeesay
I don't have a chance to test yet, get stuck with my daily work now. Sorry.

@hainm hainm mentioned this issue Jan 12, 2024
@hainm
Copy link
Collaborator

hainm commented Jan 12, 2024

The issue is resolved in #1100 (available in nglview 3.1.1)

@hainm hainm closed this as completed Jan 12, 2024
@hainm
Copy link
Collaborator

hainm commented Jan 12, 2024

@jeesay Sorry for my super late fix. Cheers.

@jeesay
Copy link
Author

jeesay commented Jan 12, 2024

@hainm Thanks a lot. I'll try as soon as possible.
I tried. Works perfectly.
Jean-Christophe.

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

2 participants