dotplot cannot use pvalue to filter

Open
#230 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
r

Research direction

Start in R/method-fortify.R at fortify.internal and trace how dotplot obtains its data through as.data.frame.enrichResult and DOSE's get_enriched in enricher_internal.R. Compare the requested p-value filtering behavior with the existing pvalueCutoff and qvalueCutoff handling, then verify that the completed change lets dotplot apply the requested p-value filter.

Written by the indexing model from the issue text.

Description

Hi teacher:
I use dotplot to visualize enrichResult objects, but it cannot use pvalue to filter.

I found that in res <- as.data.frame(model) and res <- res[!is.na(res$Description), ] of the source code, It calls a generic function.

as.data.frame.enrichResult
[.enrichResult

as.data.frame.enrichResult <- function(x, ...) {
    x <- get_enriched(x)
    as.data.frame(x@result, ...)
}
`[.enrichResult` <- function(x, i, j, asis = FALSE, ...) {
    x <- get_enriched(x)
    y <- x@result[i, j, ...]
    if (!asis)
        return(y)
    x@result <- y
    return(x)
}

Both of these two generic functions are called get_enriched.

x <- get_enriched(x)

get_enriched <- function(object) {
    Over <- object@result
    pvalueCutoff <- object@pvalueCutoff
    if (length(pvalueCutoff) != 0) {
        ## if groupGO result, numeric(0)
        Over <- Over[ Over$pvalue <= pvalueCutoff, ]
        Over <- Over[ Over$p.adjust <= pvalueCutoff, ]
    }
    qvalueCutoff <- object@qvalueCutoff
    if (length(qvalueCutoff) != 0) {
        if (! any(is.na(Over$qvalue))) {
            if (length(qvalueCutoff) > 0)
                Over <- Over[ Over$qvalue <= qvalueCutoff, ]
        }
    }
    object@result <- Over
    return(object)
}

However, there is no option to filter pvalue in function get_enriched. Can I add this filter parameter?

fortify.internal <- function(model, data, showCategory=5, by = "Count",
                             order=FALSE, drop=FALSE, split=NULL,colorBy="p.adjust", ...) {
    # res <- as.data.frame(model)
    res <- get_enriched(model,colorBy)
    # res <- res[!is.na(res$Description), ]
   ......
}

Dominant language
R
Stars
260
Forks
75
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from YuLab-SMU/enrichplot

All issues in YuLab-SMU/enrichplot

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.