diff --git a/DESCRIPTION b/DESCRIPTION index 5c09ea4..72982d3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: ComplexHeatmap Type: Package Title: Make Complex Heatmaps -Version: 2.15.1 -Date: 2022-11-24 +Version: 2.15.2 +Date: 2023-03-22 Authors@R: person("Zuguang", "Gu", email = "z.gu@dkfz.de", role = c("aut", "cre"), comment = c('ORCID'="0000-0002-7395-8709")) Depends: R (>= 3.5.0), methods, grid, graphics, stats, grDevices @@ -13,7 +13,7 @@ Suggests: testthat (>= 1.0.0), knitr, markdown, dendsort, jpeg, tiff, fastcluster, EnrichedHeatmap, dendextend (>= 1.0.1), grImport, grImport2, glue, GenomicRanges, gridtext, pheatmap (>= 1.0.12), - gridGraphics, gplots, rmarkdown, Cairo + gridGraphics, gplots, rmarkdown, Cairo, magick VignetteBuilder: knitr Description: Complex heatmaps are efficient to visualize associations between different sources of data sets and reveal potential patterns. diff --git a/R/00_S4_generic_methods.R b/R/00_S4_generic_methods.R index dcba8c7..80a5ea8 100755 --- a/R/00_S4_generic_methods.R +++ b/R/00_S4_generic_methods.R @@ -1,32 +1,32 @@ -setGeneric('make_column_cluster', function(object, ...) standardGeneric('make_column_cluster')) -setGeneric('get_legend_param_list', function(object, ...) standardGeneric('get_legend_param_list')) +setGeneric('set_component_width', function(object, ...) standardGeneric('set_component_width')) +setGeneric('row_dend', function(object, ...) standardGeneric('row_dend')) +setGeneric('column_dend', function(object, ...) standardGeneric('column_dend')) +setGeneric('re_size', function(object, ...) standardGeneric('re_size')) +setGeneric('draw_heatmap_body', function(object, ...) standardGeneric('draw_heatmap_body')) +setGeneric('add_heatmap', function(object, ...) standardGeneric('add_heatmap')) +setGeneric('draw', function(object, ...) standardGeneric('draw')) setGeneric('adjust_heatmap_list', function(object, ...) standardGeneric('adjust_heatmap_list')) -setGeneric('annotation_legend_size', function(object, ...) standardGeneric('annotation_legend_size')) -setGeneric('prepare', function(object, ...) standardGeneric('prepare')) -setGeneric('draw_dend', function(object, ...) standardGeneric('draw_dend')) -setGeneric('draw_heatmap_list', function(object, ...) standardGeneric('draw_heatmap_list')) -setGeneric('color_mapping_legend', function(object, ...) standardGeneric('color_mapping_legend')) setGeneric('component_height', function(object, ...) standardGeneric('component_height')) -setGeneric('draw_heatmap_body', function(object, ...) standardGeneric('draw_heatmap_body')) -setGeneric('copy_all', function(object, ...) standardGeneric('copy_all')) -setGeneric('set_component_width', function(object, ...) standardGeneric('set_component_width')) +setGeneric('make_row_cluster', function(object, ...) standardGeneric('make_row_cluster')) setGeneric('set_component_height', function(object, ...) standardGeneric('set_component_height')) -setGeneric('draw_dimnames', function(object, ...) standardGeneric('draw_dimnames')) +setGeneric('make_layout', function(object, ...) standardGeneric('make_layout')) +setGeneric('attach_annotation', function(object, ...) standardGeneric('attach_annotation')) +setGeneric('copy_all', function(object, ...) standardGeneric('copy_all')) +setGeneric('draw_heatmap_legend', function(object, ...) standardGeneric('draw_heatmap_legend')) +setGeneric('draw_dend', function(object, ...) standardGeneric('draw_dend')) setGeneric('draw_annotation', function(object, ...) standardGeneric('draw_annotation')) -setGeneric('column_order', function(object, ...) standardGeneric('column_order')) setGeneric('draw_title', function(object, ...) standardGeneric('draw_title')) -setGeneric('attach_annotation', function(object, ...) standardGeneric('attach_annotation')) -setGeneric('make_row_cluster', function(object, ...) standardGeneric('make_row_cluster')) -setGeneric('row_order', function(object, ...) standardGeneric('row_order')) -setGeneric('get_color_mapping_list', function(object, ...) standardGeneric('get_color_mapping_list')) -setGeneric('draw_annotation_legend', function(object, ...) standardGeneric('draw_annotation_legend')) -setGeneric('add_heatmap', function(object, ...) standardGeneric('add_heatmap')) -setGeneric('re_size', function(object, ...) standardGeneric('re_size')) -setGeneric('make_layout', function(object, ...) standardGeneric('make_layout')) -setGeneric('component_width', function(object, ...) standardGeneric('component_width')) -setGeneric('column_dend', function(object, ...) standardGeneric('column_dend')) -setGeneric('row_dend', function(object, ...) standardGeneric('row_dend')) -setGeneric('draw', function(object, ...) standardGeneric('draw')) +setGeneric('prepare', function(object, ...) standardGeneric('prepare')) +setGeneric('color_mapping_legend', function(object, ...) standardGeneric('color_mapping_legend')) +setGeneric('draw_heatmap_list', function(object, ...) standardGeneric('draw_heatmap_list')) setGeneric('map_to_colors', function(object, ...) standardGeneric('map_to_colors')) +setGeneric('column_order', function(object, ...) standardGeneric('column_order')) +setGeneric('draw_annotation_legend', function(object, ...) standardGeneric('draw_annotation_legend')) +setGeneric('get_legend_param_list', function(object, ...) standardGeneric('get_legend_param_list')) +setGeneric('get_color_mapping_list', function(object, ...) standardGeneric('get_color_mapping_list')) +setGeneric('draw_dimnames', function(object, ...) standardGeneric('draw_dimnames')) +setGeneric('annotation_legend_size', function(object, ...) standardGeneric('annotation_legend_size')) +setGeneric('make_column_cluster', function(object, ...) standardGeneric('make_column_cluster')) +setGeneric('row_order', function(object, ...) standardGeneric('row_order')) setGeneric('heatmap_legend_size', function(object, ...) standardGeneric('heatmap_legend_size')) -setGeneric('draw_heatmap_legend', function(object, ...) standardGeneric('draw_heatmap_legend')) +setGeneric('component_width', function(object, ...) standardGeneric('component_width')) diff --git a/R/HeatmapList-class.R b/R/HeatmapList-class.R index e3bf7fd..79ba6f9 100755 --- a/R/HeatmapList-class.R +++ b/R/HeatmapList-class.R @@ -325,7 +325,7 @@ setMethod(f = "draw", column_title_gp = gpar(fontsize = 13), heatmap_legend_side = c("right", "left", "bottom", "top"), - merge_legends = FALSE, + merge_legends = ht_opt$merge_legends, show_heatmap_legend = TRUE, heatmap_legend_list = list(), annotation_legend_side = c("right", "left", "bottom", "top"), diff --git a/R/global.R b/R/global.R index 5de7cce..48ffcf7 100755 --- a/R/global.R +++ b/R/global.R @@ -34,6 +34,7 @@ # -legend_gap Gap between legends. The value should be a vector of two units. One for gaps between # vertical legends and one for the horizontal legends. If only one single unit is specified, # the same gap set for the vertical and horizontal legends. +# -merge_legend wether merge heatmap and annotation legends. # # Following parameters control heatmap annotations: # @@ -117,6 +118,7 @@ ht_opt = setGlobalOptions( } } ), + merge_legends = FALSE, heatmap_border = list( .value = NULL), diff --git a/man/column_dend-dispatch.Rd b/man/column_dend-dispatch.Rd index e9483da..dd35e81 100644 --- a/man/column_dend-dispatch.Rd +++ b/man/column_dend-dispatch.Rd @@ -10,8 +10,8 @@ Method dispatch page for \code{column_dend}. \code{column_dend} can be dispatched on following classes: \itemize{ -\item \code{\link{column_dend,Heatmap-method}}, \code{\link{Heatmap-class}} class method \item \code{\link{column_dend,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method +\item \code{\link{column_dend,Heatmap-method}}, \code{\link{Heatmap-class}} class method } } \examples{ diff --git a/man/column_order-dispatch.Rd b/man/column_order-dispatch.Rd index 4883c16..ec7d9c3 100644 --- a/man/column_order-dispatch.Rd +++ b/man/column_order-dispatch.Rd @@ -10,8 +10,8 @@ Method dispatch page for \code{column_order}. \code{column_order} can be dispatched on following classes: \itemize{ -\item \code{\link{column_order,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method \item \code{\link{column_order,Heatmap-method}}, \code{\link{Heatmap-class}} class method +\item \code{\link{column_order,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method } } \examples{ diff --git a/man/component_height-dispatch.Rd b/man/component_height-dispatch.Rd index a708204..f1af083 100644 --- a/man/component_height-dispatch.Rd +++ b/man/component_height-dispatch.Rd @@ -10,8 +10,8 @@ Method dispatch page for \code{component_height}. \code{component_height} can be dispatched on following classes: \itemize{ -\item \code{\link{component_height,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method \item \code{\link{component_height,Heatmap-method}}, \code{\link{Heatmap-class}} class method +\item \code{\link{component_height,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method } } \examples{ diff --git a/man/copy_all-dispatch.Rd b/man/copy_all-dispatch.Rd index 94957ef..db03763 100644 --- a/man/copy_all-dispatch.Rd +++ b/man/copy_all-dispatch.Rd @@ -10,8 +10,8 @@ Method dispatch page for \code{copy_all}. \code{copy_all} can be dispatched on following classes: \itemize{ -\item \code{\link{copy_all,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method \item \code{\link{copy_all,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method +\item \code{\link{copy_all,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method } } \examples{ diff --git a/man/draw-HeatmapList-method.Rd b/man/draw-HeatmapList-method.Rd index 13d2e45..77ce130 100644 --- a/man/draw-HeatmapList-method.Rd +++ b/man/draw-HeatmapList-method.Rd @@ -19,7 +19,7 @@ Draw a list of heatmaps column_title_gp = gpar(fontsize = 13), heatmap_legend_side = c("right", "left", "bottom", "top"), - merge_legends = FALSE, + merge_legends = ht_opt$merge_legends, show_heatmap_legend = TRUE, heatmap_legend_list = list(), annotation_legend_side = c("right", "left", "bottom", "top"), diff --git a/man/draw-dispatch.Rd b/man/draw-dispatch.Rd index 37b672a..d863bdd 100644 --- a/man/draw-dispatch.Rd +++ b/man/draw-dispatch.Rd @@ -10,12 +10,12 @@ Method dispatch page for \code{draw}. \code{draw} can be dispatched on following classes: \itemize{ -\item \code{\link{draw,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method -\item \code{\link{draw,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method -\item \code{\link{draw,Heatmap-method}}, \code{\link{Heatmap-class}} class method +\item \code{\link{draw,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method \item \code{\link{draw,Legends-method}}, \code{\link{Legends-class}} class method +\item \code{\link{draw,Heatmap-method}}, \code{\link{Heatmap-class}} class method +\item \code{\link{draw,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method +\item \code{\link{draw,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method \item \code{\link{draw,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method -\item \code{\link{draw,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method } } \examples{ diff --git a/man/ht_opt.Rd b/man/ht_opt.Rd index 8056c9f..ee5c278 100644 --- a/man/ht_opt.Rd +++ b/man/ht_opt.Rd @@ -43,6 +43,7 @@ Following parameters control the legends: \item{legend_grid_height}{set \code{grid_height} in all heatmap legends and annotation legends.} \item{legend_border}{set \code{border} in all heatmap legends and annotation legends.} \item{legend_gap}{Gap between legends. The value should be a vector of two units. One for gaps between vertical legends and one for the horizontal legends. If only one single unit is specified, the same gap set for the vertical and horizontal legends.} + \item{merge_legend}{wether merge heatmap and annotation legends.} } Following parameters control heatmap annotations: diff --git a/man/row_dend-dispatch.Rd b/man/row_dend-dispatch.Rd index e609ed7..e95015e 100644 --- a/man/row_dend-dispatch.Rd +++ b/man/row_dend-dispatch.Rd @@ -10,8 +10,8 @@ Method dispatch page for \code{row_dend}. \code{row_dend} can be dispatched on following classes: \itemize{ -\item \code{\link{row_dend,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method \item \code{\link{row_dend,Heatmap-method}}, \code{\link{Heatmap-class}} class method +\item \code{\link{row_dend,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method } } \examples{ diff --git a/man/row_order-dispatch.Rd b/man/row_order-dispatch.Rd index 40b19bb..c0f1605 100644 --- a/man/row_order-dispatch.Rd +++ b/man/row_order-dispatch.Rd @@ -10,8 +10,8 @@ Method dispatch page for \code{row_order}. \code{row_order} can be dispatched on following classes: \itemize{ -\item \code{\link{row_order,Heatmap-method}}, \code{\link{Heatmap-class}} class method \item \code{\link{row_order,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method +\item \code{\link{row_order,Heatmap-method}}, \code{\link{Heatmap-class}} class method } } \examples{ diff --git a/man/show-dispatch.Rd b/man/show-dispatch.Rd index 8e2bbdc..bfd68fc 100644 --- a/man/show-dispatch.Rd +++ b/man/show-dispatch.Rd @@ -11,11 +11,11 @@ Method dispatch page for \code{show}. \itemize{ \item \code{\link{show,ColorMapping-method}}, \code{\link{ColorMapping-class}} class method -\item \code{\link{show,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method \item \code{\link{show,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method -\item \code{\link{show,Heatmap-method}}, \code{\link{Heatmap-class}} class method \item \code{\link{show,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method +\item \code{\link{show,Heatmap-method}}, \code{\link{Heatmap-class}} class method \item \code{\link{show,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method +\item \code{\link{show,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method } } \examples{