Loading local file with NGLViewer implemented in panel_chemistry.pane

Hi, I have a question about parameters read up by NGLViewer.

I posted a relevant question before and @Marc solved the former one in a beautiful way, but I thought the this question would be better to be in a separate post.

What I would like to do is quite simple. I have a local file to be read by NGLViewer.

Apparently,

import panel as pn
from panel_chemistry.pane import NGLViewer

pn.extension("ngl_viewer", sizing_mode="stretch_width")
ngl_viewer = NGLViewer(object = "5yqw.pdb")

ngl_viewer

works fine as was answered on the previous topic, but when I change it to the local path as below:

ngl_viewer = NGLViewer(object = "structure.pdb")

it doesn’t work. It even doesn’t raise any error. So, I tried several patterns.

What I tried, but didn’t work:

  • changing the file path to URL scheme like “file:///Users/User/structure.pdb”
  • opening Chrome again with an option, “-–allow-file-access-from-files” and tried several combinations of file paths
  • opening pdb file downloaded from RCSB PDB to my local directory

What I tried and worked

Since panel doesn’t respond my input, I’m wondering if this is an issue on chrome or my script.

I also referred panel-chemistry/ngl_viewer.py at main · awesome-panel/panel-chemistry · GitHub and it mentions only about rcsb website. Since then, I really get stuck.

If you could also provide the way to open more than two local files at the same time, that would also be quite helpful.

Sorry that I cannot share progresses. I’m quite sluggish on coding…

Many thanks.

1 Like