enrichplot源码阅读
最后发布时间:2023-02-21 13:08:48
浏览量:
YuLab-SMU/enrichplot/enrichplot/R/method-fortify.R
ID | Description | GeneRatio | BgRatio | pvalue | p.adjust | qvalue | geneID | Count |
---|---|---|---|---|---|---|---|---|
GO:0005819 | spindle | 26/201 | 313/11865 | 1.748160953695457e-11 | 5.261964470623326e-9 | 4.802842199100151e-9 | CDCA8/CDC20/KIF23/CENPE/ASPM/DLGAP5/SKA1/NUSAP1/TPX2/TACC3/NEK2/CDK1/MAD2L1/KIF18A/BIRC5/KIF11/TRAT1/TTK/AURKB/PRC1/KIFC1/KIF18B/KIF20A/AURKA/CCNB1/KIF4A | 26 |
GO:0000775 | chromosome, centromeric region | 19/201 | 169/11865 | 6.340879428793475e-11 | 6.8326302038778255e-9 | 6.236462609589483e-9 | CDCA8/CENPE/NDC80/TOP2A/HJURP/SKA1/NEK2/CENPM/CENPN/ERCC6L/MAD2L1/KIF18A/CDT1/BIRC5/EZH2/TTK/NCAPG/AURKB/CCNB1 | 19 |
GO:0072686 | mitotic spindle | 17/201 | 131/11865 | 6.80993043575863e-11 | 6.8326302038778255e-9 | 6.236462609589483e-9 | KIF23/CENPE/ASPM/SKA1/NUSAP1/TPX2/TACC3/CDK1/MAD2L1/KIF18A/KIF11/TRAT1/AURKB/PRC1/KIFC1/KIF18B/AURKA | 17 |
GO:0000779 | condensed chromosome, centromeric region | 16/201 | 123/11865 | 2.4398133262121816e-10 | 1.8359595279746667e-8 | 1.675766521424683e-8 | CENPE/NDC80/HJURP/SKA1/NEK2/CENPM/CENPN/ERCC6L/MAD2L1/KIF18A/CDT1/BIRC5/TTK/NCAPG/AURKB/CCNB1 | 16 |
GO:0098687 | chromosomal region | 23/201 | 287/11865 | 5.709915237613229e-10 | 3.437368973043164e-8 | 3.1374481621411644e-8 | CDCA8/CENPE/NDC80/TOP2A/HJURP/SKA1/NEK2/CENPM/RAD51AP1/CENPN/CDK1/ERCC6L/MAD2L1/KIF18A/CDT1/BIRC5/EZH2/TTK/NCAPG/AURKB/CHEK1/CCNB1/MCM5 | 23 |
GO:0000776 | kinetochore | 15/201 | 115/11865 | 8.719736637953852e-10 | 4.3744012133735155e-8 | 3.992721513168343e-8 | CENPE/NDC80/HJURP/SKA1/NEK2/CENPM/CENPN/ERCC6L/MAD2L1/KIF18A/CDT1/BIRC5/TTK/AURKB/CCNB1 | 15 |
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), ]
也是一个泛型函数,
res <- as.data.frame(model)
res <- res[!is.na(res$Description), ]
##' @method as.data.frame gseaResult
##' @export
as.data.frame.enrichResult <- function(x, ...) {
x <- get_enriched(x)
as.data.frame(x@result, ...)
}
res <- res[!is.na(res$Description), ]
##' @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)
}
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
这个属性。
Over <- Over[ Over$pvalue <= pvalueCutoff, ]
Over <- Over[ Over$p.adjust <= pvalueCutoff, ]
这里直接就使用了p.adjust < = pvalueCutoff
的阈值进行过滤,并没有使用pvalue
进行过滤的选项。
更改后的R包
BioinfoFungi/enrichplot2