Skip to content

Commit

Permalink
top gene position fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
junjunlab committed Feb 21, 2023
1 parent 78830dd commit a24a11b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions R/gseaNb.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

globalVariables(c(".", "ID", "aes_", "gene_name","gseaRes",
"position","x","y","value","variable","logfc","nudge_y","vjust",
"pLabel","px","py"))
"pLabel","px","py","id"))

# define function
gseaNb <- function(object = NULL,
Expand Down Expand Up @@ -375,8 +375,17 @@ gseaNb <- function(object = NULL,
geneLabel <- purrr::map_df(unique(gsdata1$Description),function(dc){
topg <- gsdata1 %>%
dplyr::filter(Description == dc) %>%
dplyr::arrange(x) %>%
dplyr::slice_head(n = topGeneN)
dplyr::arrange(x)

# check NES score
nes <- data_ga %>% dplyr::filter(Description == dc)

if(nes$NES > 0){
topg <- topg %>% dplyr::slice_head(n = topGeneN)
}else{
topg <- topg %>% dplyr::slice_tail(n = topGeneN)
}

})
}else{
# add gene name
Expand Down

0 comments on commit a24a11b

Please # to comment.