Commit edb27345 authored by Bagueneau Mathias's avatar Bagueneau Mathias
Browse files

Solution temporaire pour les marqueurs page compare

parent 3ccf7055
......@@ -693,42 +693,48 @@ server <- function(input, output, session) {
})
observeEvent(input$findmarkers, {
# if (is.null(rownames(cells_to_plot1@meta.data)) || is.null(rownames(cells_to_plot2@meta.data))) {
# showModal(modalDialog("At least one of the select is empty !", title=strong("Warning !"), easyClose=TRUE, footer = NULL ))
# } else if (length(intersect(rownames(cells_to_plot1@meta.data),rownames(cells_to_plot2@meta.data))) != 0) {
# showModal(modalDialog("You must choose only different groups.", title=strong("Warning !"), easyClose=TRUE, footer = NULL ))
# } else {
if (!exists("ffm")) {
ffm <- filedata$data
}
# Problème des Idents (lequel choisir ?) et du type d'objet de cells_to_plot...)
Idents(object=ffm) <- input$fsel2
df <- withProgress(data.frame(FindMarkers(ffm, cells_to_plot1,cells_to_plot2, test.use = "MAST")), message = "Preparing data", value=1)
setDT(df, keep.rownames = TRUE)[]
df <- data.frame(c(df,(input$fsel2)))
names(df)[[1]] <- "Gene"
names(df)[[4]] <- paste("pct.",sapply(input$library1_compare, paste, collapse=""), collapse=" + ")
names(df)[[5]] <- paste("pct.",sapply(input$library2_compare, paste, collapse=""), collapse=" + ")
names(df)[[7]] <- paste("",input$fsel2)
output$markers_compare <- renderDataTable ({
req(filedata$data)
withProgress(datatable(df[c(1,4,5,3,2,6)], rownames=FALSE, caption = "Table 2 : Significant markers of your query | Test used : MAST" ), message = "Render DataTable", value=1) %>% formatRound(columns=c(1,2,3,4), digits=5) %>% formatSignif(columns=c(6,5), digits=5)
})
output$dlmarkbutton_compare <- renderUI ({
downloadButton("dlmarkers_compare", label="")
})
output$dlmarkers_compare <- downloadHandler(
filename = function() {
paste0(filedata$name,"_markers_",names(df)[[7]],".csv")
},
content = function(file) {
write.csv(df, file, row.names=FALSE)
if ((input$add1 %% 2 == 0) || (input$add2 %% 2 == 0)) { # Là ça filtre pas des masses mais tant pis c'est temporaire
if (is.null(input$library1_compare) || is.null(input$library2_compare)) {
showModal(modalDialog("At least one of the select is empty !", title=strong("Warning !"), easyClose=TRUE, footer = NULL ))
} else if (length(intersect(input$library1_compare,input$library2_compare)) != 0) {
showModal(modalDialog("You must choose only different groups.", title=strong("Warning !"), easyClose=TRUE, footer = NULL ))
} else {
if (!exists("ffm")) {
ffm <- filedata$data
}
)
# }
Idents(object=ffm) <- input$fsel2
df <- withProgress(data.frame(FindMarkers(ffm, input$library1_compare,input$library2_compare, test.use = "MAST")), message = "Preparing data", value=1)
setDT(df, keep.rownames = TRUE)[]
df <- data.frame(c(df,(input$fsel2)))
names(df)[[1]] <- "Gene"
names(df)[[4]] <- paste("pct.",sapply(input$library1_compare, paste, collapse=""), collapse=" + ")
names(df)[[5]] <- paste("pct.",sapply(input$library2_compare, paste, collapse=""), collapse=" + ")
names(df)[[7]] <- paste("",input$fsel2)
output$markers_compare <- renderDataTable ({
req(filedata$data)
withProgress(datatable(df[c(1,4,5,3,2,6)], rownames=FALSE, caption = "Table 2 : Significant markers of your query | Test used : MAST" ), message = "Render DataTable", value=1) %>% formatRound(columns=c(1,2,3,4), digits=5) %>% formatSignif(columns=c(6,5), digits=5)
})
output$dlmarkbutton_compare <- renderUI ({
downloadButton("dlmarkers_compare", label="")
})
output$dlmarkers_compare <- downloadHandler(
filename = function() {
paste0(filedata$name,"_markers_",names(df)[[7]],".csv")
},
content = function(file) {
write.csv(df, file, row.names=FALSE)
}
)
}
} else { # Piste de problèmes : les idents, le type des cells_to_plot...
print("Hello :/ !")
}
})
}
......
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