Skip to content

Commit f7f0fed

Browse files
committed
quick fix for heatmap top annotation (not 100% done)
1 parent 0f6627f commit f7f0fed

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

R/Heatmap.R

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Heatmap_with_groups <- function(D,
8686
log_base = 2,
8787
colour_scale_max = NULL,
8888
textsize = 15,
89+
top_annotation = NULL,
8990
...) {
9091

9192
data.asmatrix <- as.matrix(D)
@@ -155,16 +156,19 @@ Heatmap_with_groups <- function(D,
155156
row_labels <- rep("", nrow(data.asmatrix))
156157
}
157158

158-
### top annotation for groups
159-
if (!is.null(groups)) {
160-
top_annotation = ComplexHeatmap::HeatmapAnnotation(Group = groups,
161-
col = group_colours,
162-
annotation_name_gp = grid::gpar(fontsize = textsize), name = "Group",
163-
annotation_legend_param = list(title_gp = grid::gpar(fontsize = textsize,
164-
fontface = "bold"),
165-
labels_gp = grid::gpar(fontsize = textsize)))
166-
} else {
167-
top_annotation = NULL
159+
160+
if (is.null(top_annotation)) {
161+
### top annotation for groups
162+
if (!is.null(groups)) {
163+
top_annotation = ComplexHeatmap::HeatmapAnnotation(Group = groups,
164+
col = group_colours,
165+
annotation_name_gp = grid::gpar(fontsize = textsize), name = "Group",
166+
annotation_legend_param = list(title_gp = grid::gpar(fontsize = textsize,
167+
fontface = "bold"),
168+
labels_gp = grid::gpar(fontsize = textsize)))
169+
} else {
170+
top_annotation = NULL
171+
}
168172
}
169173

170174
### set column split

0 commit comments

Comments
 (0)