From a9377f2494608d26819c42caeeccd83bd45f91da Mon Sep 17 00:00:00 2001 From: Marcel Costa Date: Tue, 3 Oct 2023 19:35:08 +0200 Subject: [PATCH] Visor de genes. --- scMonitor/app.R | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/scMonitor/app.R b/scMonitor/app.R index 85544e1..eb905b3 100644 --- a/scMonitor/app.R +++ b/scMonitor/app.R @@ -13,11 +13,15 @@ ui <- fluidPage( sidebarPanel( shinyFilesButton("file", label="Select File", title="Select a Seurat Object", multiple=F), uiOutput('groupby'), - uiOutput('facetby') + uiOutput('facetby'), + textInput('features', label = "Genes"), + actionButton("goButton", "Query"), + sliderInput("height", "Altura", min=1000, max=20000, step=1000, value=6000) ), mainPanel( - plotOutput("umapPlot") + plotOutput("umapPlot"), + uiOutput("featPlotUI") ) ) ) @@ -48,6 +52,10 @@ server <- function(input, output) { } }) + query<-eventReactive(input$goButton,{ + dades$fet_query<-strsplit(input$features, " ")[[1]] + }) + output$umapPlot <- renderPlot({ observeEvent(dades$seu, {}) if (!is.null(dades$seu)){ @@ -57,7 +65,25 @@ server <- function(input, output) { split.by=if(input$facetby != "None"){input$facetby}else{NULL})+ theme(aspect.ratio=1) plot - + } + }) + + output$featPlotUI<- renderUI({ + observeEvent(dades$fet_query, {}) + if (!is.null(dades$seu)){ + plotOutput("featPlot", + height = paste0(input$height/10,"px")) + } + }) + + output$featPlot<-renderPlot({ + observeEvent(dades$seu, {}) + if (!is.null(dades$seu)){ + query() + + FeaturePlot(dades$seu, + split.by=if(input$facetby != "None"){input$facetby}else{NULL}, + features = dades$fet_query)&theme(aspect.ratio = 1) } }) }