Ordenar secciones.
This commit is contained in:
+37
-46
@@ -26,18 +26,20 @@ ui <- fluidPage(
|
|||||||
|
|
||||||
mainPanel(
|
mainPanel(
|
||||||
plotOutput("umapPlot"),
|
plotOutput("umapPlot"),
|
||||||
uiOutput("featPlotUI"),
|
uiOutput("featPlotUI")
|
||||||
uiOutput("mod_featPlotUI"),
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Define server logic required to draw a histogram
|
# Define server logic
|
||||||
server <- function(input, output) {
|
server <- function(input, output) {
|
||||||
|
|
||||||
|
## Defining reactive values
|
||||||
dades<-reactiveValues()
|
dades<-reactiveValues()
|
||||||
dades$seu<-NULL
|
dades$seu<-NULL
|
||||||
dades$mods<-NULL
|
dades$mods<-NULL
|
||||||
|
|
||||||
|
## Conecting with file location and entering Seurat object
|
||||||
volumes <- c(Home = fs::path_home(), "R Installation" = R.home(), getVolumes()())
|
volumes <- c(Home = fs::path_home(), "R Installation" = R.home(), getVolumes()())
|
||||||
shinyFileChoose(input, 'file', roots=volumes)
|
shinyFileChoose(input, 'file', roots=volumes)
|
||||||
|
|
||||||
@@ -47,6 +49,7 @@ server <- function(input, output) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
## Rendering UI depending on seu meta.data
|
||||||
output$groupby<-renderUI({
|
output$groupby<-renderUI({
|
||||||
if (!is.null(dades$seu)){
|
if (!is.null(dades$seu)){
|
||||||
selectInput("groupby", "GroupBy", c("Default", colnames(dades$seu@meta.data)))
|
selectInput("groupby", "GroupBy", c("Default", colnames(dades$seu@meta.data)))
|
||||||
@@ -59,6 +62,7 @@ server <- function(input, output) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
## Render DimPlot
|
||||||
output$umapPlot <- renderPlot({
|
output$umapPlot <- renderPlot({
|
||||||
observeEvent(dades$seu, {})
|
observeEvent(dades$seu, {})
|
||||||
if (!is.null(dades$seu)){
|
if (!is.null(dades$seu)){
|
||||||
@@ -70,17 +74,20 @@ server <- function(input, output) {
|
|||||||
plot
|
plot
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
query<-eventReactive(input$goButton,{
|
## Signature - Module Definition
|
||||||
dades$fet_query<-strsplit(input$features, " ")[[1]]
|
observeEvent(input$modButton, {
|
||||||
|
if (input$modButton > 0){
|
||||||
|
mod_list<-strsplit(input$mod_feat, " ")[[1]]
|
||||||
|
mod_list<-mod_list[mod_list %in% rownames(dades$seu)]
|
||||||
|
dades$seu<-AddModuleScore(dades$seu,list(mod_list),
|
||||||
|
name=input$mod_name)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
query_mod<-eventReactive(input$goButton,{
|
## FeaturePlot construction
|
||||||
if (length(strsplit(input$mods, " ")[[1]]) > 0){
|
query<-eventReactive(input$goButton,{
|
||||||
dades$mods<-paste(strsplit(input$mods, " ")[[1]], "1", sep="")
|
dades$fet_query<-strsplit(input$features, " ")[[1]]
|
||||||
}else{
|
|
||||||
dades$mods<-NULL
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
output$featPlotUI<- renderUI({
|
output$featPlotUI<- renderUI({
|
||||||
@@ -90,7 +97,25 @@ server <- function(input, output) {
|
|||||||
height = paste0(input$height/10,"px"))
|
height = paste0(input$height/10,"px"))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
## ModulePlot/SigPlot construction
|
||||||
|
query_mod<-eventReactive(input$goButton,{
|
||||||
|
if (length(strsplit(input$mods, " ")[[1]]) > 0){
|
||||||
|
dades$mods<-paste(strsplit(input$mods, " ")[[1]], "1", sep="")
|
||||||
|
}else{
|
||||||
|
dades$mods<-NULL
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
output$modPlotUI<- renderUI({
|
||||||
|
observeEvent(dades$mod_name, {})
|
||||||
|
if (!is.null(dades$mod_name)){
|
||||||
|
plotOutput("modPlot",
|
||||||
|
height = paste0(input$height/10,"px"))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
## Feature/Mod plot rendering
|
||||||
output$featPlot<-renderPlot({
|
output$featPlot<-renderPlot({
|
||||||
observeEvent(input$goButton, {})
|
observeEvent(input$goButton, {})
|
||||||
if (!is.null(dades$seu)){
|
if (!is.null(dades$seu)){
|
||||||
@@ -112,41 +137,7 @@ server <- function(input, output) {
|
|||||||
do.call(ggarrange, c(plot, ncol=1))
|
do.call(ggarrange, c(plot, ncol=1))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
observeEvent(input$modButton, {
|
|
||||||
if (input$modButton > 0){
|
|
||||||
mod_list<-strsplit(input$mod_feat, " ")[[1]]
|
|
||||||
mod_list<-mod_list[mod_list %in% rownames(dades$seu)]
|
|
||||||
dades$seu<-AddModuleScore(dades$seu,list(mod_list),
|
|
||||||
name=input$mod_name)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
# query_mod<-eventReactive(input$modButton,{
|
|
||||||
# dades$seu<-AddModuleScore(dades$seu,strsplit(input$mod_feat, " ")[[1]],
|
|
||||||
# name=input$mod_name)
|
|
||||||
# dades$mods<-if(is.null(dades$mods)){input$mod_name}else{c(dades$mods, input$mod_name)}
|
|
||||||
# print(input$mod_name)
|
|
||||||
# })
|
|
||||||
|
|
||||||
output$modPlotUI<- renderUI({
|
|
||||||
observeEvent(dades$mod_name, {})
|
|
||||||
if (!is.null(dades$mod_name)){
|
|
||||||
plotOutput("modPlot",
|
|
||||||
height = paste0(input$height/10,"px"))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
output$modPlot<-renderPlot({
|
|
||||||
# observeEvent(dades$seu, {})
|
|
||||||
input$goButton
|
|
||||||
if (input$mods){
|
|
||||||
print(dades$mods)
|
|
||||||
FeaturePlot(dades$seu,
|
|
||||||
split.by=if(input$facetby != "None"){input$facetby}else{NULL},
|
|
||||||
features = dades$mods)&theme(aspect.ratio = 1)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user