作者: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 and right_annotation arguments.

    热图注释是热图的一个重要组成部分,它展示了与热图中的行或列相关联的附加信息。 ComplexHeatmap 包为设置注释和定义新注释图形提供了非常灵活的支持。注释可以通过顶部注释、底部注释、左注释和右注释参数放在热图的四面。

    The value for the four arguments should be in the HeatmapAnnotation class and should be constructed by HeatmapAnnotation() function, or by rowAnnotation() function if it is a row annotation. (rowAnnotation() is just a helper function which is identical to HeatmapAnnotation(..., which = "row")) A simple usage of heatmap annotations is as follows.

    四个参数的值应该在 HeatmapAnnotation 类中,并且应该由 HeatmapAnnotation() 函数构建,或者如果是行注释,则由 rowAnnotation() 函数构建。 ( rowAnnotation() 只是一个辅助函数,它与 HeatmapAnnotation(..., which = "row") 是完全相同的。下面是一个热图注释的简单用法。

    1. set.seed(123)
    2. mat = matrix(rnorm(100), 10)
    3. rownames(mat) = paste0("R", 1:10)
    4. colnames(mat) = paste0("C", 1:10)
    5. column_ha = HeatmapAnnotation(foo1 = runif(10), bar1 = anno_barplot(runif(10)))
    6. row_ha = rowAnnotation(foo2 = runif(10), bar2 = anno_barplot(runif(10)))
    7. Heatmap(mat, name = "mat", top_annotation = column_ha, right_annotation = row_ha)

    3. 热图注释 - 图1

    Or assign as bottom annotation and left annotation.

    或者指定为底部注释和左注释。

    1. Heatmap(mat, name = "mat", bottom_annotation = column_ha, left_annotation = row_ha)

    3. 热图注释 - 图2

    In above examples, column_ha and row_ha both have two annotations where foo1 and foo2 are numeric vectors and bar1 and bar2 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_harow_ha 都有两个注释,其中 foo1foo2 是数字向量, bar1bar2 是条形图。 类似矢量的注释在这里称为“简单注释”,条形图注释称为“复杂注释”。 您已经可以看到注释必须定义为名称 - 值对(例如 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 章将讨论如何连接热图和注释。