### Example: create heatmap and add layer_asterisk() Source: https://stemangiola.github.io/tidyHeatmap/reference/layer_asterisk-method.html Example usage: creates a heatmap from the N52 dataset using tidyHeatmap::heatmap() with row, column, and value mappings, then applies layer_asterisk() to add the symbol layer. The example is from the documentation's Examples section. ```r hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> layer_asterisk() ``` -------------------------------- ### Install development version Source: https://stemangiola.github.io/tidyHeatmap/index.html Installs the most up-to-date version of the package from GitHub using devtools. ```R devtools::install_github("stemangiola/tidyHeatmap") ``` -------------------------------- ### annotation_line usage example Source: https://stemangiola.github.io/tidyHeatmap/reference/annotation_line-method.html Example showing how to create a heatmap and add a line annotation using the annotation_line method. ```R hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> annotation_line(inflection) ``` -------------------------------- ### Example: adding text layers to a heatmap Source: https://stemangiola.github.io/tidyHeatmap/reference/layer_text-method.html Complete example showing how to create a heatmap from tidyHeatmap::N52, add a text column, and then apply layer_text() with a literal string or a column name. The output from library(dplyr) is shown as part of the example. ```r library(dplyr) #> #> Attaching package: ‘dplyr’ #> The following objects are masked from ‘package:stats’: #> #> filter, lag #> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union hm = tidyHeatmap::N52 |> mutate(my_text = "t") |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> layer_text(.value = "a") hm |> layer_text(.value = my_text) ``` -------------------------------- ### Install stable version Source: https://stemangiola.github.io/tidyHeatmap/index.html Installs the most stable version of the package from CRAN. ```R install.packages("tidyHeatmap") ``` -------------------------------- ### Adding a star layer to a heatmap Source: https://stemangiola.github.io/tidyHeatmap/reference/layer_star-method.html Example showing how to create a heatmap using tidyHeatmap and apply the layer_star method to it. ```R hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> layer_star() ``` -------------------------------- ### Example usage of annotation_point Source: https://stemangiola.github.io/tidyHeatmap/reference/annotation_point-method.html Demonstrates creating a heatmap from the N52 dataset and adding a point annotation layer based on the inflection column. ```R hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> annotation_point(inflection) ``` -------------------------------- ### Layer text example Source: https://stemangiola.github.io/tidyHeatmap/articles/introduction.html Adds text layers on top of a tidyHeatmap heatmap. The example filters the pasilla dataset to the first 10 symbols, creates dynamic text and size columns, and uses layer_text with conditional expressions to place text on specific samples. ```r tidyHeatmap::pasilla |> # filter filter(symbol %in% head(unique(tidyHeatmap::pasilla$symbol), n = 10)) |> # Add dynamic text mutate(my_text = "mt", my_size = 7) |> # Plot heatmap( .column = sample, .row = symbol, .value = `count normalised adjusted`, scale = "row" ) |> layer_text( `count normalised adjusted log` > 6 & sample == "untreated3", .value = "a", .size = 15 ) |> layer_text( `count normalised adjusted log` > 6 & sample == "untreated2", .value = my_text, .size = my_size ) ``` -------------------------------- ### Complex layer text example with colors Source: https://stemangiola.github.io/tidyHeatmap/articles/introduction.html Demonstrates adding dynamic text layers to a heatmap with conditional content, colors, and sizes based on normalized log counts. ```R tidyHeatmap::pasilla |> # filter filter(symbol %in% head(unique(tidyHeatmap::pasilla$symbol), n = 10)) |> # Add dynamic text content and styling mutate( text_content = case_when( `count normalised adjusted log` > 7 ~ "***", `count normalised adjusted log` > 6 ~ "**", `count normalised adjusted log` > 5 ~ "*", TRUE ~ "" ), text_color = case_when( `count normalised adjusted log` > 7 ~ "darkred", `count normalised adjusted log` > 6 ~ "darkorange", `count normalised adjusted log` > 5 ~ "darkgreen", TRUE ~ "darkgray" ), text_size = case_when( `count normalised adjusted log` > 7 ~ 12, `count normalised adjusted log` > 6 ~ 10, `count normalised adjusted log` > 5 ~ 8, TRUE ~ 6 ) ) |> heatmap( .column = sample, .row = symbol, .value = `count normalised adjusted`, scale = "row" ) |> layer_text( `count normalised adjusted log` > 6 & sample == "untreated3", .value = "HIGH", .color = "red", .size = 12 ) |> layer_text( `count normalised adjusted log` > 5 & sample == "untreated1", .value = "↑", .color = "blue", .size = 10 ) |> # Dynamically set text content, color and size layer_text( `count normalised adjusted log` > 6 & sample == "untreated2", .value = text_content, .color = text_color, .size = text_size ) ``` -------------------------------- ### Example: Add point layer to a heatmap from N52 dataset Source: https://stemangiola.github.io/tidyHeatmap/reference/layer_point-method.html Creates a heatmap from the tidyHeatmap::N52 dataset and adds a point layer with default size. The result is an InputHeatmap that evaluates to a ComplexHeatmap. ```r hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> layer_point() ``` -------------------------------- ### Example: save_pdf() with tidyHeatmap::heatmap() Source: https://stemangiola.github.io/tidyHeatmap/reference/save_pdf-methods.html Example usage of save_pdf() to save a heatmap to a temporary file. The heatmap is created using tidyHeatmap::heatmap() with grouped data. The output message indicates the saved image dimensions. ```r tidyHeatmap::heatmap( dplyr::group_by(tidyHeatmap::pasilla, location, type), .column = sample, .row = symbol, .value = `count normalised adjusted`, ) |> save_pdf(tempfile()) #> tidyHeatmap says: saving 6.67 x 6.67 in image ``` -------------------------------- ### Create heatmap and add bar annotation Source: https://stemangiola.github.io/tidyHeatmap/reference/annotation_bar-method.html Example workflow: create a heatmap from the N52 dataset, then add a bar annotation for the inflection column. The first block triggers a deprecation warning about when() from purrr. ```r hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) ``` ```r hm |> annotation_bar(inflection) ``` -------------------------------- ### Extract heatmap data and dendrograms Source: https://stemangiola.github.io/tidyHeatmap/reference/get_heatmap_data-method.html Example showing the creation of a heatmap using tidyHeatmap and the subsequent extraction of the ordered matrix and dendrograms using get_heatmap_data. ```R hm <- tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) |> annotation_group( CAPRA_TOTAL, palette_grouping = list(c("#E64B35", "#4DBBD5")), group_label_fontsize = 10, show_group_name = FALSE ) # Multiple grouping variables tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) |> annotation_group( CAPRA_TOTAL, `Cell type`, palette_grouping = list( c("#E64B35", "#4DBBD5"), # colors for CAPRA_TOTAL c("#00A087", "#F39B7F") # colors for Cell type ) ) # Get heatmap data as plotted result <- hm |> get_heatmap_data() ordered_matrix <- result$matrix row_dendrogram <- result$row_dend column_dendrogram <- result$column_dend ``` -------------------------------- ### Example: using layer_arrow_down on a heatmap Source: https://stemangiola.github.io/tidyHeatmap/reference/layer_arrow_down-method.html Creates a heatmap from the N52 dataset and then adds a bar annotation layer using layer_arrow_down(). ```r hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> layer_arrow_down() ``` -------------------------------- ### Complex layer symbol example with colors Source: https://stemangiola.github.io/tidyHeatmap/articles/introduction.html Adds multiple symbol layers (point, diamond, star, square) to a tidyHeatmap heatmap, with conditional colors and sizes. Requires the pasilla dataset and tidyHeatmap package. The example filters to the first 10 symbols and creates dynamic color and size columns before applying the layers. ```r tidyHeatmap::pasilla |> # filter filter(symbol %in% head(unique(tidyHeatmap::pasilla$symbol), n = 10)) |> # Add dynamic color and size columns mutate( my_color = case_when( `count normalised adjusted log` > 7 ~ "#57fb77", `count normalised adjusted log` > 6 ~ "darkorange", TRUE ~ "#fb7ef9" ), my_size = runif(n(), 3, 8) ) |> heatmap( .column = sample, .row = symbol, .value = `count normalised adjusted`, scale = "row" ) |> layer_point( `count normalised adjusted log` > 6 & sample == "untreated3", .color = "red", .size = 5 ) |> layer_diamond( `count normalised adjusted log` > 6 & sample == "untreated1", .color = "green", .size = 6 ) |> layer_star( `count normalised adjusted log` > 7, .color = "purple", .size = 4 ) |> # Dynamically color and size layer_square( `count normalised adjusted log` > 6 & sample == "untreated2", .color = my_color, .size = my_size ) ``` -------------------------------- ### layer_diamond() usage and example Source: https://stemangiola.github.io/tidyHeatmap/reference/layer_diamond-method.html The first block shows the generic and S4 method signatures for layer_diamond(). The second block creates a heatmap from the N52 dataset and adds a diamond layer on top of the tiles. ```r layer_diamond(.data, ..., .size = NULL) # S4 method for class 'InputHeatmap' layer_diamond(.data, ..., .size = NULL) ``` ```r hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> layer_diamond() ``` -------------------------------- ### get_sample_transcript() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html Gets column names either from user or from attributes. This is a helper function for extracting column names. ```APIDOC ## get_sample_transcript() ### Description Get column names either from user or from attributes ### Usage `get_sample_transcript(.data, ...)` ### Arguments - `.data` - Required - A data frame. - `...` - Additional arguments. ### Value A character vector of column names. ``` -------------------------------- ### Convert tidyHeatmap to ComplexHeatmap Source: https://stemangiola.github.io/tidyHeatmap/reference/as_ComplexHeatmap-method.html Example of piping a tidyHeatmap object into the as_ComplexHeatmap function. ```R tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log`, ) |> as_ComplexHeatmap() ``` -------------------------------- ### Display R session information with sessionInfo() Source: https://stemangiola.github.io/tidyHeatmap/articles/introduction.html Run sessionInfo() to display the R version, platform, locale, and attached packages. The output shows the exact environment used for the examples, including tidyHeatmap_1.13.2 and ggplot2_4.0.1. ```r sessionInfo() ``` ```r ## R Under development (unstable) (2026-02-04 r89376) ## Platform: x86_64-pc-linux-gnu ## Running under: Ubuntu 24.04.3 LTS ## ## Matrix products: default ## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 ## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0 ## ## locale: ## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C ## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 ## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 ## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C ## [9] LC_ADDRESS=C LC_TELEPHONE=C ## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C ## ## time zone: UTC ## tzcode source: system (glibc) ## ## attached base packages: ## [1] grid stats graphics grDevices utils datasets methods ## [8] base ## ## other attached packages: ## [1] forcats_1.0.1 patchwork_1.3.2 ggplot2_4.0.1 tidyHeatmap_1.13.2 ## [5] tidyr_1.3.2 dplyr_1.1.4 ## ## loaded via a namespace (and not attached): ## [1] viridis_0.6.5 utf8_1.2.6 sass_0.4.10 ## [4] generics_0.1.4 shape_1.4.6.1 digest_0.6.39 ## [7] magrittr_2.0.4 evaluate_1.0.5 RColorBrewer_1.1-3 ## [10] iterators_1.0.14 circlize_0.4.17 fastmap_1.2.0 ## [13] foreach_1.5.2 doParallel_1.0.17 jsonlite_2.0.0 ``` -------------------------------- ### get_sample_transcript_counts() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html Gets column names either from user or from attributes. This is a helper function for extracting column names. ```APIDOC ## get_sample_transcript_counts() ### Description Get column names either from user or from attributes ### Usage `get_sample_transcript_counts(.data, ...)` ### Arguments - `.data` - Required - A data frame. - `...` - Additional arguments. ### Value A character vector of column names. ``` -------------------------------- ### Create a heatmap from N52 dataset Source: https://stemangiola.github.io/tidyHeatmap/reference/heatmap-method.html Example usage of heatmap() with the N52 dataset, grouping by 'Cell type' and specifying row, column, and value columns. The result is an InputHeatmap object that evaluates to a ComplexHeatmap. ```r tidyHeatmap::N52 |> dplyr::group_by( `Cell type`) |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log`, ) ``` -------------------------------- ### get_sample_counts() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html Gets column names either from user or from attributes. This is a helper function for extracting column names. ```APIDOC ## get_sample_counts() ### Description Get column names either from user or from attributes ### Usage `get_sample_counts(.data, ...)` ### Arguments - `.data` - Required - A data frame. - `...` - Additional arguments. ### Value A character vector of column names. ``` -------------------------------- ### get_elements() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html Gets column names either from user or from attributes. This is a helper function for extracting column names. ```APIDOC ## get_elements() ### Description Get column names either from user or from attributes ### Usage `get_elements(.data, ...)` ### Arguments - `.data` - Required - A data frame. - `...` - Additional arguments. ### Value A character vector of column names. ``` -------------------------------- ### Add numeric annotation to a heatmap Source: https://stemangiola.github.io/tidyHeatmap/reference/annotation_numeric-method.html Creates a heatmap from the N52 dataset and adds a numeric annotation for the `inflection` column. The second example shows how to align the annotation to the right using `align_to = "right"`. ```r hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> annotation_numeric(inflection) # Align to the right hm |> annotation_numeric(inflection, align_to = "right") ``` -------------------------------- ### Convert tidyHeatmap heatmap to patchwork patch Source: https://stemangiola.github.io/tidyHeatmap/reference/wrap_heatmap-method.html Converts a tidyHeatmap heatmap built from the N52 dataset into a patchwork-compliant patch. The example pipes the heatmap into wrap_heatmap() with no extra arguments, so the heatmap is placed in the full area by default. ```r tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log`, ) |> wrap_heatmap() ``` -------------------------------- ### Create a heatmap with modular annotations Source: https://stemangiola.github.io/tidyHeatmap/index.html Demonstrates data preparation and the construction of a heatmap with multiple annotation types including groups, tiles, points, numeric values, bars, and lines. ```R # Create some more data points pasilla_plus <- tidyHeatmap::pasilla |> dplyr::mutate(activation_2 = activation, activation_3 = activation) |> tidyr::nest(data = -sample) |> dplyr::mutate(size = rnorm(n(), 4,0.5)) |> dplyr::mutate(age = runif(n(), 50, 200)) |> tidyr::unnest(data) # Plot pasilla_plus |> heatmap( .column = sample, .row = symbol, .value = `count normalised adjusted`, scale = "row" ) |> annotation_group(location) |> annotation_tile(condition, show_legend = FALSE) |> annotation_point(activation) |> annotation_numeric(activation_3) |> annotation_tile(activation_2) |> annotation_bar(size) |> annotation_line(age) ``` -------------------------------- ### annotation_tile() generic and S4 method signatures Source: https://stemangiola.github.io/tidyHeatmap/reference/annotation_tile-method.html Shows the generic and S4 method signatures for annotation_tile(). Use this to see the expected arguments: .data (an InputHeatmap from tidyHeatmap::heatmap()), .column (vector of quotes), palette (colors or a function like colorRamp2), size (a grid::unit object), and ... passed to anno_block and HeatmapAnnotation. ```r annotation_tile(.data, .column, palette = NULL, size = NULL, ...) # S4 method for class 'InputHeatmap' annotation_tile(.data, .column, palette = NULL, size = NULL, ...) ``` -------------------------------- ### split_rows() and split_columns() usage and S4 method signatures Source: https://stemangiola.github.io/tidyHeatmap/reference/split-methods.html Shows the generic function signatures and their S4 methods for InputHeatmap objects. Both functions accept an InputHeatmap and an integer number_of_groups. ```r split_rows(.data, number_of_groups) # S4 method for class 'InputHeatmap' split_rows(.data, number_of_groups) split_columns(.data, number_of_groups) # S4 method for class 'InputHeatmap' split_columns(.data, number_of_groups) ``` -------------------------------- ### get_elements_features_abundance() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html Gets column names either from user or from attributes. This is a helper function for extracting column names. ```APIDOC ## get_elements_features_abundance() ### Description Get column names either from user or from attributes ### Usage `get_elements_features_abundance(.data, ...)` ### Arguments - `.data` - Required - A data frame. - `...` - Additional arguments. ### Value A character vector of column names. ``` -------------------------------- ### get_elements_features() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html Gets column names either from user or from attributes. This is a helper function for extracting column names. ```APIDOC ## get_elements_features() ### Description Get column names either from user or from attributes ### Usage `get_elements_features(.data, ...)` ### Arguments - `.data` - Required - A data frame. - `...` - Additional arguments. ### Value A character vector of column names. ``` -------------------------------- ### Custom colors and formatting Source: https://stemangiola.github.io/tidyHeatmap/reference/annotation_group.html Shows how to customize the appearance of group annotations using palette_grouping, font size, and label visibility settings. ```R tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) |> annotation_group( CAPRA_TOTAL, palette_grouping = list(c("#E64B35", "#4DBBD5")), group_label_fontsize = 10, show_group_name = FALSE ) ``` -------------------------------- ### get_abundance_norm_if_exists() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html Gets column names either from user or from attributes. This is a helper function for extracting column names. ```APIDOC ## get_abundance_norm_if_exists() ### Description Get column names either from user or from attributes ### Usage `get_abundance_norm_if_exists(.data, ...)` ### Arguments - `.data` - Required - A data frame. - `...` - Additional arguments. ### Value A character vector of column names. ``` -------------------------------- ### layer_arrow_up() generic and S4 method signatures Source: https://stemangiola.github.io/tidyHeatmap/reference/layer_arrow_up-method.html Shows the generic and S4 method signatures for layer_arrow_up(). The generic accepts .data, ..., and .size; the S4 method is defined for InputHeatmap objects. ```r layer_arrow_up(.data, ..., .size = NULL) # S4 method for class 'InputHeatmap' layer_arrow_up(.data, ..., .size = NULL) ``` -------------------------------- ### as_matrix() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html Gets a matrix from a tibble. This function converts a tidy data frame into a matrix format suitable for heatmap plotting. ```APIDOC ## as_matrix() ### Description Get matrix from tibble ### Usage `as_matrix(tbl, rownames = NULL)` ### Arguments - `tbl` (tbl_df) - Required - A tibble. - `rownames` (character) - Optional - Column to use as row names. ### Value A matrix. ``` -------------------------------- ### get_sample_transcript(.data, .sample, .transcript) Source: https://stemangiola.github.io/tidyHeatmap/reference/get_sample_transcript.html Returns a list of column enquo or error. It takes a tibble and character names for sample and transcript columns. ```APIDOC ## get_sample_transcript(.data, .sample, .transcript) ### Description Get column names either from user or from attributes. ### Usage ```r get_sample_transcript(.data, .sample, .transcript) ``` ### Arguments - **.data** (tibble) - Required - A tibble - **.sample** (character) - Required - A character name of the sample column - **.transcript** (character) - Required - A character name of the transcript/gene column ### Value A list of column enquo or error ``` -------------------------------- ### layer_point() usage and S4 method signature Source: https://stemangiola.github.io/tidyHeatmap/reference/layer_point-method.html Shows the generic function signature and the S4 method for the InputHeatmap class. The .size argument can be a column name or a double to control point size. ```r layer_point(.data, ..., .size = NULL) # S4 method for class 'InputHeatmap' layer_point(.data, ..., .size = NULL) ``` -------------------------------- ### layer_text() generic and S4 method signatures Source: https://stemangiola.github.io/tidyHeatmap/reference/layer_text-method.html Shows the generic function signature and the S4 method signature for the InputHeatmap class. Use this to understand the expected arguments and their defaults. ```r layer_text(.data, ..., .value, .size = NULL, .color = NULL) # S4 method for class 'InputHeatmap' layer_text(.data, ..., .value, .size = NULL, .color = NULL) ``` -------------------------------- ### get_elements_features_abundance Source: https://stemangiola.github.io/tidyHeatmap/reference/get_elements_features_abundance.html Get column names either from user or from attributes. This function takes a tibble and column names for sample, feature, and abundance, and returns a list of quosures or an error. ```APIDOC ## get_elements_features_abundance ### Description Get column names either from user or from attributes. ### Usage ```r get_elements_features_abundance( .data, .element, .feature, .abundance, of_samples = TRUE ) ``` ### Arguments - `.data` (tibble) - Required - A tibble - `.element` (character) - Required - A character name of the sample column - `.feature` (character) - Required - A character name of the transcript/gene column - `.abundance` (character) - Required - A character name of the read count column - `of_samples` (boolean) - Optional - A boolean ### Value A list of column enquo or error ``` -------------------------------- ### annotation_numeric() function signature and S4 method Source: https://stemangiola.github.io/tidyHeatmap/reference/annotation_numeric-method.html Shows the generic function signature and the S4 method for class 'InputHeatmap'. The `labels_format` defaults to formatting numbers to two decimal places using `sprintf("%.1f", x)`. The `...` arguments are passed to `anno_numeric` and `HeatmapAnnotation`. ```r annotation_numeric( .data, .column, palette = NULL, size = NULL, labels_format = function(x) sprintf("%.1f", x), ... ) # S4 method for class 'InputHeatmap' annotation_numeric( .data, .column, palette = NULL, size = NULL, labels_format = function(x) sprintf("%.1f", x), ... ) ``` -------------------------------- ### input_heatmap() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html input_heatmap ```APIDOC ## input_heatmap() ### Description input_heatmap ### Usage `input_heatmap(.data, ...)` ### Arguments - `.data` - Required - A data frame. - `...` - Additional arguments. ### Value An InputHeatmap object. ``` -------------------------------- ### prepend() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html From rlang deprecated. This function is deprecated and should not be used. ```APIDOC ## prepend() ### Description From rlang deprecated ### Usage `prepend(x, values, before = 1)` ### Arguments - `x` - Required - A vector. - `values` - Required - Values to prepend. - `before` - Optional - Position to insert. ### Value A vector with prepended values. ``` -------------------------------- ### save_pdf(__) Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html save_pdf ```APIDOC ## save_pdf(__) ### Description save_pdf ### Usage `save_pdf(heatmap, ...)` ### Arguments - `heatmap` - Required - An InputHeatmap object. - `...` - Additional arguments. ### Value Saves the heatmap to a PDF file. ``` -------------------------------- ### Create heatmap and add arrow-up layer Source: https://stemangiola.github.io/tidyHeatmap/reference/layer_arrow_up-method.html Builds a heatmap from the N52 dataset and adds an arrow-up layer. The heatmap uses symbol_ct as rows, UBR as columns, and the 'read count normalised log' column as values. ```r hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> layer_arrow_up() ``` -------------------------------- ### Adding heatmap side-by-side Source: https://stemangiola.github.io/tidyHeatmap/articles/introduction.html Shows how to combine two tidyHeatmap objects using the + operator. ```R p_heatmap = heatmap(mtcars_tidy, `Car name`, Property, Value, scale = "row") p_heatmap + p_heatmap ``` -------------------------------- ### Basic usage with row grouping Source: https://stemangiola.github.io/tidyHeatmap/reference/annotation_group.html Demonstrates the basic application of row grouping using the annotation_group function on a tidyHeatmap object. ```R tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) |> annotation_group(CAPRA_TOTAL) ``` -------------------------------- ### Multiple grouping variables Source: https://stemangiola.github.io/tidyHeatmap/reference/annotation_group.html Demonstrates grouping by multiple variables with specific color palettes assigned to each group. ```R tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) |> annotation_group( CAPRA_TOTAL, `Cell type`, palette_grouping = list( c("#E64B35", "#4DBBD5"), # colors for CAPRA_TOTAL c("#00A087", "#F39B7F") # colors for Cell type ) ) ``` -------------------------------- ### layer_square() generic and S4 method signatures Source: https://stemangiola.github.io/tidyHeatmap/reference/layer_square-method.html Shows the generic and S4 method signatures for layer_square(). The .data argument is an InputHeatmap object, ... are expressions that return a logical value and are combined with the & operator, and .size is a column name or a double controlling the size of the layer elements. ```r layer_square(.data, ..., .size = NULL) # S4 method for class 'InputHeatmap' layer_square(.data, ..., .size = NULL) ``` -------------------------------- ### Split heatmap columns into 2 groups with split_columns() Source: https://stemangiola.github.io/tidyHeatmap/reference/split-methods.html Creates a heatmap from the N52 dataset and splits the columns into 2 groups using split_columns(). The result is an InputHeatmap that evaluates to a ComplexHeatmap. ```r hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> split_columns(2) ``` -------------------------------- ### wrap_heatmap() signature and S4 method for InputHeatmap Source: https://stemangiola.github.io/tidyHeatmap/reference/wrap_heatmap-method.html Shows the default signature and the S4 method for InputHeatmap. Use this to convert a tidyHeatmap (ComplexHeatmap) object into a patchwork-compliant patch. The arguments panel, plot, and full accept a grob, ggplot, patchwork, formula, raster, or nativeRaster object; clip controls clipping, ignore_tag controls automatic tagging, and padding is a grid::unit object for spacing when assembling with other ggplots. ```r wrap_heatmap( panel = NULL, plot = NULL, full = NULL, clip = TRUE, ignore_tag = FALSE, padding = NULL ) # S4 method for class 'InputHeatmap' wrap_heatmap( panel = NULL, plot = NULL, full = NULL, clip = TRUE, ignore_tag = FALSE, padding = NULL ) ``` -------------------------------- ### heatmap() / heatmap_() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html Creates an InputHeatmap object from a tbl_df, which on evaluation creates a ComplexHeatmap. This is the main function for generating heatmaps. ```APIDOC ## heatmap() / heatmap_() ### Description Creates an `InputHeatmap` object from `tbl_df` on evaluation creates a `ComplexHeatmap`. ### Usage `heatmap(.data, ...)` `heatmap_(.data, ...)` ### Arguments - `.data` (tbl_df) - Required - A tidy data frame. - `...` - Additional arguments passed to the underlying ComplexHeatmap. ### Value An `InputHeatmap` object that can be evaluated to produce a `ComplexHeatmap`. ``` -------------------------------- ### Create heatmap with multiple groupings and annotations Source: https://stemangiola.github.io/tidyHeatmap/articles/introduction.html Creates a heatmap with multiple groupings and annotations. The `annotation_group` function adds a group annotation for the `location` and `type` columns, while `annotation_tile` adds tile annotations for `condition` and `activation`. ```R tidyHeatmap::pasilla |> heatmap( .column = sample, .row = symbol, .value = `count normalised adjusted`, scale = "row" ) |> annotation_group(location, type) |> annotation_tile(condition) |> annotation_tile(activation) ``` -------------------------------- ### get_x_y_annotation_columns() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html get_x_y_annotation_columns ```APIDOC ## get_x_y_annotation_columns() ### Description get_x_y_annotation_columns ### Usage `get_x_y_annotation_columns(...)` ### Arguments - `...` - Additional arguments. ### Value A list of column names. ``` -------------------------------- ### save_pdf(InputHeatmap) Source: https://stemangiola.github.io/tidyHeatmap/reference/save_pdf-InputHeatmap-method.html Saves an InputHeatmap object to a PDF file. The method accepts a heatmap object, a filename, and optional width, height, and units parameters. ```APIDOC ## save_pdf(InputHeatmap) ### Description Saves an InputHeatmap object to a PDF file. The method accepts a heatmap object, a filename, and optional width, height, and units parameters. ### Method S4 method for class 'InputHeatmap' ### Signature ```r save_pdf( .heatmap, filename, width = NULL, height = NULL, units = c("in", "cm", "mm") ) ``` ### Parameters - **.heatmap** (Heatmap) - Required - A `Heatmap` object. - **filename** (character) - Required - A character string. The name of the output file/path. - **width** (double) - Optional - Plot width. - **height** (double) - Optional - Plot height. - **units** (character) - Optional - Units for width and height. One of "in", "cm", or "mm". Default is c("in", "cm", "mm"). ### Usage ```r save_pdf(.heatmap, filename, width = NULL, height = NULL, units = c("in", "cm", "mm")) ``` ### Details This method saves the heatmap to a PDF file with the specified filename and dimensions. ``` -------------------------------- ### get_elements_features_abundance function signature Source: https://stemangiola.github.io/tidyHeatmap/reference/get_elements_features_abundance.html Shows the usage of the get_elements_features_abundance function with its arguments: .data, .element, .feature, .abundance, and of_samples (default TRUE). Returns a list of column enquo or error. ```r get_elements_features_abundance( .data, .element, .feature, .abundance, of_samples = TRUE ) ``` -------------------------------- ### Add tile annotation with annotation_tile() on a tidyHeatmap heatmap Source: https://stemangiola.github.io/tidyHeatmap/reference/annotation_tile-method.html Creates a heatmap from tidyHeatmap::N52 and adds a tile annotation layer. The first annotation_tile() call uses the CAPRA_TOTAL column; the second uses the inflection column with a colorRamp2 palette mapping 0, 3, 10 to white, green, and red. ```r hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> annotation_tile(CAPRA_TOTAL) hm |> annotation_tile( inflection, palette = circlize::colorRamp2(c(0, 3,10), c("white", "green", "red")) ) ``` -------------------------------- ### annotation_point(.data, .column, palette = NULL, size = NULL, ...) Source: https://stemangiola.github.io/tidyHeatmap/reference/annotation_point-method.html Adds a point annotation layer to an `InputHeatmap` object. This S4 method for the `InputHeatmap` class allows customization of the point annotation via palette, size, and additional arguments. ```APIDOC ## annotation_point(.data, .column, palette = NULL, size = NULL, ...) ### Description Adds a point annotation layer to an `InputHeatmap` object, which on evaluation creates a `ComplexHeatmap`. ### Method S4 method for class 'InputHeatmap' ### Signature annotation_point(.data, .column, palette = NULL, size = NULL, ...) ### Parameters - **.data** (InputHeatmap) - Required - A `InputHeatmap` object created calling `tidyHeatmap::heatmap()`. - **.column** (quoted) - Required - Vector of quotes. - **palette** (character vector or function) - Optional - A character vector of colors, or a function such as `colorRamp2`. - **size** (grid::unit) - Optional - A `grid::unit` object, e.g. `unit(2, "cm")`. This is the height or width of the annotation depending on the orientation. - **...** - Optional - Arguments passed to `anno_points` and `HeatmapAnnotation` to fine-tune aesthetics. ### Return Value A `InputHeatmap` object that gets evaluated to a `ComplexHeatmap`. ### Details Uses `ComplexHeatmap` as visualisation tool. ### Example ```r hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> annotation_point(inflection) ``` ``` -------------------------------- ### Split heatmap rows into 2 groups with split_rows() Source: https://stemangiola.github.io/tidyHeatmap/reference/split-methods.html Creates a heatmap from the N52 dataset and splits the rows into 2 groups using split_rows(). The result is an InputHeatmap that evaluates to a ComplexHeatmap. ```r hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> split_rows(2) ``` -------------------------------- ### save_pdf() function signature Source: https://stemangiola.github.io/tidyHeatmap/reference/save_pdf-methods.html The function signature for save_pdf(). It takes a Heatmap object, a filename, and optional width, height, and units arguments. The units argument accepts "in", "cm", or "mm". ```r save_pdf( .heatmap, filename, width = NULL, height = NULL, units = c("in", "cm", "mm") ) ``` -------------------------------- ### as_ComplexHeatmap method signature Source: https://stemangiola.github.io/tidyHeatmap/reference/as_ComplexHeatmap-method.html The method signature for converting an InputHeatmap object to a Heatmap object. ```R as_ComplexHeatmap(tidyHeatmap) # S4 method for class 'InputHeatmap' as_ComplexHeatmap(tidyHeatmap) ``` -------------------------------- ### save_pdf(Heatmap) Source: https://stemangiola.github.io/tidyHeatmap/reference/save_pdf-Heatmap-method.html Saves a Heatmap object to a PDF file with optional width, height, and units parameters. ```APIDOC ## save_pdf(Heatmap) ### Description Saves a `Heatmap` object to a PDF file. ### Method S4 method for class 'Heatmap' ### Signature ```r save_pdf( .heatmap, filename, width = NULL, height = NULL, units = c("in", "cm", "mm") ) ``` ### Parameters - **.heatmap** (Heatmap) - Required - A `Heatmap` object to save. - **filename** (character) - Required - A character string. The name of the output file/path. - **width** (double) - Optional - Plot width. - **height** (double) - Optional - Plot height. - **units** (character) - Optional - Units for width and height. One of "in", "cm", or "mm". Default is c("in", "cm", "mm"). ### Return Value No explicit return value documented. ``` -------------------------------- ### ifelse_pipe() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html This is a generalisation of ifelse that accepts an object and returns an object. It is a pipe-friendly conditional. ```APIDOC ## ifelse_pipe() ### Description This is a generalisation of ifelse that accepts an object and return an objects ### Usage `ifelse_pipe(x, yes, no)` ### Arguments - `x` - Required - A condition. - `yes` - Required - Value if condition is TRUE. - `no` - Required - Value if condition is FALSE. ### Value Either `yes` or `no` depending on the condition. ``` -------------------------------- ### as_matrix(tbl, rownames = NULL, do_check = TRUE) Source: https://stemangiola.github.io/tidyHeatmap/reference/as_matrix.html Converts a tibble into a matrix, optionally using a column as row names. ```APIDOC ## as_matrix(tbl, rownames = NULL, do_check = TRUE) ### Description Converts a tibble into a matrix, optionally using a column as row names. ### Method Function call ### Endpoint as_matrix(tbl, rownames = NULL, do_check = TRUE) ### Parameters #### Arguments - **tbl** (tibble) - Required - A tibble to convert to a matrix. - **rownames** (character string) - Optional - A character string specifying the column to use as row names. - **do_check** (boolean) - Optional - A boolean indicating whether to perform checks. ### Return Value A matrix. ``` -------------------------------- ### annot_to_list() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html Converts annotation data to a list. This is an internal utility function. ```APIDOC ## annot_to_list() ### Description annot_to_list ### Usage `annot_to_list(...)` ### Arguments - `...` - Arguments to be converted to a list. ### Value A list representation of the annotation. ``` -------------------------------- ### Combine more than two heatmaps with as_ComplexHeatmap Source: https://stemangiola.github.io/tidyHeatmap/articles/introduction.html Robustly combine more than two heatmaps by converting them to ComplexHeatmap objects to avoid R method dispatch limitations. ```R as_ComplexHeatmap(p_heatmap) + as_ComplexHeatmap(p_heatmap) + as_ComplexHeatmap(p_heatmap) ``` -------------------------------- ### layer_asterisk() S4 method signature for InputHeatmap Source: https://stemangiola.github.io/tidyHeatmap/reference/layer_asterisk-method.html Signature for the layer_asterisk() function and its S4 method for InputHeatmap objects. The method adds a symbol annotation layer over heatmap tiles. Arguments: .data (an InputHeatmap), ... (expressions returning logical values, combined with &), and .size (a column name or double for element size). Returns an InputHeatmap that evaluates to a ComplexHeatmap. ```r layer_asterisk(.data, ..., .size = NULL) # S4 method for class 'InputHeatmap' layer_asterisk(.data, ..., .size = NULL) ``` -------------------------------- ### +(__) Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html Adds two tidyHeatmap objects together. This operator allows combining heatmaps. ```APIDOC ## +(__) ### Description Add two tidyHeatmap objects together ### Usage `+`(e1, e2) ### Arguments - `e1` - Required - An InputHeatmap object. - `e2` - Required - Another InputHeatmap object. ### Value A combined heatmap object. ``` -------------------------------- ### ifelse2_pipe() Source: https://stemangiola.github.io/tidyHeatmap/reference/index.html This is a generalisation of ifelse that accepts an object and returns an object. It is a pipe-friendly conditional. ```APIDOC ## ifelse2_pipe() ### Description This is a generalisation of ifelse that accepts an object and return an objects ### Usage `ifelse2_pipe(x, yes, no)` ### Arguments - `x` - Required - A condition. - `yes` - Required - Value if condition is TRUE. - `no` - Required - Value if condition is FALSE. ### Value Either `yes` or `no` depending on the condition. ``` -------------------------------- ### layer_star() Source: https://stemangiola.github.io/tidyHeatmap/reference/layer_star-method.html Documentation for the layer_star() function, an S4 method for InputHeatmap objects that adds a symbol annotation layer over heatmap tiles. ```APIDOC ## layer_star() ### Description Adds a layer of symbols above the heatmap tiles to a `InputHeatmap`, that on evaluation creates a `ComplexHeatmap`. ### Usage ```r layer_star(.data, ..., .size = NULL) ``` ### Arguments - **.data** (`InputHeatmap`) - Required - A `InputHeatmap` object. - **...** (expressions) - Optional - Expressions that return a logical value, and are defined in terms of the variables in .data. If multiple expressions are included, they are combined with the `&` operator. Only rows for which all conditions evaluate to TRUE are kept. - **.size** (column name or double) - Optional - The size of the elements of the layer. ### Value A `InputHeatmap` object that gets evaluated to a `ComplexHeatmap`. ### Details It uses `ComplexHeatmap` as visualisation tool. ### Examples ```r hm = tidyHeatmap::N52 |> tidyHeatmap::heatmap( .row = symbol_ct, .column = UBR, .value = `read count normalised log` ) hm |> layer_star() ``` ```