Skip to content

Commit

Permalink
cluster gene sets in ORA
Browse files Browse the repository at this point in the history
  • Loading branch information
mengchen18 committed Feb 13, 2024
1 parent 39c477a commit e8e3ef9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: omicsViewer
Title: Interactive and explorative visualization of SummarizedExperssionSet or ExpressionSet using omicsViewer
Version: 1.7.2
Version: 1.7.3
Authors@R: person("Chen", "Meng", email = "mengchen18@gmail.com",
role = c("aut", "cre"))
Description: omicsViewer visualizes ExpressionSet (or SummarizedExperiment) in an interactive way. The omicsViewer has a separate back- and front-end. In the back-end, users need to prepare an ExpressionSet that contains all the necessary information for the downstream data interpretation. Some extra requirements on the headers of phenotype data or feature data are imposed so that the provided information can be clearly recognized by the front-end, at the same time, keep a minimum modification on the existing ExpressionSet object. The pure dependency on R/Bioconductor guarantees maximum flexibility in the statistical analysis in the back-end. Once the ExpressionSet is prepared, it can be visualized using the front-end, implemented by shiny and plotly. Both features and samples could be selected from (data) tables or graphs (scatter plot/heatmap). Different types of analyses, such as enrichment analysis (using Bioconductor package fgsea or fisher's exact test) and STRING network analysis, will be performed on the fly and the results are visualized simultaneously. When a subset of samples and a phenotype variable is selected, a significance test on means (t-test or ranked based test; when phenotype variable is quantitative) or test of independence (chi-square or fisher’s exact test; when phenotype data is categorical) will be performed to test the association between the phenotype of interest with the selected samples. Additionally, other analyses can be easily added as extra shiny modules. Therefore, omicsViewer will greatly facilitate data exploration, many different hypotheses can be explored in a short time without the need for knowledge of R. In addition, the resulting data could be easily shared using a shiny server. Otherwise, a standalone version of omicsViewer together with designated omics data could be easily created by integrating it with portable R, which can be shared with collaborators or submitted as supplementary data together with a manuscript.
Expand Down
11 changes: 10 additions & 1 deletion R/auxi_vectORA.R
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,15 @@ vectORA.core <- function(n.overlap, n.de, n.gs, n.bkg, unconditional.or = TRUE,
}



#' Calculate Jaccard distance from a list
#' @param x a list
#' @return an dist object
jaccardList <- function(x) {
ax <- unique(unlist(x))
m <- sapply(x, function(x1) as.integer(ax %in% x1))
ist <- crossprod(m)
uni <- apply(m, 2, function(x) colSums(x + m > 0))
as.dist(1-ist/uni)
}


6 changes: 4 additions & 2 deletions R/module_ora.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,15 @@ enrichment_analysis_module <- function(
rp <- reactive_pathway() else
rp <- reactive_pathway_collapsed()

ll <<- list(gs = rp, i = rii(), background = size_bg())
tab <- vectORATall(rp, i = rii(), background = size_bg())
if (is.null(tab))
return(notest)
ic <- which(vapply(tab, function(x) is.numeric(x) & !is.integer(x), logical(1)))
tab[, ic] <- lapply(tab[, ic], signif, digits = 3)
tab <- tab[which(tab$p.adjusted < 0.1 | tab$p.value < 0.05 | tab$OR >= 3), ]
tab <- tab[which(tab$p.adjusted < 0.1 | tab$p.value < 0.05 | tab$OR >= 3), ]
hcl <- hclust(jaccardList(tab$overlap_ids))
cls <- cutree(hcl, h = 0.45)
tab$desc <- paste("cluster", cls, tab$desc, sep = "_")
tab
})

Expand Down

0 comments on commit e8e3ef9

Please sign in to comment.