Question: Shiny board with seurat object
0
gravatar for Dataminer
12 weeks ago by
Dataminer2.7k
Netherlands
Dataminer2.7k wrote:

Dear community,

I am trying to make a shiny app by reading in seurat object. Unfortunately, it doesn't work. I have deployed the following code:

library(shiny)
library(shinythemes)
library(Seurat)
library(ggplot2)
library(gridExtra)
library(egg)
library(RColorBrewer)
library(shinyWidgets)

# Getting the file names
rdsfiles <- list.files("/temp2/data", pattern = "\\.rds$")

# Define UI for dataset viewer application
ui <- shinyUI(fluidPage(theme = shinytheme("cerulean"), pageWithSidebar(

    # Application title
    headerPanel("Shiny App with multiple datasets"),
    # Sidebar with controls to select a dataset and specify the number
    # of observations to view
    sidebarPanel(
        selectInput("dataset", "Choose a dataset:", 
                    choices = rdsfiles),
    ),

    # Show a summary of the dataset and an HTML table with the requested
    # number of observations
    mainPanel(
        tabsetPanel(
            tabPanel('UMAP', plotOutput("umap")),
            tabPanel('Gene', plotOutput("gene"))

        ))

)))

# Define server logic required to summarize and view the selected dataset
server <- shinyServer(function(input, output) {

    # Return the requested dataset
    datasetInput <- reactive({
        df <- readRDS(paste0("/temp2/data/", input$dataset))
        return(df)
    })

    # Generate a UMAP of the dataset
    output$umap <- renderPlot({
        dataset <- datasetInput()
        plot(input$dataset, reduction = "umap")

    })

    # Generate a Feature of the dataset
    output$gene <- renderPlot({
        dataset <- datasetInput()
        FeaturePlot(dataset, reduction = "umap")

    })

})


shinyApp(ui, server)

The output is an error "Cannot find "umap" in seurat object" for both the buttons.

I am not sure what I doing wrong. However, I am sure that some of you must have tackled this problem in past. Your input is highly appreciated.

Thank you

seurat shiny • 223 views
ADD COMMENTlink modified 5 weeks ago by Apoorva270 • written 12 weeks ago by Dataminer2.7k
0
gravatar for Jean-Karim Heriche
12 weeks ago by
EMBL Heidelberg, Germany
Jean-Karim Heriche24k wrote:

Seurat depends on the uwot R package which you also need to install.

ADD COMMENTlink written 12 weeks ago by Jean-Karim Heriche24k

Hi, My seurat works fine and I get all the images and analysis done. It is when I try to put the seurat object into R shiny, it throws up this error.

ADD REPLYlink written 12 weeks ago by Dataminer2.7k
0
gravatar for Apoorva
5 weeks ago by
Apoorva270
United States
Apoorva270 wrote:

You have to use the DimPlot function in place of

plot(input$dataset, reduction = "umap")

Try

DimPlot(input$dataset, reduction = "umap")
ADD COMMENTlink modified 5 weeks ago • written 5 weeks ago by Apoorva270
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 975 users visited in the last hour
_