Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plot_KOs_network函数 #13

Open
luca780 opened this issue Jan 19, 2025 · 13 comments
Open

plot_KOs_network函数 #13

luca780 opened this issue Jan 19, 2025 · 13 comments

Comments

@luca780
Copy link

luca780 commented Jan 19, 2025

作者你好,
非常感谢能够提供如此简便快捷的R包,目前更新后,在使用plot_KOs_network函数绘制多个通路的网络图时遇到问题,请问您有发现这个是什么问题吗?我尝试跑单个通路也是会报这个错误,谢谢。

p7 <- plot_KOs_network(reporter_res,

  • map_id = c("map01120","map01200","map03070"),
  • main = "", mark_module = TRUE
  • )

No 'from' and 'to' in the colnames(edgelist), use the first two columns as the 'from' and 'to'.
Error in igraph::as_data_frame():
! arg must be one of "edges", "vertices", or "both", not "v".
ℹ Did you mean "vertices"?
Backtrace:

  1. ReporterScore::plot_KOs_network(...)
  2. MetaNet::twocol_edgelist(id2ko)
  3. MetaNet::c_net_from_edgelist(edgelist, vertex_df = nodelist)
  4. MetaNet::c_net_update(go, initialize = TRUE)
  5. MetaNet::get_v(go)
  6. igraph::as_data_frame(x = go, what = "v")
@Asa12138
Copy link
Owner

你好,这应该是MetaNet版本适配问题,
请更新依赖包MetaNet:

# install.packages("devtools")
devtools::install_github("Asa12138/MetaNet")

@luca780
Copy link
Author

luca780 commented Jan 19, 2025

更新完,然后重新library(MetaNet),
还是会遇到:No 'from' and 'to' in the colnames(edgelist), use the first two columns as the 'from' and 'to'.这个问题

@Asa12138
Copy link
Owner

不是报错吧,只是普通的提醒?能画出来吗

@luca780
Copy link
Author

luca780 commented Jan 19, 2025

#关注的通路map的网络图(暂未跑通)
p7 <- plot_KOs_network(reporter_res,

  • map_id = "map00052",
  • main = "", mark_module = TRUE
  • )
    No 'from' and 'to' in the colnames(edgelist), use the first two columns as the 'from' and 'to'.

p7
NULL
好像跑不出图

@Asa12138
Copy link
Owner

plot_KOs_network使用的是igraph而不是ggplot2绘图,所以无法把网络图保存为p7,而是在运行的时候图片直接出现(类似于base绘图)。

如果你想要ggplot绘图的话可以尝试以下代码,但可能不是很好看:

plot_features_network(reporter_score_res, map_id = "map00780", mark_module = T,return_net = T)->p
plot(as.ggig(p),labels_num = "all")

@luca780
Copy link
Author

luca780 commented Jan 20, 2025

好的谢谢,可以跑出来了。还想请问下您,我的每个通路包含的KO都很多绘图出来密密麻麻,感觉您绘制的图都比较美观,请问您有处理过KO数量吗,还是这就是数据本身问题?

@luca780
Copy link
Author

luca780 commented Jan 20, 2025

还想跟您请教一下,为什么RC值为负的这些map通路,他们的显著up的KO还是多于显著down的通路?是否应该是RC为负的通路对应的KO下调的更多才正常?

@Asa12138
Copy link
Owner

好的谢谢,可以跑出来了。还想请问下您,我的每个通路包含的KO都很多绘图出来密密麻麻,感觉您绘制的图都比较美观,请问您有处理过KO数量吗,还是这就是数据本身问题?

应该是数据本身问题了,有些通路的KO数量太多了

@Asa12138
Copy link
Owner

还想跟您请教一下,为什么RC值为负的这些map通路,他们的显著up的KO还是多于显著down的通路?是否应该是RC为负的通路对应的KO下调的更多才正常?

1.整条通路的RS正或负结果跟通路内KO上下调数量相关,但不是绝对的数量多少的关系,比如一个通路10个KO,7个上调,但是p值只有0.05,但是3个下调的p值都是很小<0.00001,那这三个下调的权重可能更大,最后整条通路为负。
2.另一个要考虑的是背景因素,比如你输入的KO,1000个有900个都在上调,那某个通路7个上调3个下调最后可能整个通路还是下调,因为矫正背景。

@luca780
Copy link
Author

luca780 commented Jan 20, 2025

明白了谢谢,请问绘制网络图和单独一个通路KO基因的折线图,能否修改参数仅输出significant的?目前代码来看是exis的全部绘制出来了。

@Asa12138
Copy link
Owner

需要手动筛选:
1.网络图:

plot_features_network(reporter_score_res, map_id = "map00780", mark_module = T,return_net = T)->p
plot(MetaNet::c_net_filter(p,v_class!="None"))

2.折线图:

plot_features_in_pathway(ko_stat = reporter_score_res, map_id = "map00860")->p
p$layers[[3]]$data=dplyr::filter(p$layers[[3]]$data,!grepl("None",Significantly))
p

@luca780
Copy link
Author

luca780 commented Jan 20, 2025

尝试了下基于RC包的代码修改网络图,会缺失分组的颜色,请问应该如何修改呢,您修改的这个代码应该去哪里学习,以进行定制想要的可视化结果呢,谢谢!
p7 <- plot_KOs_network(reporter_res,
map_id = "map00620",
main = "", mark_module = TRUE, return_net = TRUE)

plot(MetaNet::c_net_filter(p7, v_class != "None"))

Asa12138 added a commit that referenced this issue Jan 21, 2025
@Asa12138
Copy link
Owner

devtools::install_github("Asa12138/ReporterScore")
plot_features_network(reporter_score_res, map_id = "map00780", mark_module = T,return_net = T)->p
plot(MetaNet::c_net_filter(p,v_class!="None"),mark_module = T)

可以去https://github.com/Asa12138/MetaNet学习下网络图定制

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants