Skip to content

Commit

Permalink
Adding the cerebro exporting functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
erzakiev committed Nov 2, 2023
1 parent a7b1439 commit 0ab9d74
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
48 changes: 46 additions & 2 deletions src/Shiva/Export_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ExportUI <- function(id) {
width = 6, height = NULL,
solidHeader = TRUE, status = "primary",
radioButtons(ns("type_export"), label = "Choose the Type of Data to Export",
c("Seurat Object RDS File" = "seurat", "List of Genes" = "genes", "List of Cells" = "cells"), inline = T),
c("Seurat Object RDS File" = "seurat", "Cerebro .crb file" = "Cerebro", "List of Genes" = "genes", "List of Cells" = "cells"), inline = T),
uiOutput(ns("select_export")),
uiOutput(ns("button_export"))
#Asif
Expand Down Expand Up @@ -64,6 +64,18 @@ Export <- function(input, output, session, rval) {

})

getCerebro <- reactive({

if(length(rval$seurat_list) > 0){

seu <- rval$seurat_list

return(seu)

}

})




Expand Down Expand Up @@ -131,6 +143,11 @@ Export <- function(input, output, session, rval) {
selectInput(ns("select"), "Select", getCellsList(), selected = tail(getCellsList(),1),
multiple = F, selectize = T)

}else if(input$type_export == "Cerebro"){

selectInput(ns("select"), "Select", getCerebro(), selected = tail(getCerebro(),1),
multiple = F, selectize = T)

}
}

Expand Down Expand Up @@ -164,7 +181,9 @@ Export <- function(input, output, session, rval) {

if(input$type_export == "seurat"){
paste(input$select, ".rds", sep = "")
}else{
} else if (input$type_export == "Cerebro") {
paste(input$select, ".crb", sep = "")
} else{
paste(input$select, ".csv", sep = "")
}

Expand Down Expand Up @@ -239,6 +258,31 @@ Export <- function(input, output, session, rval) {
# Close modal progress when csv is saved
remove_modal_spinner()

} else if(input$type_export == "Cerebro"){

# Create modal progress during csv creation and saving
show_modal_spinner(text = 'Creating a Cerebro file... Please wait...', spin = 'circle')

if(input$select == rval$seurat_selected){

exportFromSeurat(object = rval$seurat, groups = c('orig.ident', 'seurat_clusters'), nUMI = "nCount_RNA", nGene = "nFeature_RNA", experiment_name = "exportFromShIVA", organism = "mouse", file = "CerebroExportFromShiva.crb")

}else{

for(seu in rval$seurat_list){

if(seu == input$select){

saveRDS(readRDS(paste0(rval$output,"/",seu,".rds")), file)

}

}

}

# Close modal progress when csv is saved

}
}
)
Expand Down
1 change: 1 addition & 0 deletions src/Shiva/global.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ library(kableExtra)
library(org.Mm.eg.db)
library(clusterProfiler)
library(org.Hs.eg.db)
library(cerebroApp)

options(shiny.maxRequestSize = 1000 * 1024^10)

Expand Down
1 change: 1 addition & 0 deletions src/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ RUN R -e 'install.packages( "viridis")'

RUN R -e 'library(devtools);devtools::install_github("JinmiaoChenLab/Rphenograph")'
RUN R -e 'library(devtools);devtools::install_github("JinmiaoChenLab/ClusterX")'
RUN R -e 'library(devtools);devtools::install_github("romanhaa/cerebroApp")'

RUN R -e 'BiocManager::install("flowCore")'
RUN R -e 'BiocManager::install("openCyto")'
Expand Down

0 comments on commit 0ab9d74

Please sign in to comment.