kimpenn / PIVOT

Platform for Interactive analysis and Visualization Of Transcriptomics data
27 stars 16 forks source link

Deploying PIVOT in a shiny server #1

Closed danielmart closed 5 years ago

danielmart commented 6 years ago

Hi Qin, Thanks a lot for your wonderful work. We would like to deploy your tool in our institute's shiny server (already running and serving other tools), which is meant for users with no R background whatsoever. While launching your application from a RStudio server would be easy enough, we would like for our users to just click a link and access the shiny interface you'd get with the pivot() function. After installing PIVOT in our server I have tried to copy the /app folder (with all its contents, from /usr/local/lib/R/site-library/PIVOT/app/*) to the shiny server folder /srv/shiny-server/PIVOT. While the app seems to produce some log output it fails to launch:

Loading required package: shinydashboard

Attaching package: ‘shinydashboard’

The following object is masked from ‘package:graphics’:

    box

Loading required package: shinyBS
Loading required package: igraph

Attaching package: ‘igraph’

The following objects are masked from ‘package:stats’:

    decompose, spectrum

The following object is masked from ‘package:base’:

    union

Warning: replacing previous import ‘S4Vectors::first’ by ‘dplyr::first’ when loading ‘PIVOT’
Warning: replacing previous import ‘S4Vectors::intersect’ by ‘dplyr::intersect’ when loading ‘PIVOT’
Warning: replacing previous import ‘S4Vectors::setdiff’ by ‘dplyr::setdiff’ when loading ‘PIVOT’
Warning: replacing previous import ‘S4Vectors::setequal’ by ‘dplyr::setequal’ when loading ‘PIVOT’
Warning: replacing previous import ‘S4Vectors::union’ by ‘dplyr::union’ when loading ‘PIVOT’
Warning: replacing previous import ‘S4Vectors::rename’ by ‘dplyr::rename’ when loading ‘PIVOT’
Warning: replacing previous import ‘Biobase::combine’ by ‘dplyr::combine’ when loading ‘PIVOT’
Warning: replacing previous import ‘dplyr::union’ by ‘igraph::union’ when loading ‘PIVOT’
Warning: replacing previous import ‘dplyr::as_data_frame’ by ‘igraph::as_data_frame’ when loading ‘PIVOT’
Warning: replacing previous import ‘dplyr::groups’ by ‘igraph::groups’ when loading ‘PIVOT’
Warning: replacing previous import ‘igraph::groups’ by ‘plotly::groups’ when loading ‘PIVOT’
Warning: replacing previous import ‘ggplot2::last_plot’ by ‘plotly::last_plot’ when loading ‘PIVOT’
Warning: replacing previous import ‘DT::dataTableOutput’ by ‘shiny::dataTableOutput’ when loading ‘PIVOT’
Warning: replacing previous import ‘DT::renderDataTable’ by ‘shiny::renderDataTable’ when loading ‘PIVOT’
Warning: replacing previous import ‘igraph::as_data_frame’ by ‘tibble::as_data_frame’ when loading ‘PIVOT’
Welcome to PIVOT: Platform for Interactive Analysis and Visualization of Transcriptomics Data

Attaching package: ‘PIVOT’

The following object is masked from ‘package:igraph’:

    %>%

The following object is masked from ‘package:shinydashboard’:

    dropdownMenu

Loading required package: monocle
Loading required package: Matrix
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: ‘BiocGenerics’

The following objects are masked from ‘package:parallel’:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from ‘package:Matrix’:

    colMeans, colSums, rowMeans, rowSums, which

The following objects are masked from ‘package:igraph’:

    normalize, union

The following objects are masked from ‘package:stats’:

    IQR, mad, sd, var, xtabs

The following objects are masked from ‘package:base’:

    anyDuplicated, append, as.data.frame, cbind, colMeans, colnames,
    colSums, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, lengths, Map, mapply, match,
    mget, order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rowMeans, rownames, rowSums, sapply, setdiff, sort,
    table, tapply, union, unique, unsplit, which, which.max, which.min

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Attaching package: ‘Biobase’

The following object is masked from ‘package:PIVOT’:

    pData

Loading required package: ggplot2
Loading required package: VGAM
Loading required package: stats4
Loading required package: splines
Loading required package: DDRTree
Loading required package: irlba
Error in shiny::runApp(system.file("app", package = "PIVOT"), launch.browser = T) : 
  Can't call `runApp()` from within `runApp()`. If your application code contains `runApp()`, please remove it.
Calls: runApp ... ..stacktraceon.. -> pivot -> pivot_main -> <Anonymous>
Execution halted

Would you be so kind to explain how could I convert your package into a shinyApp? I have the feeling that it should be simple, but I might be wrong here. Thanks a lot in advance

qinzhu commented 6 years ago

Hi Daniel,

Thanks a lot for your interest in using PIVOT.

Currently PIVOT is mainly designed as an R package for users to run on their own machine. However, like you said, as a Shiny app, it can be run on a server with some tweaks. But I don't think pasting the app folder will work. I'm planning to release a version of PIVOT what can work on shiny server very soon. I'll let you know once it's out.

danielmart commented 6 years ago

Thanks for you prompt response. Yes, after having fought with this for a while I have figured it is not something trivial... Thanks for looking into it.

On Thu, Dec 28, 2017 at 4:15 PM, Qin Zhu notifications@github.com wrote:

Hi Daniel,

Thanks a lot for your interest in using PIVOT.

Currently PIVOT is mainly designed as an R package for users to run on their own machine. However, like you said, as a Shiny app, it can be run on a server with some tweaks. But I don't think pasting the app folder will work. I'm planning to release a version of PIVOT what can work on shiny server very soon. I'll let you know once it's out.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/qinzhu/PIVOT/issues/1#issuecomment-354359046, or mute the thread https://github.com/notifications/unsubscribe-auth/ABwVvwxuzHe5SSgqvdfw8BxPD68aQK9Gks5tFAT6gaJpZM4ROpgl .

gongyixiao commented 6 years ago

Hi, Qin,

Thank you for your beautiful work first of all. I'm just wondering if there is any update about the shinny server app development as I have the exact same demand as Daniel here.

Thanks. Yixiao

qinzhu commented 6 years ago

Hi @gongyixiao @danielmart, Sorry for not getting this out soon enough. Have been a little bit occupied previously. I'll try to get a server version released with new feature updates by early August.

Best, Qin

danielmart commented 6 years ago

That is super good news! We really look forward to it and thank you very much for your hard work.

On Mon, Jun 4, 2018, 3:32 PM Qin Zhu notifications@github.com wrote:

Hi @gongyixiao https://github.com/gongyixiao @danielmart https://github.com/danielmart, Sorry for not getting this out soon enough. Have been a little bit occupied previously. I'll try to get a server version released with new feature updates by early August.

Best, Qin

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/qinzhu/PIVOT/issues/1#issuecomment-394471543, or mute the thread https://github.com/notifications/unsubscribe-auth/ABwVv9y7oBzlgDiSj3r3MYksZAT97JOYks5t5Ys_gaJpZM4ROpgl .

gongyixiao commented 6 years ago

Thank you very much Qin. It's wonderful. Looking forward to it. BTW, I'm wondering if the new server version will allow admins to customize the layout and function modules to fit for special needs within organizations.

Thanks.

qinzhu commented 6 years ago

@gongyixiao I'll look into possible approaches for customization. The layout can be changed by html/css code, I'll also try to build in some default layout options. PIVOT is modularized so should be easy to set which module to load/remove.

gongyixiao commented 6 years ago

Thank you very much. Looking forward to it.

qinzhu commented 5 years ago

Just as a follow up to this issue: Malcolm Cook pointed out to me that with latest PIVOT, you can run it on shiny server by putting stuff inside app/inst folder to the corresponding shinyserver folder. And on the shiny server, make sure call library(PIVOT), that will allow PIVOT to run in server mode like any other shiny apps. Feel free to post questions here if this approach does not work. Apologize for the delay on solving this issue.

danielmart commented 5 years ago

I can confirm that it works. I cloned the last PIVOT version into the shiny server folder (/srv/shiny-server in my deployment) and then copied the contents of inst/app to the root PIVOT folder like this:

root@brics:/srv/shiny-server/PIVOT# tree -L 1
.
├── DESCRIPTION
├── global.R
├── gpl-2.0.txt
├── inst
├── man
├── NAMESPACE
├── PIVOT.analysis.Rproj
├── R
├── README.md
├── server.R
├── src
├── ui.R
├── vignettes
└── www

I modified ui.R to include a call to PIVOT by adding library(PIVOT) before the sourcing of the src/ui_code. You have to restart the shiny-server service sudo systemctl restart shiny-server and that pretty much does it. I have not tested extensively but it seems to be working just fine.