I am trying to create a shiny board for my scRNA seq data. I have saved my seurat objects adn I use following code as below:
library(shiny)
library(shinythemes)
library(Seurat)
library(uwot)
set_1 <- readRDS("/temp2/data/mydataB10.rds")
set_2 <- readRDS("/temp2/data/mydataB5.rds")
ui <- fluidPage(
# Application title
titlePanel("scRNAseq data browser"),
fluidRow(
column(4,
sidebarPanel(
radioButtons("dataset", label = h3("Dataset"),
choices = list("sample1" = "set_1", "sample2" = "set_2"),
selected = "set_1"),
helpText("Enter gene names in CAPS. Gene names must be exact."),
textInput("gene2", label = "Gene Name", value = "GAPDH")
)
),
column(8,
column(6,
mainPanel(
plotOutput("dimPlot1", width = "150%"),
plotOutput("genePlot2", width = "150%")
)
)
)
)
)
server <- function(input, output, session) {
datasetInput <- reactive({
df <- (input$dataset)
})
output$dimPlot1 <- renderPlot({
DimPlot(datasetInput(), reduction = "umap")
})
output$genePlot2 <- renderPlot({
FeaturePlot(datasetInput(), features = (input$gene2), reduction = "umap")
})
}
shinyApp(ui, server)
That error that I get on the section where image needs to be displayed is "Subscript out of bound".
Following dataset can be downloaded and used as an example curl -Lo pbmc_10k_v3.rds https://www.dropbox.com/s/3f3p5nxrn5b3y4y/pbmc_10k_v3.rds?dl=1
Can anyone help in fixing this shiny script so that it works.
Many thanks.