browseGenome with Shiny
Entering edit mode
vivek82 • 0
Last seen 5.4 years ago

Hi there,

I'm trying to build a Shiny app that utilizes rtracklayer to create custom tracks in the Genome Browser. The code itself is very straightforward - I create a ranges, a track, a session and then call browseGenome.

#Coords is simply a set of coordinates 

targetRanges <- IRanges(coords$start, coords$end)
targetTrack <- with(coords,GRangesForUCSCGenome("hg38", chromosome_name, targetRanges, strand,name, gene))

session <- browserSession("UCSC")

track(session, "custom_1") <- targetTrack

geneRange <- subset(coords,gene==geneName)

grange <- as(paste(geneRange$chromosome_name[1],':',geneRange$start_position[1],'-',geneRange$end_position[1],sep=''),"GRanges")

browseGenome(targetTrack, range = grange,name="custom_1",viewParams=list(full=c("custom_1")))


This is encapsulated in the server portion of my Shiny app. When I run the app locally on my Mac in RStudio, it runs perfectly fine. But when I run it on an Ubuntu 16.04.4 LTS on Shiny Server, it fails with the following error. 

Listening on

/usr/bin/xdg-open: 778: /usr/bin/xdg-open: www-browser: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: links2: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: elinks: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: links: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: lynx: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: w3m: not found
xdg-open: no method available for opening '$

Now, I understand that it is trying to open a new browser window but fails to do so on the server side. What I don't understand is how to direct it to open a client side browser window instead. 

Alternatively, I'm looking into whether I can somehow access the URL that browseGenome generates (with the right hgsid), I can set view=FALSE and create my own link for the client to click on. But after extensively checking and searching, I'm unable to locate the URL in any of the data objects.

Any pointers on accomplishing either of these things would be much appreciated.



> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS

attached base packages:
[1] stats4    parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] seqinr_3.4-5         rtracklayer_1.38.3   GenomicRanges_1.30.3 GenomeInfoDb_1.14.0  IRanges_2.12.0       S4Vectors_0.16.0    
 [7] BiocGenerics_0.24.0  biomaRt_2.37.8       openxlsx_4.1.0       shinyjs_1.0          shiny_1.1.0          tidyr_0.8.1         
[13] gplots_3.0.1         dplyr_0.7.6          epivizrChart_1.3.3  

loaded via a namespace (and not attached):
  [1] backports_1.1.2               Hmisc_4.1-1                   AnnotationHub_2.10.1          plyr_1.8.4                   
  [5] lazyeval_0.2.1                splines_3.5.1                 BiocParallel_1.12.0           ggplot2_3.0.0                
  [9] digest_0.6.17                 BiocInstaller_1.28.0          ensembldb_2.2.2               htmltools_0.3.6              
 [13] gdata_2.18.0                  magrittr_1.5                  checkmate_1.8.5               memoise_1.1.0                
 [17] cluster_2.0.7-1               Biostrings_2.46.0             matrixStats_0.54.0            prettyunits_1.0.2            
 [21] epivizrServer_1.6.0           colorspace_1.3-2              blob_1.1.1                    crayon_1.3.4                 
 [25] RCurl_1.95-4.11               jsonlite_1.5                  graph_1.56.0                  bindr_0.1.1                  
 [29] survival_2.42-6               glue_1.3.0                    gtable_0.2.0                  zlibbioc_1.24.0              
 [33] XVector_0.18.0                DelayedArray_0.4.1            scales_1.0.0                  DBI_1.0.0                    
 [37] Rcpp_0.12.19                  viridisLite_0.3.0             xtable_1.8-3                  progress_1.2.0               
 [41] htmlTable_1.12                foreign_0.8-71                bit_1.1-14                    OrganismDbi_1.20.0           
 [45] Formula_1.2-3                 sqldf_0.4-11                  htmlwidgets_1.3               httr_1.3.1                   
 [49] RColorBrewer_1.1-2            acepack_1.4.1                 pkgconfig_2.0.2               XML_3.98-1.16                
 [53] nnet_7.3-12                   tidyselect_0.2.4              rlang_0.2.2                   later_0.7.5                  
 [57] AnnotationDbi_1.40.0          munsell_0.5.0                 tools_3.5.1                   gsubfn_0.7                   
 [61] RSQLite_2.1.1                 ade4_1.7-13                   stringr_1.3.1                 yaml_2.2.0                   
 [65] knitr_1.20                    bit64_0.9-7                   zip_1.0.0                     caTools_1.17.1.1             
 [69] purrr_0.2.5                   AnnotationFilter_1.2.0        bindrcpp_0.2.2                RBGL_1.54.0                  
 [73] mime_0.5                      compiler_3.5.1                rstudioapi_0.7                curl_3.2                     
 [77] png_0.1-7                     interactiveDisplayBase_1.16.0 tibble_1.4.2                  stringi_1.2.4                
 [81] GenomicFeatures_1.30.3        lattice_0.20-35               ProtGenerics_1.10.0           Matrix_1.2-14                
 [85] pillar_1.3.0                  data.table_1.11.8             bitops_1.0-6                  httpuv_1.4.5.9000            
 [89] R6_2.2.2                      latticeExtra_0.6-28           epivizrData_1.6.0             RMySQL_0.10.15               
 [93] promises_1.0.1                KernSmooth_2.23-15            gridExtra_2.3                 MASS_7.3-50                  
 [97] gtools_3.8.1                  assertthat_0.2.0              chron_2.3-53                  SummarizedExperiment_1.8.1   
[101] proto_1.0.0                   rjson_0.2.20                  withr_2.1.2                   GenomicAlignments_1.14.2     
[105] Rsamtools_1.30.0              GenomeInfoDbData_1.0.0        hms_0.4.2                     grid_3.5.1                   
[109] rpart_4.1-13                  Biobase_2.38.0                base64enc_0.1-3    
rtracklayer browsegenome shiny • 1.3k views
Entering edit mode

I guess the view constructor could be instructed not to show/browse itself but instead keep the information in a slot that could be queried to get the URL. Then you could pass that argument down through browseGenome() although it might be better to just construct the session and view directly.

Entering edit mode

Sorry, I replied before seeing your message about viewURL. Will give that a shot. Thanks!


Hi Michael,

Thanks for the response. Afraid I don't quite understand though. Is there a way create and store the track, and then access either the full URL (including the HGSID) or the HGSID alone for the custom track? I've been digging into various data objects within rtracklayer but haven't been able to figure it out. 



Entering edit mode
Last seen 2.2 years ago
United States

Version 1.41.8 supports passing browse=FALSE to browserView() to prevent browsing to the URL. Get the URL from the returned view object with viewURL().


Login before adding your answer.

Traffic: 847 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6