library(shiny)
|
|
library(Seurat)
|
|
library(shinyFiles)
|
|
library(ggplot2)
|
|
|
|
# Define UI for application
|
|
ui <- fluidPage(
|
|
|
|
# Application title
|
|
titlePanel("scMonitor"),
|
|
|
|
sidebarLayout(
|
|
sidebarPanel(
|
|
shinyFilesButton("file", label="Select File", title="Select a Seurat Object", multiple=F)
|
|
),
|
|
|
|
mainPanel(
|
|
plotOutput("umapPlot")
|
|
)
|
|
)
|
|
)
|
|
|
|
# Define server logic required to draw a histogram
|
|
server <- function(input, output) {
|
|
dades<-reactiveValues()
|
|
dades$seu<-NULL
|
|
|
|
volumes <- c(Home = fs::path_home(), "R Installation" = R.home(), getVolumes()())
|
|
shinyFileChoose(input, 'file', roots=volumes)
|
|
|
|
observe({
|
|
if (!is.integer(input$file)){
|
|
print(parseFilePaths(volumes, input$file))
|
|
dades$seu<-readRDS(parseFilePaths(volumes, input$file)$datapath)
|
|
}
|
|
})
|
|
|
|
output$umapPlot <- renderPlot({
|
|
observeEvent(dades$seu, {})
|
|
if (!is.null(dades$seu)){
|
|
DimPlot(dades$seu)+theme(aspect.ratio=1)
|
|
}
|
|
})
|
|
}
|
|
|
|
# Run the application
|
|
shinyApp(ui = ui, server = server)
|