olink_heatmap_plot: Function to plot a heatmap of the NPX data

View source: R/Olink_heatmap.R

olink_heatmap_plotR Documentation

Description

Generates a heatmap using pheatmap::pheatmap of all samples from NPX data.

Usage

olink_heatmap_plot(
  df,
  variable_row_list = NULL,
  variable_col_list = NULL,
  center_scale = TRUE,
  cluster_rows = TRUE,
  cluster_cols = TRUE,
  show_rownames = TRUE,
  show_colnames = TRUE,
  colnames = "both",
  annotation_legend = TRUE,
  fontsize = 10,
  na_col = "black",
  ...
)

Arguments

df

Data frame in long format with SampleID, NPX, OlinkID, Assay and columns of choice for annotations.

variable_row_list

Columns in df to be annotated for rows in the heatmap.

variable_col_list

Columns in df to be annotated for columns in the heatmap.

center_scale

Logical. If data should be centered and scaled across assays (default TRUE).

cluster_rows

Logical. Determining if rows should be clustered (default TRUE).

cluster_cols

Logical. Determining if columns should be clustered (default TRUE).

show_rownames

Logical. Determining if row names are shown (default TRUE).

show_colnames

Logical. Determining if column names are shown (default TRUE).

colnames

Character. Determines how to label the columns. Must be 'assay', 'oid', or 'both' (default 'both').

annotation_legend

Logical. Determining if legend for annotations should be shown (default TRUE).

fontsize

Fontsize (default 10)

na_col

Color of cells with NA (default black)

...

Additional arguments used in pheatmap::pheatmap

Details

The values are by default scaled across and centered in the heatmap. Columns and rows are by default sorted by by dendrogram. Unique sample names are required.

Value

An object of class ggplot, generated from the gtable returned by pheatmap::pheatmap.

Examples


library(dplyr)
npx_data <- npx_data1 %>%
      filter(!stringr::str_detect(SampleID,'CONT'))
try({ # This will fail if ggplotify is not installed
#Heatmap
  olink_heatmap_plot(df=npx_data)

#Heatmap with annotation
  olink_heatmap_plot(df=npx_data, variable_row_list = c('Time','Site'))

#Heatmap with calls from pheatmap
  olink_heatmap_plot(df=npx_data, cutree_rows = 3)
})




OlinkAnalyze documentation built on Sept. 25, 2024, 9:07 a.m.