作者:Zuguang Gu8
编译:Steven Shen
原文:Subset the heatmap list
Similar as subsetting the
Heatmap
object (Section 2.13), the heatmap list can also be subsetted by providing row index and column index. For horizontal heatmap list, row index correspond to rows in all heatmaps and annotations, while column index only corresponds to a subset of heatmaps and annotations. For vertical heatmap list, it’s the other way around.In following we use horizontal heatmap list as example.
ht1 = Heatmap(mat1, name = "rnorm", col = col_rnorm,
left_annotation = rowAnnotation(foo1 = 1:12, bar1 = anno_points(1:12)))
ht2 = Heatmap(mat2, name = "runif", col = col_runif)
ha = rowAnnotation(foo2 = anno_barplot(1:12), bar2 = 12:1)
ht_list = ht1 + ht2 + ha
names(ht_list)
## [1] "rnorm" "runif" "foo2" "bar2"
ht_list[1:6, c("rnorm", "bar2")]
foo1
andbar
are components of heatmaprnorm
, so they can not be selected in the subset function, whilefoo2
andbar2
are independent row annotations and they can selected to take subset of them.