Visualizes DEA results across subgroups in a heatmap. It either takes the results from previously conducted DEA or uses specified genes to plot a heatmap.

plotDeaHeatmap(
  object,
  across,
  across_subset = NULL,
  relevel = NULL,
  method_de = NULL,
  max_adj_pval = NULL,
  min_lfc = NULL,
  n_highest_lfc = NULL,
  n_lowest_pval = NULL,
  breaks = NULL,
  genes = NULL,
  n_bcs = NULL,
  clrp = NULL,
  colors = NULL,
  verbose = NULL,
  ...
)

Arguments

object

An object of class SPATA2 or, in case of S4 generics, objects of classes for which a method has been defined.

across

Character value or NULL. Specifies the grouping variable of interest.

Use getGroupingOptions() to obtain all variable names that group the barcode spots of your object in a certain manner.

across_subset

Character vector or NULL. Specifies the particular groups of interest the grouping variable specified in argument across contains.

If set to NULL all of them are chosen. You can prefix groups you are NOT interested in with a '-'. (Saves writing if there are more groups you are interested in than groups you are not interested in.)

Use getGroupNames() to obtain all valid input options.

relevel

Logical value. If set to TRUE the input order of across_subset determines the order in which the groups of interest are displayed. Groups that are not included are dropped which affects the colors with which they are displayed.

method_de

Character value. Denotes the method to according to which the de-analysis is performed. Given to argument test.use of the Seurat::FindAllMarkers()-function. Run SPATA::dea_methods to obtain all valid input options.

max_adj_pval

Numeric value. Sets the threshold for adjusted p-values. All genes with adjusted p-values above that threshold are ignored.

min_lfc

Numeric value. Sets the threshold for average log fold change. All genes with an average log fold change below that threshold are ignored.

n_highest_lfc

Numeric value. Affects the total number of genes that are kept. See details.

n_lowest_pval

Numeric value. Affects the total number of genes that are kept. See details.

breaks

Denotes the colorspectrum breaks. If set to NULL the breaks are set automatically. If a numeric vector is specified it is taken as input. If a function is specified the expression matrix is passed to it as the first argument and the length of colors as the second argument.

genes

Character vector or NULL. If you want to display specific genes irrespective of DEA results you can specifiy them in genes. If genes is specified that way arguments referring to de-anylsis results are ignored and only the genes specified are taken and displayed.

n_bcs

The number of barcodes (observations) belonging to each cluster you want to include in the matrix. Should be lower than the total number of barcode-spots of every cluster and can be deployed in order to keep the heatmap clear and aesthetically pleasing.

If set to NULL (the default) it is automatically computed according to the number of genes that are displayed in the heatmap.

clrp

Character value. Specifies the color palette to be used to represent groups of discrete variables. Run validColorPalettes() to obtain valid input options.

verbose

Logical. If TRUE, informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

...

Additional arguments given to pheatmap::pheatmap().

Value

A ggplot.

Details

The de-data.frame is processed such that the following steps are performed for every experimental group.

  1. Discards genes with avg_logFC-values that are either infinite or negative

  2. Discards genes with adjusted p-values above the threshold set with max_adj_pval

  3. Discard genes with average log fold change below the treshold set with min_lfc

  4. Slices the data.frame in order that for every experimental group:

    1. the n genes with the highest avg_logFC-values are kept where n = n_highest_lfc

    2. the n genes with the lowest p_val_adj-values are kept where n = n_lowest_pval

  5. Arranges the genes according to the highest avg_logFC-values

Tutorials

Extensive tutorials for how to use this function can be found on our website https://themilolab.github.io/SPATA2/ .

See also