enrichplot icon indicating copy to clipboard operation
enrichplot copied to clipboard

Add parameters `hilight_category`, `alpha_hilight`, and `alpha_nohilight` for `cnetplot()` and `emapplot`

Open huerqiang opened this issue 2 years ago • 4 comments

老师,这次提交是给cnetplot()emapplot() 添加高亮显示功能。新增的三个参数功能如下: hilight_category:需要高亮显示的category 节点。在cnetplot中,高亮显示的是所选中的节点以及相连的基因和它们的边。 在emapplot中,高亮显示的是所选中的节点以及相连的边。 alpha_hilight:用来调整高亮显示的alpha alpha_nohilight:用来调整非高亮显示的alpha 跑出的示例如下: test_hilight.pdf

huerqiang avatar Sep 04 '22 06:09 huerqiang

请问博主,我想使用cneplot函数基于pvalue或qvalue,而不是按照默认的p.adjust数据来绘制图片,该如何设置参数呢?查看了包的帮助文档,以及cnetplot函数的原代码,都没能找到修改代码的思路。谢谢。

jijitoutou avatar Sep 04 '22 06:09 jijitoutou

老师,我新的提交对cnetplot()emapplot()treeplot() 这几个参数较多的函数进行了参数调整,功能相关的参数归类到了同个list中。 目前的代码中有很多类似这样的:

    if (!missing(x_loc)) {
        warn <- get_param_change_message("x_loc", params_df)
        warning(warn)
        pie.params[[params_df["x_loc", "present"]]] <- x_loc
    }  
    x_loc <- pie.params[["legend_loc_x"]]

由于涉及到两层函数(cnetplot第一层,cnetplot.enrichResult第二层)以及需要赋值,我暂时未能找到合适的方法把这些语句写成循环或者函数,因此就先对每一个修改的参数都copy paster一遍。

huerqiang avatar Sep 11 '22 15:09 huerqiang

不知道你啥意思,但我想modifyList是你所需要的。

参考:https://github.com/YuLab-SMU/enrichplot/blob/master/R/gseaplot.R#L365-L370.

GuangchuangYu avatar Sep 14 '22 08:09 GuangchuangYu

老师, 我新的提交将那些大量的copy paste的代码换成了循环:

    args <- as.list(match.call())
    removed_params <- intersect(params_df$original, names(args))
    if (length(removed_params) > 0) {
        for (i in removed_params) {
            params_list[[params_df[i, 2]]][[params_df[i, 3]]] <- get(i)
            warn <- get_param_change_message(i, params_df)
            warning(warn)
        }
    }

新参数的使用以及warning信息的例子如下

> data(geneList)
> library(enrichplot)
> de <- names(geneList)[1:100]
> x <- enrichDO(de)
> x2 <- pairwise_termsim(x)
> emapplot(x2, cex_category = 2, with_edge = FALSE)
Warning messages:
1: In emapplot.enrichResult(x, showCategory = showCategory, ...) :
  Use 'edge.params = list(show = your_value)' instead of 'with_edge'.
 The with_edge parameter will be removed in the next version.
2: In emapplot.enrichResult(x, showCategory = showCategory, ...) :
  Use 'cex.params = list(category_node = your_value)' instead of 'cex_category'.
 The cex_category parameter will be removed in the next version.

> emapplot(x2, cex.params = list(category_node = 2), 
+          edge.params = list(show = FALSE))

huerqiang avatar Sep 18 '22 07:09 huerqiang

这个没下文?

GuangchuangYu avatar Oct 22 '22 17:10 GuangchuangYu

老师,这个PR是增加了hilight的功能,以及修改了参数名。是还需要做别的修改吗?

huerqiang avatar Oct 23 '22 15:10 huerqiang