Skip to content

Commit

Permalink
OA now correctly takes preprocessing argument into account (#159)
Browse files Browse the repository at this point in the history
* OA now correctly takes into account whether you want the gene list before or after preprocessing.

* Update program/shinyApp/R/pca/server.R

Co-authored-by: Lea Seep <[email protected]>

---------

Co-authored-by: Lea Seep <[email protected]>
  • Loading branch information
PaulJonasJost and LeaSeep authored Jan 24, 2024
1 parent c864c9f commit 5c06cce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,25 @@ over_representation_analysis <- function(

if(!isTruthy(input$UniverseOfGene)){
universeSelected_tranlsated <- NULL
}else{
if(input$UniverseOfGene == "default"){
universeSelected_tranlsated <- NULL
}
}
# TODO: workaround and is needed?
if(input$UniverseOfGene == "allPresentGenes_before_pre_process"){
} else if(input$UniverseOfGene == "default"){
universeSelected_tranlsated <- NULL
} else {
# TODO: only works with ENSEMBL IDs at the moment
req(data_input_shiny())
universeSelected <- rownames(data)
if(input$UniverseOfGene == "after_pre_process"){
universeSelected <- rownames(data$data)
} else if(input$UniverseOfGene == "before_pre_process"){
universeSelected <- rownames(data$data_original)
}
# Note if transcripts are used this will be ignored for enrichment analysis
universeSelected <- unique(gsub("\\..*$","",universeSelected))
print(paste0("Universe genes untranslated: ",length(universeSelected)))
universeSelected_tranlsated <- bitr(
universeSelected,
fromType = "ENSEMBL",
toType = "ENTREZID",
OrgDb = ifelse(input$OrganismChoice == "hsa","org.Hs.eg.db","org.Mm.eg.db"))$ENTREZID
OrgDb = ifelse(input$OrganismChoice == "hsa","org.Hs.eg.db","org.Mm.eg.db")
)$ENTREZID
print(paste0(
"Universe genes translated (hence actually used): ",
length(universeSelected_tranlsated)
Expand Down
6 changes: 3 additions & 3 deletions program/shinyApp/R/enrichment_analysis/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,8 @@ enrichment_analysis_Server <- function(id, data, params, updates){
label = "Select an Universe for enrichment (default is clusterProfilers default",
choices = c(
"default",
"allPresentGenes_after_pre_process",
"allPresentGenes_before_pre_process"
"after_pre_process",
"before_pre_process"
),
selected = "default"
)
Expand Down Expand Up @@ -797,7 +797,7 @@ enrichment_analysis_Server <- function(id, data, params, updates){
input,
output,
ea_reactives$tmp_genes,
ea_reactives$data,
data,
ea_reactives$enrichments2do,
input$test_correction
)
Expand Down

0 comments on commit 5c06cce

Please sign in to comment.