enrichplot
enrichplot copied to clipboard
dotplot cannot use pvalue to filter
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.
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), ]
......
}