ncbi / icn3d

web-based protein structure viewer and analysis tool interactively or in batch mode
https://www.ncbi.nlm.nih.gov/Structure/icn3d
Other
154 stars 42 forks source link

load url syntax #15

Closed fslee62 closed 7 years ago

fslee62 commented 7 years ago

hello, i was able to quickly display the icn3d viewer on my own web server. however, i have not been able to load a "local" pdb file into the viewer using either the command prompt OR coding the path into the html page that initializes the viewer. yes i was able to load the pdb file using the popup menu. i believe the file type info was missing the very first time. so what should be the [???] below?

(1) use command prompt: > load url [???] // manual list only the path inside [???] no type info (2) within a generated html: var cfg = {..., url: [???], ...};

PS: i learned that once i used the popup menu one time, the file type was "remembered". so from then on i could simply type > load url [local server path to pdb file] and it would work and type not needed. thanks much.

lewisg-ncbi commented 7 years ago

Hi fslee62, Is there any chance you could point me to a page demonstrating the issue? The developer is currently on vacation, but maybe I help figure the issue out. Lewis

fslee62 commented 7 years ago

hi lewis, thanks for the ultra-fast response. maybe the way to reproduce it on your end is to use your own LOCAL web server and try to load a LOCAL pdb file based on local path (not from RCSB based on PDBid). so here i am initiating the viewer locally on my own web server and i want to load a local pdb based a local path and filename.

after the icn3d initialized, i typed the following at the command prompt:

load url /data/pdb/test.pdb this did NOT work. the slash is the DocumentRoot (of my web server)

HOWEVER, if i used the menu popup choosing type=pdb and url=/data/pdb/test.pdb. the molecule loaded into the viewer.

ALSO, from then on, the viewer seemed to "remember" the file type so that NOW

load url /data/pdb/junk.pdb would work and replaced test.pdb with junk.pdb in the viewer.

i hope my description was explicit enough. fred

dzhang-ncbi commented 7 years ago

Hi fslee62

When you load a local file from the command line, you need to use file path

load pdb file C:{path}\xxxx.pdb

If you load a url file from the command line, you need to give file type:

load url https://files.rcsb.org/view/4NCD.pdb | pdb

For JS code within the page, you also need to give the url file type: cfg.url = "https://files.rcsb.org/view/4NCD.pdb | pdb";

hope my explanations can help you solve the problem.

Dachuan

fslee62 commented 7 years ago

hi dachuan, thanks very much for taking the time to look into my issues. while you have given me the syntax for (1) load pdb and (2) load url. both did not work in my case.

for (1), my web server is an INTRAnet virtual web server running off of a linux box (not windows). i don't quite understand how a windows drive letter (e.g., C:) would work under a linux filesystem. i tried:

load pdb file c:\data\pdb\test.pdb (no model loaded into viewer no error messages)

for (2), notice your url is an extranet address/path. i tried:

load url http://twww/data/pdb/test.pdb | pdb (no model loaded) load url https://files/rcsb.org/view/4NCD.pdb|pdb (no model loaded) notice my intranet web server is called "twww". i CAN load local pdb files using the MENU (File->Open File->Url). i selected PDB as the file type and enter literally "/data/pdb/test.pdb" in the textbox and it loaded the test.pdb model into the viewer (slash / is the DocumentRoot). please have a look at my response to lewis above that highlighted a subtle issue.

maybe i should take a step back. can iCN3D be used as an intranet web viewer loading only internal/local files? i am trying to replace the Jmol viewer (which works well for me in the past) on my intranet web server with iCN3D because current web browsers do not support java anymore. fred

dzhang-ncbi commented 7 years ago

hi fred,

I don't think we tested iCn3D on a virtual web server. We will look into the problems.

Thanks,

Dachuan

fslee62 commented 7 years ago

hi dachuan, thanks very much for your attention. i just wanted to reiterate a couple of comments/observations:

(1) the Jmol applet had worked under the same situation (intranet web-based viewer serving intranet files). i think a lot of people would love to use iCN3D to replace Jmol on their intranet and/or extranet web servers.

(2) iCN3D hosted by my web server (twww) showed up on my browser (chrome) NO problem. i can load local file using the Menu and it WORKED. so iCN3D can be hosted locally and read local files. just that there may be something sticky with the command prompt way and with the cfg way. fred PS i used the term virtual in a sense that the same physical linux box is being used to host multiple web servers. each virtual server should work the same way as any physical web server.

jiywang3 commented 7 years ago

Hi Fred,

Thanks for reporting the problem. Previously I tested to load a pdb file located in a local web sever into a locally hosted iCn3D.

You can view the source code at https://www.ncbi.nlm.nih.gov/Structure/icn3d/full_ui_all.js. The function to load the local pdb file is at iCn3DUI.prototype.downloadUrl = function (url, type) ...

You can test whether this ajax call is successful. Because of the same origin policy, your pdb file should located exactly in the same host as iCn3D. For example, if iCn3D is located at http://twww.abc.org/icn3d, you pdb file should be located under http://twww.abc.org/, e.g., http://twww.abc.org/data/pdb/test.pdb.

If it's OK, you can send me the exact testing url. Or you can send me the error message in the console by pressing "Ctrl", "shift" and "i" together and clicking the "Console" tab.

I will be back to work at the end of July. But I have some limited email access before then.

Thanks!

Jiyao


On Tue, 6/27/17, fslee62 notifications@github.com wrote:

Subject: Re: [ncbi/icn3d] load url syntax (#15) To: "ncbi/icn3d" icn3d@noreply.github.com Cc: "Subscribed" subscribed@noreply.github.com Date: Tuesday, June 27, 2017, 1:05 PM

hi dachuan,

thanks very much for taking the time to look into my issues. while you have given me the syntax for (1) load pdb and (2) load url. both did not work in my case. for (1), my web server is an INTRAnet virtual web server running off of a linux box (not windows). i don't quite understand how a windows drive letter (e.g., C:) would work under a linux filesystem. i tried:

load pdb file c:\data\pdb\test.pdb (no model loaded into viewer no error messages)

for (2), notice your url is an extranet address/path. i tried:

load url http://twww/data/pdb/test.pdb | pdb (no model loaded)

load url https://files/rcsb.org/view/4NCD.pdb|pdb (no model loaded)

notice my intranet web server is called "twww". i CAN load local pdb files using the MENU (File->Open File->Url). i selected PDB as the file type and enter literally "/data/pdb/test.pdb" in the textbox and it loaded the test.pdb model into the viewer (slash / is the DocumentRoot). please have a look at my response to lewis above that highlighted a subtle issue.

maybe i should take a step back. can iCN3D be used as an intranet web viewer loading only internal/local files? i am trying to replace the Jmol viewer (which works well for me in the past) on my intranet web server with iCN3D because current web browsers do not support java anymore.

fred

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

jiywang3 commented 7 years ago

Hi Fred,

The command to load a pdb file is something like the following as mentioned in the help page (https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html): load url https://files.rcsb.org/view/1gpk.pdb The default file type is pdb and you can leave the "type" parameter out. If you want to load mol2, sdf, and xyz files, you need to add the "type parameter: "load url .../test.mol2 | mol2".

Thanks!

Jiyao


On Wed, 6/28/17, Jiyao Wang jiywang3@yahoo.com wrote:

Subject: Re: [ncbi/icn3d] load url syntax (#15) To: "ncbi/icn3d" icn3d@noreply.github.com, "ncbi/icn3d" reply@reply.github.com Cc: "Subscribed" subscribed@noreply.github.com Date: Wednesday, June 28, 2017, 11:40 AM

Hi Fred,

Thanks for reporting the problem. Previously I tested to load a pdb file located in a local web sever into a locally hosted iCn3D.

You can view the source code at https://www.ncbi.nlm.nih.gov/Structure/icn3d/full_ui_all.js. The function to load the local pdb file is at iCn3DUI.prototype.downloadUrl = function (url, type) ...

You can test whether this ajax call is successful. Because of the same origin policy, your pdb file should located exactly in the same host as iCn3D. For example, if iCn3D is located at http://twww.abc.org/icn3d, you pdb file should be located under http://twww.abc.org/, e.g., http://twww.abc.org/data/pdb/test.pdb.

If it's OK, you can send me the exact testing url. Or you can send me the error message in the console by pressing "Ctrl", "shift" and "i" together and clicking the "Console" tab.

I will be back to work at the end of July. But I have some limited email access before then.

Thanks!

Jiyao


On Tue, 6/27/17, fslee62 notifications@github.com wrote:

Subject: Re: [ncbi/icn3d] load url syntax (#15) To: "ncbi/icn3d" icn3d@noreply.github.com Cc: "Subscribed" subscribed@noreply.github.com Date: Tuesday, June 27, 2017, 1:05 PM

hi dachuan,

thanks very much for taking the time to look into my issues. while you have given me the syntax for (1) load pdb and (2) load url. both did not work in my case. for (1), my web server is an INTRAnet virtual web server running off of a linux box (not windows). i don't quite understand how a windows drive letter (e.g., C:) would work under a linux filesystem. i tried:

load pdb file c:\data\pdb\test.pdb (no model loaded into viewer no error messages)

for (2), notice your url is an extranet address/path. i tried:

load url http://twww/data/pdb/test.pdb | pdb (no model loaded)

load url https://files/rcsb.org/view/4NCD.pdb|pdb (no model loaded)

notice my intranet web server is called "twww". i CAN load local pdb files using the MENU (File->Open File->Url). i selected PDB as the file type and enter literally "/data/pdb/test.pdb" in the textbox and it loaded the test.pdb model into the viewer (slash / is the DocumentRoot). please have a look at my response to lewis above that highlighted a subtle issue.

maybe i should take a step back. can iCN3D be used as an intranet web viewer loading only internal/local files? i am trying to replace the Jmol viewer (which works well for me in the past) on my intranet web server with iCN3D because current web browsers do not support java anymore.

fred

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

 
 

fslee62 commented 7 years ago

hi jiyao, thank you so much for answering my questions even when you are on vacation. i poked around a bit more. turned out:

var cfg={...,url: 'pdb| /path relative to documentroot/test.pdb'} worked (for me) [type before url] var cfg={...,url:'/path relative to documentroot/test.pdb|pdb'} did NOT work [url before type]

yes the code was iCn3DUI.prototype.downloadUrl = function (url, type)

this observation is reproducible. however, i didn't look into the code/matter further. am happy enough already. cheers, fred

jiywang3 commented 7 years ago

Hi Fred,

Glad it worked! You can try to add space before and after "|" in the second URL: var cfg={...,url:'/path relative to documentroot/test.pdb | pdb'}. Or simply leave type out: var cfg={...,url:'/path relative to documentroot/test.pdb'}.

Please let us know if you have further questions!

My best,

Jiyao

Sent from my iPhone

On Jun 30, 2017, at 2:53 AM, fslee62 notifications@github.com wrote:

Closed #15.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

fslee62 commented 7 years ago

hi jiyao, (1) i did try with or without space(s) before and after the | pipe before. that did not make a difference. seemed like the order was the sticky point. (2) i also tried with and without the type definition. for the very first time, my observations were that the type definition was required. after the first time and if the type was the same, then i could drop the type definition and the model will load into the viewer.

i am very new to iCN3D. i am certain i will have other questions and issues if i stick with using icn3d instead of other web-based viewers. thanks for all the ultra-fast support. fred