Skip to content

Commit a0e029b

Browse files
committed
signed enricher, gsea; gsea now accepts full transcriptome
Enricher previously (correctly) accepted the top 10 quantile and bottom 10 quantile of significant genes. It now does the same thing but with the added constraint of genes actually having positive or negative logFC with upregulated and downregulated pathways respectively. GSEA previously (incorrectly) accepted the top 10 quantile and bottom 10 quantile of all genes; it should have been taking the entire transcriptome. It now no longer accepts quantile measures for lower or upper but instead calculates what is positive and what is negative in terms of log fold change and then inputs that into GSEA.
1 parent 1d92af3 commit a0e029b

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

R/do_enrichr_pod.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ do_enrichr_pod <- function(bpn, alpha = 0.05, lower = NULL, upper = NULL, useFDR
4343
"Cellular_Component")
4444

4545
upreg <- inp %>%
46+
filter(.data$Value_LogDiffExp >= 0) %>%
4647
filter(.data$Value_LogDiffExp >= upper) %>%
4748
dplyr::filter(.data$Significane_pvalue <= alpha)
4849

4950
downreg <- inp %>%
51+
filter(.data$Value_LogDiffExp <= 0) %>%
5052
filter(.data$Value_LogDiffExp <= lower) %>%
5153
dplyr::filter(.data$Significane_pvalue <= alpha)
5254

R/do_gsea_pod.R

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ load_pathways <- function(species) {
4545
#' TRUE
4646

4747
do_gsea_pod <- function(bpn, species = "hsapiens", gmtfile = NULL,
48-
lower = NULL, upper = NULL, alpha = 0.05,
49-
minSize = 15, maxSize = 500, rankWithSignificance = FALSE, useFDR=TRUE) {
48+
alpha = 0.05, minSize = 15, maxSize = 500,
49+
rankWithSignificance = FALSE, useFDR=TRUE) {
50+
5051
if(!is.null(gmtfile)) {
5152
pathways <- fgsea::gmtPathways(gmtfile)
5253
} else if(!is.null(species)) {
@@ -57,19 +58,11 @@ do_gsea_pod <- function(bpn, species = "hsapiens", gmtfile = NULL,
5758

5859
inp <- input(bpn)
5960

60-
if (is.null(lower)) {
61-
lower <- round(stats::quantile(inp$Value_LogDiffExp, 0.10), 3)
62-
}
63-
64-
if (is.null(upper)) {
65-
upper <- round(stats::quantile(inp$Value_LogDiffExp, 0.90), 3)
66-
}
67-
6861
upreg <- inp %>%
69-
dplyr::filter(.data$Value_LogDiffExp > upper)
62+
dplyr::filter(.data$Value_LogDiffExp > 0)
7063

7164
downreg <- inp %>%
72-
dplyr::filter(.data$Value_LogDiffExp < lower)
65+
dplyr::filter(.data$Value_LogDiffExp < 0)
7366

7467
ranked <- inp %>%
7568
dplyr::mutate(score = (.data$Value_LogDiffExp * ifelse(rankWithSignificance, -log10(.data$Significane_pvalue), 1))) %>%

0 commit comments

Comments
 (0)