nglviewer / nglview

Jupyter widget to interactively view molecular structures and trajectories
http://nglviewer.org/nglview/latest/
Other
788 stars 132 forks source link

Wrong mode in MrcParser with MRC density map file #1078

Closed jeesay closed 5 months ago

jeesay commented 9 months ago

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

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 commented 9 months ago

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 commented 9 months ago

Hi @hainm,

1) Works perfectly in NGL.

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

Thanks. Jean-Christophe

hainm commented 9 months ago

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 commented 9 months ago

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 commented 9 months ago

noted. thanks @jeesay.

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

jeesay commented 9 months ago

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 commented 9 months ago

thanks @jeesay

jeesay commented 9 months ago

Hi @hainm,

Did you reproduce the bug?

Jean-Christophe

hainm commented 9 months ago

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 commented 5 months ago

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

hainm commented 5 months ago

@jeesay Sorry for my super late fix. Cheers.

jeesay commented 5 months ago

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