r - 使用 ComplexHeatmap 包创建行注释时,R 找不到函数 anno_simple()
问题描述
我正在尝试创建一个包含 p 值的行注释的热图,如使用 ComplexHeatmap 包指南中的示例中所述(https://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap- annotations.html#simple-annotation)。
我试图重现这个例子:
library(ComplexHeatmap)
library(circlize) # colorRamp2 function
set.seed(123)
pvalue = 10^-runif(10, min = 0, max = 3)
is_sig = pvalue < 0.01
pch = rep("*", 10)
pch[!is_sig] = NA
# color mapping for -log10(pvalue)
pvalue_col_fun = colorRamp2(c(0, 2, 3), c("green", "white", "red"))
ha = HeatmapAnnotation(
pvalue = anno_simple(-log10(pvalue), col = pvalue_col_fun, pch = pch),
annotation_name_side = "left")
ht = Heatmap(matrix(rnorm(100), 10), name = "mat", top_annotation = ha)
# now we generate two legends, one for the p-value
# see how we define the legend for pvalue
lgd_pvalue = Legend(title = "p-value", col = pvalue_col_fun, at = c(0, 1, 2, 3),
labels = c("1", "0.1", "0.01", "0.001"))
# and one for the significant p-values
lgd_sig = Legend(pch = "*", type = "points", labels = "< 0.01")
# these two self-defined legends are added to the plot by `annotation_legend_list`
draw(ht, annotation_legend_list = list(lgd_pvalue, lgd_sig))
但是当我创建注释时,ha
我得到了错误
Error in anno_simple(-log10(pvalue), col = pvalue_col_fun, pch = pch) :
could not find function "anno_simple"
可能显示包装可能存在问题。我正在运行的 ComplexHeatmap 包的版本是 1.20.0。R 版本是 3.5.1。
你能帮我解决这个问题吗?
谢谢
解决方案
推荐阅读
- python - SQLAlchemy 属性错误:“元组”对象没有属性“键”
- c# - Xamarin 可绑定属性永远不会被设置
- excel - Excel VBA 类型不匹配 13 使用 ActiveWorkbook.Close
- ios - Firebase pod 'InAppMessagingDisplay'
- python - 使用scrapy shell时出现Twisted ResponseFailed错误
- python - 使用机器学习算法进行食谱标签分类
- treeview - Blue Prism - SAP TreeView 集成
- java - 以子类为参数重载方法,但将方法称为超类
- vba - VBA Microsoft Word - 序号
- angularjs - AngularJS 和 Razor Kendo 事件