GMOD / JBrowseR

R interface to the JBrowse 2 Linear Genome View.
https://gmod.github.io/JBrowseR/
Apache License 2.0
35 stars 3 forks source link

Check bam file existence in Shiny app #25

Open clbenoit opened 1 year ago

clbenoit commented 1 year ago

Hi !

Is there a way to check if a file exists on the server from R ? I tried RCurl::url.exists methods which never end on a JBrowseR::serve_data server...

RCurl::url.exists("http://127.0.0.1:5000/19A0470_min.bam")

Thanks a lot for your advice,

cmdcolin commented 1 year ago

can you describe the context of the problem you are looking at? jbrowse will probably e.g. give a 404 error if a track is opened when the file doesn't exist but wondering what issue you were running into in this case

clbenoit commented 1 year ago

I would like to get the 404 error from R (Shiny) in this case so my user ask to admin for adding the bam file in base. So I don’t wand to download content and just have a check. Avoiding direct call to system command if possible.

I triedRCurl::url.exists(url) andtrycatch({RCurl::getURL(url)} which both seem unresponsive in this case.

Thanks for you advice,

clbenoit commented 1 year ago

Got it, methods :

trycatch({RCurl::getURL(url)} 
RCurl::url.exists(url)
httr::HEAD(url)
system("curl --head url')

Has to be executed within a different R session that the one executing JBrowseR::serve_data()