Closed gph82 closed 7 years ago
Thanks, sounds like a bug. Will investigate tonight.
Can you post your notebook version too?
Can you post your notebook version too?
5.0.0
And if you does not use abspath, will that work?
no no, it does not work either. I just added it because I did not want to obscure things
Seems to me that somewhere an os.path.basame is being done on the filename
I'll work around it in the meantime with ad-hoc symlinks. I'm forced to use add_structure instead of add_component because I still parse read bfactors/radius-arrays to the worm representation
where would the /notebooks/ folder be in my FS?
So here is the logic: There are two ways to send data to NGL, sending text blob (using file handler) or let NGL read the file path directly. The latter is much faster but it requires your file is in subfolder of your current working path.
I am not sure about your case, need to teat myself first.
ok. I just updated the original issue, there was some inconsistencies in the issue
The show_structure_file works because it always read your file content first (python) then send that to ngl (JavaScript).
uhm, I can not reproduce yours.
@gph82 any response on this? thanks.
Hi @hainm . Not really sure your example reproduces mine....
Meanwhile, on the terminal...
[W 16:30:04.845 NotebookApp] 404 GET /notebooks/1U19.pdb (::1): No such file or directory: 1U19.pdb
but the file exists on the home directory for sure
how can you get two structures in that display?
Can you just try one?
what's the output of
!pwd
os.path.abspath("1U19.pdb")
Okay i'll make a more comprehensive notebook, I think we're talking past each other
would be great. If possible, please share your troublesome files too. thanks.
On Wed, Oct 4, 2017 at 10:46 AM, Guillermo Pérez-Hernández < notifications@github.com> wrote:
Okay i'll make a more comprehensive notebook, I think we're talking past each other
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arose/nglview/issues/697#issuecomment-334179791, or mute the thread https://github.com/notifications/unsubscribe-auth/AEPudfXugdDg5nBzbdj5MDTMUbp7p6htks5so5pMgaJpZM4PosfV .
Here we go 3CAP.zip 1U19.zip Untitled.zip
work fine to me after editing.
PS: Your command is not correct
file2 = '1U19.pdb'
print(os.path.exists(file2), os.path.abspath(file2))
geom2 = md.load(file2)
iwd = nglview.show_mdtraj(geom1)
iwd = iwd.add_trajectory(geom2) # why overwrite `iwd`?
iwd
I don't get any 404 error:
oops, by the way, I am testing with nglview 1.0.b4
fine with 1.0.b2 too.
@arose can you try again? Here is the updated notebook that correct the command. (change .txt to .ipynb)
@gph82 I guess you need to play around with realpath and abspath in this code: https://github.com/arose/nglview/blob/master/nglview/utils/py_utils.py#L196-L197
May be try to change:
return os.path.relpath(self.src)
to
return os.path.relpath(os.path.realpath(self.src))
or print out to see what happens.
Untitled.zip Thanks for pointing out that one mistake. That was a "typo" of writing up the example notebook quickly (see attached updated version).
In any case, the FileManager class was calling the
self._remote_call(
"loadFile", target='Stage', args=args, kwargs=kwargs2)
with the filename-string instead of the already parsed string with the actual structure. Was that intended? You can try running the updated notebook with this branch (or just copy the "for debugging" to yours): https://github.com/arose/nglview/compare/master...gph82:abs_path_file_obj_reading?expand=1
I'm trying to play around with it but still no luck
Was that intended?
Yes, I explained here: https://github.com/arose/nglview/issues/697#issuecomment-333134655
In the worse case, use FileStructure
fs = nv.FileStructure('your.pdb')
view.add_component(fs)
I think this should work :D
I'll try that, thanks. Regarding your https://github.com/arose/nglview/issues/697#issuecomment-333134655 I understood that, but even if the abspath is parsed to the server, it fails...
yes, absolute path will be failed, that's the way WWW works for security reason.
uhm, I am afraid that you need to figure out by yourself in this case since I can not reproduce your issue. :( good luck, man.
I understand. Thanks a lot, man. Your workaround worked, BTW! Keep up the good work!
Your workaround worked,
In this case, just FYI: https://github.com/arose/nglview#notes
nglview 1.02b ipywidgets 7.0.1
works, however:
will just produce the already instantiated widget, but without the second structure. In the console, it will complain with:
which, in the terminal is more verbose, telling me that it's trying to read the file /notebooks/file1.pdb. However, it is elsewhere. show_structure() seems to be able to deal with it, but not add_component()