0

我已经被这个问题困了好几天了。

我正在构建一个闪亮的应用程序,用户在其中选择一个数据集,然后服务器将读取相应的 .rds 文件并渲染绘图。绘图工具需要 Seurat 包。

当我在本地测试时,它可以工作。然后我部署到我们大学托管的闪亮服务器上,这些应用程序在 Rstudio 服务器上也运行良好。

但是,当我通过外部链接时,没有渲染图,说“发生错误。检查您的日志或联系应用程序作者进行澄清。”

我四处搜索,发现可能与环境相关的原因:

  1. 我确实检查了文件路径,并且由于我已经在同一台机器上进行了测试(Rstudio 服务器与闪亮服务器相同),这可能不是问题吗?
  2. 包当我在闪亮的 app.R 的开头加载库(Seurat)时,外部链接会失败,但 Rstudio 服务器运行良好。所以我尝试 ggplot2 来测试它是否是一个包问题,它加载没有问题,并且绘制了图。

具体来说,似乎是Seurat兼容性问题,但为什么在同一台机器上它在Rstudio服务器上工作?Seurat 社区说这个问题已经在新的 CRAN 版本(3.2.0)中得到解决,但为什么我仍然遇到这个问题?如何解决它..??

这些是我注意到的,希望各位高手能给我一些想法……

以下是读取 .rds 和渲染绘图的代码:

# read .rds
germ <- readRDS(file.path(paste("/srv/shiny-server/GermlinAtlas/data/",input$dataset,".rds", sep="")))

# render plot
observeEvent(input$dataset, {
  if (is.null(input$dataset)) return(NULL)
     if (is.null(input$gene)) return(NULL)
          infile <- isolate(input$dataset)
          germ <- readRDS(file.path(paste("/srv/shiny-server/GermlinAtlas/data/",infile,".rds", sep=""))) # read .rds
          gene <- isolate(input$gene)
          
          x <- rnorm(100)  # for ggplot test
          y <- rnorm(300)  # for ggplot test
          output$dim <- renderPlot({
            DimPlot(germ, reduction = "umap") # plot with Seurat
            plot(x,y[1:100]) # plot with ggplot2
          })
          output$featureplot <- renderPlot({
            FeaturePlot(germ, input$gene) # plot with Seurat
          })
        })

Rstudio 服务器的输出: Rstudio 服务器的输出:

服务器输出(用户端): 在此处输入图像描述

4

0 回答 0