Commit 1fab6a6f authored by Bagueneau Mathias's avatar Bagueneau Mathias
Browse files

- Same scale for Compare Features

- Adding AML-O27
parent 7912764e
......@@ -102,7 +102,7 @@ sidebar <- dashboardSidebar(
selectizeInput(inputId="genes2", label="Choose a gene :", choices ="")),
conditionalPanel(condition ="input.featuresel2 == 'd2'",
uiOutput("nchoice2"))),
radioButtons(inputId="graph_compare", label= "Choose the graph mode :", c("t-SNE" = "tsne", "UMAP" = "umap")),
radioButtons(inputId="graph_compare", label= "Choose the graph mode :", c("t-SNE" = "tsne", "UMAP" = "umap"), selected = "umap"),
sliderInput(inputId="ptsize_compare", label="Point size :", min=0.1, max=2, step=0.1, value = 0.6, ticks = FALSE),
conditionalPanel(condition = "input.choice_compare == 'f_compare'",
checkboxInput(inputId="show_clusters_compare", label="Clusters information", value=FALSE)
......@@ -137,7 +137,7 @@ sidebar <- dashboardSidebar(
fileInput(inputId="file1", label="Upload your *.rds file :", accept = ".rds", placeholder=""),
uiOutput("selectfile"),
conditionalPanel(condition= "output.fileUploaded", align="center",
radioButtons(inputId="graph", label= "Choose the graph mode :", c("t-SNE" = "tsne", "UMAP" = "umap")),
radioButtons(inputId="graph", label= "Choose the graph mode :", c("t-SNE" = "tsne", "UMAP" = "umap"), selected = "umap"),
checkboxInput(inputId="show_clusters", label="Clusters information", value=FALSE),
sliderInput(inputId="ptsize", label="Point size :", min=0.1, max=2, step=0.1, value = 0.6, ticks = FALSE)
)
......@@ -153,7 +153,7 @@ sidebar <- dashboardSidebar(
div(actionLink("help5", "", icon = icon("far fa-question-circle")), align="center"),
verbatimTextOutput(outputId = "no_file5"),
conditionalPanel(condition= "output.fileUploaded",align="center",
radioButtons(inputId="graph_grid", label= "Choose the graph mode :", c("t-SNE" = "tsne", "UMAP" = "umap")),
radioButtons(inputId="graph_grid", label= "Choose the graph mode :", c("t-SNE" = "tsne", "UMAP" = "umap"), selected = "umap"),
sliderInput(inputId="ptsize_grid", label="Point size :", min=0.1, max=2, step=0.1, value = 0.6, ticks = FALSE),
hr(),
selectizeInput(inputId="listminigenes", label="Choose a gene :", choices ="", multiple = TRUE), br(),
......@@ -177,7 +177,7 @@ body <- dashboardBody(
uiOutput(outputId = "clusters_infos"),
verbatimTextOutput(outputId = "select_infos"),
br(),
fluidRow(column(align="center", width = 6, plotlyOutput("plot_factors", width="575", height="500"), uiOutput("fchoice"),downloadButton("dlleftplot", label="")),
fluidRow(column(align="center", width = 6, plotlyOutput("plot_factors", width="500", height="500"), uiOutput("fchoice"),downloadButton("dlleftplot", label="")),
column(align="center", width = 6, plotlyOutput("plot_numerics", width="500", height="500"),uiOutput("featurechoice"), uiOutput("nchoice"),
conditionalPanel(condition ="input.featuresel == 'g'", selectizeInput(inputId="genes", label="Choose a gene :", choices ="")),downloadButton("dlrightplot", label=""))# br(), verbatimTextOutput(outputId="genes_analyse"))
),
......@@ -351,28 +351,28 @@ server <- function(input, output, session) {
})
factorsplotData <- reactive ({ # Left Graph Visu page
withProgress(DimPlot(object = wrfile(), label=FALSE, pt.size = input$ptsize, reduction=input$graph, group.by = input$fsel, cols = as.character(eval(parse(text=paste0("alldf()$",input$fsel,"$color"))))), message = "Plot Generation", value=1) + NoLegend() + theme_bw()+ theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$fsel))
withProgress(DimPlot(object = wrfile(), label=FALSE, pt.size = input$ptsize, reduction=input$graph, group.by = input$fsel, cols = as.character(eval(parse(text=paste0("alldf()$",input$fsel,"$color"))))), message = "Plot Generation", value=1) + NoLegend() + theme_bw()+ theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$fsel)) + theme(aspect.ratio = 1)
})
numericsplotData <- reactive ({ # Right Graph Visu page
if (input$featuresel =="d") {
withProgress(FeaturePlot(object = wrfile(), cols=c("lightgrey",plasma(200)), pt.size = input$ptsize, features = input$nsel, reduction = input$graph), message = "Plot Generation", value=1) + theme_bw() + NoLegend() + theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$nsel))
withProgress(FeaturePlot(object = wrfile(), cols=c("lightgrey",plasma(20)), pt.size = input$ptsize, features = input$nsel, reduction = input$graph), message = "Plot Generation", value=1) + theme_bw() + theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$nsel)) + theme(aspect.ratio = 1)
} else if (input$featuresel =="g") {
withProgress(FeaturePlot(object = wrfile(), cols=c("lightgrey",plasma(200)), pt.size = input$ptsize, features = input$genes, reduction = input$graph), message = "Plot Generation", value=1) + theme_bw() + NoLegend() + theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$genes))
withProgress(FeaturePlot(object = wrfile(), cols=c("lightgrey",plasma(20)), pt.size = input$ptsize, features = input$genes, reduction = input$graph), message = "Plot Generation", value=1) + theme_bw() + theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$genes)) + theme(aspect.ratio = 1)
}
})
miniplot_compareData <- reactive ({ # Mini Graph 1 Compare page
withProgress(DimPlot(object = wrfile(), label=TRUE, pt.size = input$ptsize_compare, legend="none", reduction=input$graph_compare, group.by = input$fsel2, cols = as.character(eval(parse(text=paste0("alldf()$",input$fsel2,"$color"))) )), message = "Plot Generation", value=1) + theme_bw() + theme(panel.grid.major=element_blank(),plot.title = element_text(size=12),panel.grid.minor=element_blank(),plot.background=element_blank()) + NoAxes() + NoLegend()
withProgress(DimPlot(object = wrfile(), label=TRUE, pt.size = input$ptsize_compare, legend="none", reduction=input$graph_compare, group.by = input$fsel2, cols = as.character(eval(parse(text=paste0("alldf()$",input$fsel2,"$color"))) )), message = "Plot Generation", value=1) + theme_bw() + theme(panel.grid.major=element_blank(),plot.title = element_text(size=12),panel.grid.minor=element_blank(),plot.background=element_blank()) + NoAxes() + NoLegend() + theme(aspect.ratio = 1)
})
miniplot_compare2Data <- reactive ({ # Mini Graph 2 Compare page
if (input$choice_compare == "features_compare") {
if (input$featuresel2 =="d2") {
withProgress(FeaturePlot(object = wrfile(), cols=c("lightgrey",plasma(200)), pt.size = input$ptsize_compare, features = input$nsel2, reduction = input$graph_compare), message = "Plot Generation", value=1) + theme_bw()+ NoLegend() + NoAxes() + theme(panel.grid.major=element_blank(),plot.title = element_text(size=12),panel.grid.minor=element_blank(),plot.background=element_blank())
withProgress(FeaturePlot(object = wrfile(), cols=c("lightgrey",plasma(20)), pt.size = input$ptsize_compare, features = input$nsel2, reduction = input$graph_compare), message = "Plot Generation", value=1) + theme_bw()+ NoLegend() + NoAxes() + theme(panel.grid.major=element_blank(),plot.title = element_text(size=12),panel.grid.minor=element_blank(),plot.background=element_blank()) + theme(aspect.ratio = 1)
} else if (input$featuresel2 =="g2") {
withProgress(FeaturePlot(object = wrfile(), cols=c("lightgrey",plasma(200)), pt.size = input$ptsize_compare, features = input$genes2, reduction = input$graph_compare), message = "Plot Generation", value=1) + theme_bw()+ NoLegend() + NoAxes() + theme(panel.grid.major=element_blank(),plot.title = element_text(size=12),panel.grid.minor=element_blank(),plot.background=element_blank())
withProgress(FeaturePlot(object = wrfile(), cols=c("lightgrey",plasma(20)), pt.size = input$ptsize_compare, features = input$genes2, reduction = input$graph_compare), message = "Plot Generation", value=1) + theme_bw()+ NoLegend() + NoAxes() + theme(panel.grid.major=element_blank(),plot.title = element_text(size=12),panel.grid.minor=element_blank(),plot.background=element_blank()) + theme(aspect.ratio = 1)
}
}
})
......@@ -391,12 +391,19 @@ server <- function(input, output, session) {
scalex <- scale_x_continuous(limits = c(min(wrfile()@reductions[[input$graph_compare]]@cell.embeddings[,1]), max(wrfile()@reductions[[input$graph_compare]]@cell.embeddings[,1])))
scaley <- scale_y_continuous(limits = c(min(wrfile()@reductions[[input$graph_compare]]@cell.embeddings[,2]), max(wrfile()@reductions[[input$graph_compare]]@cell.embeddings[,2])))
if (input$choice_compare == "f_compare") {
withProgress(DimPlot(object = wrfile(), cells=rownames(cells_to_plot1()@meta.data), label=FALSE, pt.size = input$ptsize_compare, reduction=input$graph_compare, group.by = input$fsel2, cols= c(as.character(eval(parse(text=paste0("alldf()$",input$fsel2,"$color")))[which(eval(parse(text=paste0("alldf()$",input$fsel2,"$group"))) %in% input$library1_compare)]), "#000000")), message = "Plot Generation", value=1) + NoLegend() + theme_bw() + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-",input$fsel2)) + scalex + scaley + theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank())
withProgress(DimPlot(object = wrfile(), cells=rownames(cells_to_plot1()@meta.data), label=FALSE, pt.size = input$ptsize_compare, reduction=input$graph_compare, group.by = input$fsel2, cols= c(as.character(eval(parse(text=paste0("alldf()$",input$fsel2,"$color")))[which(eval(parse(text=paste0("alldf()$",input$fsel2,"$group"))) %in% input$library1_compare)]), "#000000")), message = "Plot Generation", value=1) + NoLegend() + theme_bw() + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-",input$fsel2)) + scalex + scaley + theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + theme(aspect.ratio = 1)
} else {
palette.full <- c("lightgrey", plasma(20))
if (input$featuresel2 =="d2") {
withProgress(FeaturePlot(object = wrfile(), cells=rownames(cells_to_plot1()@meta.data), cols=c("lightgrey",plasma(200)), pt.size = input$ptsize_compare, features = input$nsel2, reduction = input$graph_compare), message = "Plot Generation", value=1) + theme_bw()+ NoLegend() + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$nsel2))+ theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + scalex + scaley
data.max.global <- max(FetchData(wrfile(), input$nsel2))
data.max.local <- max(FetchData(cells_to_plot1(), input$nsel2))
palette.local <- palette.full[1:ceiling(length(palette.full) * data.max.local / data.max.global)]
withProgress(FeaturePlot(object = wrfile(), cells=rownames(cells_to_plot1()@meta.data), cols=palette.local, pt.size = input$ptsize_compare, features = input$nsel2, reduction = input$graph_compare), message = "Plot Generation", value=1) + theme_bw()+ NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$nsel2))+ theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + scalex + scaley + theme(aspect.ratio = 1)
} else if (input$featuresel2 =="g2") {
withProgress(FeaturePlot(object = wrfile(), cells=rownames(cells_to_plot1()@meta.data), cols=c("lightgrey",plasma(200)), pt.size = input$ptsize_compare, features = input$genes2, reduction = input$graph_compare), message = "Plot Generation", value=1) + theme_bw()+ NoLegend() + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$genes2))+ theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) +scalex + scaley
gene.max.global <- max(FetchData(wrfile(), input$genes2))
gene.max.local <- max(FetchData(cells_to_plot1(), input$genes2))
palette.local <- palette.full[1:ceiling(length(palette.full) * gene.max.local / gene.max.global)]
withProgress(FeaturePlot(object = wrfile(), cols=palette.local, cells=rownames(cells_to_plot1()@meta.data), pt.size = input$ptsize_compare, features = input$genes2, reduction = input$graph_compare), message = "Plot Generation", value=1) + theme_bw() + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$genes2))+ theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) +scalex + scaley+ theme(aspect.ratio = 1)
}
}
})
......@@ -416,12 +423,19 @@ server <- function(input, output, session) {
scalex <- scale_x_continuous(limits = c(min(wrfile()@reductions[[input$graph_compare]]@cell.embeddings[,1]), max(wrfile()@reductions[[input$graph_compare]]@cell.embeddings[,1])))
scaley <- scale_y_continuous(limits = c(min(wrfile()@reductions[[input$graph_compare]]@cell.embeddings[,2]), max(wrfile()@reductions[[input$graph_compare]]@cell.embeddings[,2])))
if (input$choice_compare == "f_compare") {
withProgress(DimPlot(object = wrfile(), cells=rownames(cells_to_plot2()@meta.data), pt.size = input$ptsize_compare, reduction=input$graph_compare, group.by = input$fsel2, cols= c(as.character(eval(parse(text=paste0("alldf()$",input$fsel2,"$color")))[which(eval(parse(text=paste0("alldf()$",input$fsel2,"$group"))) %in% input$library2_compare)]), "#000000")), message = "Plot Generation", value=1) + NoLegend() + theme_bw() + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$fsel2))+ theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + scalex + scaley
withProgress(DimPlot(object = wrfile(), cells=rownames(cells_to_plot2()@meta.data), pt.size = input$ptsize_compare, reduction=input$graph_compare, group.by = input$fsel2, cols= c(as.character(eval(parse(text=paste0("alldf()$",input$fsel2,"$color")))[which(eval(parse(text=paste0("alldf()$",input$fsel2,"$group"))) %in% input$library2_compare)]), "#000000")), message = "Plot Generation", value=1) + NoLegend() + theme_bw() + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$fsel2))+ theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + scalex + scaley + theme(aspect.ratio = 1)
} else {
palette.full <- c("lightgrey", plasma(20))
if (input$featuresel2 =="d2") {
withProgress(FeaturePlot(object = wrfile(), cells=rownames(cells_to_plot2()@meta.data), cols=c("lightgrey",plasma(200)), pt.size = input$ptsize_compare, features = input$nsel2, reduction = input$graph_compare), message = "Plot Generation", value=1) + theme_bw() + NoLegend() + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$nsel2))+ theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + scalex + scaley
data.max.global <- max(FetchData(wrfile(), input$nsel2))
data.max.local <- max(FetchData(cells_to_plot2(), input$nsel2))
palette.local <- palette.full[1:ceiling(length(palette.full) * data.max.local / data.max.global)]
withProgress(FeaturePlot(object = wrfile(), cells=rownames(cells_to_plot2()@meta.data), cols=palette.local, pt.size = input$ptsize_compare, features = input$nsel2, reduction = input$graph_compare), message = "Plot Generation", value=1) + theme_bw() + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$nsel2))+ theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + scalex + scaley + theme(aspect.ratio = 1)
} else if (input$featuresel2 =="g2") {
withProgress(FeaturePlot(object = wrfile(), cells=rownames(cells_to_plot2()@meta.data), cols=c("lightgrey",plasma(200)), pt.size = input$ptsize_compare, features = input$genes2, reduction = input$graph_compare), message = "Plot Generation", value=1) + theme_bw() + NoLegend() + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$genes2))+ theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + scalex + scaley
gene.max.global <- max(FetchData(wrfile(), input$genes2))
gene.max.local <- max(FetchData(cells_to_plot2(), input$genes2))
palette.local <- palette.full[1:ceiling(length(palette.full) * gene.max.local / gene.max.global)]
withProgress(FeaturePlot(object = wrfile(), cols=palette.local, cells=rownames(cells_to_plot2()@meta.data), pt.size = input$ptsize_compare, features = input$genes2, reduction = input$graph_compare), message = "Plot Generation", value=1) + theme_bw() + NoAxes() + ggtitle(paste(file_path_sans_ext(filedata$name),"-", input$genes2))+ theme(panel.grid.major=element_blank(),plot.title = element_text(size=18),panel.grid.minor=element_blank(),plot.background=element_blank()) + scalex + scaley + theme(aspect.ratio = 1)
}
}
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment