作者:Zuguang Gu8
翻译:Steven Shen
原文:https://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap-annotations.html
Heatmap annotations are important components of a heatmap that it shows additional information that associates with rows or columns in the heatmap. ComplexHeatmap package provides very flexible supports for setting annotations and defining new annotation graphics. The annotations can be put on the four sides of the heatmap,by
top_annotation
,bottom_annotation
,left_annotation
andright_annotation
arguments.
热图注释是热图的一个重要组成部分,它展示了与热图中的行或列相关联的附加信息。 ComplexHeatmap 包为设置注释和定义新注释图形提供了非常灵活的支持。注释可以通过顶部注释、底部注释、左注释和右注释参数放在热图的四面。
The value for the four arguments should be in the
HeatmapAnnotation
class and should be constructed byHeatmapAnnotation()
function, or byrowAnnotation()
function if it is a row annotation. (rowAnnotation()
is just a helper function which is identical toHeatmapAnnotation(..., which = "row")
) A simple usage of heatmap annotations is as follows.
四个参数的值应该在 HeatmapAnnotation 类中,并且应该由 HeatmapAnnotation()
函数构建,或者如果是行注释,则由 rowAnnotation()
函数构建。 ( rowAnnotation()
只是一个辅助函数,它与 HeatmapAnnotation(..., which = "row")
是完全相同的。下面是一个热图注释的简单用法。
set.seed(123)
mat = matrix(rnorm(100), 10)
rownames(mat) = paste0("R", 1:10)
colnames(mat) = paste0("C", 1:10)
column_ha = HeatmapAnnotation(foo1 = runif(10), bar1 = anno_barplot(runif(10)))
row_ha = rowAnnotation(foo2 = runif(10), bar2 = anno_barplot(runif(10)))
Heatmap(mat, name = "mat", top_annotation = column_ha, right_annotation = row_ha)
Or assign as bottom annotation and left annotation.
或者指定为底部注释和左注释。
Heatmap(mat, name = "mat", bottom_annotation = column_ha, left_annotation = row_ha)
In above examples,
column_ha
androw_ha
both have two annotations wherefoo1
andfoo2
are numeric vectors andbar1
andbar2
are barplots. The vector-like annotation is called “simple annotation” here and the barplot annotation is called “complex annotation”. You can already see the annotations must be defined as name-value pairs (e.g.foo = ...
).
在上面的示例中, column_ha
和 row_ha
都有两个注释,其中 foo1
和 foo2
是数字向量, bar1
和 bar2
是条形图。 类似矢量的注释在这里称为“简单注释”,条形图注释称为“复杂注释”。 您已经可以看到注释必须定义为名称 - 值对(例如 foo = ...
)。
Heatmap annotations can also be independent of the heatmaps. They can be concatenated to the heatmap list by
+
if it is horizontal or%v%
if it is vertical. Chapter 4 will discuss how to concatenate heatmaps and annotations.
热图注释也可以独立于热图。它们可以通过 +
(如果它是水平的)或 %v%
(如果它是垂直的)连接到热图列表。第 4 章将讨论如何连接热图和注释。