YuLab-SMU/enrichplot/enrichplot/R/method-fortify.R
dotplot函数中使用as.data.frame(res <- as.data.frame(model))的泛型函数将enrichResult对象转换为data.frame对象,这其中就使用了enrichGO(pvalueCutoff = 0.01) 函数中pvalueCutoff参数设置的阈值对p.agjust进行筛选。res <- res[!is.na(res$Description), ]也是一个泛型函数,
dotplot
as.data.frame
enrichResult
data.frame
enrichGO(pvalueCutoff = 0.01)
pvalueCutoff
p.agjust
res <- res[!is.na(res$Description), ]
点击查看S3对象的泛型和多态
fortify.internal
res <- as.data.frame(model) res <- res[!is.na(res$Description), ]
res <- as.data.frame(model)
##' @method as.data.frame gseaResult ##' @export as.data.frame.enrichResult <- function(x, ...) { x <- get_enriched(x) as.data.frame(x@result, ...) }
##' @method [ enrichResult ##' @export `[.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) }
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) }
可以看到pvalueCutoff <- object@pvalueCutoff这行代码是获取了enrichResult对象的pvalueCutoff这个属性。
pvalueCutoff <- object@pvalueCutoff
Over <- Over[ Over$pvalue <= pvalueCutoff, ] Over <- Over[ Over$p.adjust <= pvalueCutoff, ]
这里直接就使用了p.adjust < = pvalueCutoff的阈值进行过滤,并没有使用pvalue进行过滤的选项。
p.adjust < = pvalueCutoff
pvalue
更改后的R包BioinfoFungi/enrichplot2