Skip to content

Commit

Permalink
fix the bug of plot function
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuiqin Fan committed Jul 26, 2022
1 parent 8b2d4a4 commit c42f07f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: irGSEA
Type: Package
Title: The integration of single cell rank-based gene set enrichment analysis
Version: 1.1.2
Version: 1.1.3
Author: Chuiqin Fan
Author@R: person("Chuiqin", "Fan", role = c('aut', 'cre'), email = '[email protected]')
Maintainer: Chuiqin Fan <[email protected]>
Expand Down
16 changes: 9 additions & 7 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ irGSEA.bubble <- function(object = NULL, method = "RRA",
stop("`method` should be one of the followling : AUCell, UCell, singscore, ssgsea, RRA.")
}
if (method %in% c("AUCell", "UCell", "singscore", "ssgsea")) {
object[1:4] <- object[1:4] %>% purrr::map( ~.x %>% dplyr::rename(pvalue = p_val_adj))
object[method] <- object[method] %>% purrr::map( ~.x %>% dplyr::rename(pvalue = p_val_adj))
}

# matrix
Expand Down Expand Up @@ -272,7 +272,7 @@ irGSEA.heatmap <- function(object = NULL, method = "RRA",
stop("`method` should be one of the followling : AUCell, UCell, singscore, ssgsea, RRA.")
}
if (method %in% c("AUCell", "UCell", "singscore", "ssgsea")) {
object[1:4] <- object[1:4] %>% purrr::map( ~.x %>% dplyr::rename(pvalue = p_val_adj))
object[method] <- object[method] %>% purrr::map( ~.x %>% dplyr::rename(pvalue = p_val_adj))
}
# matrix
cluster <- NULL
Expand Down Expand Up @@ -499,7 +499,7 @@ irGSEA.upset <- function(object = NULL, method = "RRA",
}
pvalue <- NULL
if (method %in% c("AUCell", "UCell", "singscore", "ssgsea")) {
object[1:4] <- object[1:4] %>% purrr::map( ~.x %>% dplyr::rename(pvalue = p_val_adj))
object[method] <- object[method] %>% purrr::map( ~.x %>% dplyr::rename(pvalue = p_val_adj))
}
# matrix
cluster <- NULL
Expand Down Expand Up @@ -665,20 +665,22 @@ irGSEA.barplot <- function(object = NULL, method = NULL,
proportion <- NULL
anno.cluster <- NULL
anno.method <- NULL
object[1:4] <- object[1:4] %>% purrr::map( ~.x %>% dplyr::rename(pvalue = p_val_adj))

if (purrr::is_null(method)){ method <- names(object) }
object[method] <- object[method] %>% purrr::map( ~.x %>% dplyr::rename(pvalue = p_val_adj))

# matrix
sig.genesets.barplot <- list()
for (i in seq_along(names(object))) {
sig.genesets.barplot[[i]] <- object[[names(object)[i]]] %>%
for (i in seq_along(names(object[method]))) {
sig.genesets.barplot[[i]] <- object[method][[names(object[method])[i]]] %>%
dplyr::mutate(cell = stringr::str_c(cluster, direction, sep = "_")) %>%
dplyr::select(c("Name", "pvalue", "cell")) %>%
dplyr::mutate(pvalue = dplyr::if_else(pvalue < 0.05, "significant","no significant")) %>%
tidyr::spread(cell, pvalue, fill = "no significant") %>%
tidyr::gather(cell, pvalue, -Name) %>%
dplyr::mutate(direction = stringr::str_extract(cell, pattern = "up|down"),
cluster = stringr::str_remove(cell, pattern = "_up|_down"),
method = names(object)[i]) %>%
method = names(object[method])[i]) %>%
dplyr::mutate(geneset = dplyr::if_else(pvalue == "no significant", "no significant", direction))
}

Expand Down
Binary file modified man/figures/README-unnamed-chunk-10-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c42f07f

Please sign in to comment.