plot_data_heatmap {MOFA2} | R Documentation

## Plot heatmap of relevant features

### Description

Function to plot a heatmap of the data for relevant features, typically the ones with high weights.

### Usage

    plot_data_heatmap(
      object,
      factor,
      view = 1,
      groups = "all",
      features = 50,
      annotation_features = NULL,
      annotation_samples = NULL,
      transpose = FALSE,
      imputed = FALSE,
      denoise = FALSE,
      max.value = NULL,
      min.value = NULL,
      ...
    )

### Arguments

`object` | a `MOFA` object.
`factor` | a string with the factor name, or an integer with the index of the factor.
`view` | a string with the view name, or an integer with the index of the view. Default is the first view.
`groups` | groups to plot. Default is "all".
`features` | if an integer (default), the total number of features to plot based on the absolute value of the weights. If a character vector, a set of manually defined features.
`annotation_features` | annotation metadata for features (rows). Either a character vector specifying columns in the feature metadata, or a data.frame that will be passed to `pheatmap` as `annotation_col`
`annotation_samples` | annotation metadata for samples (columns). Either a character vector specifying columns in the sample metadata, or a data.frame that will be passed to `pheatmap` as `annotation_row`
`transpose` | logical indicating whether to transpose the heatmap. Default corresponds to features as rows and samples as columns.
`imputed` | logical indicating whether to plot the imputed data instead of the original data. Default is FALSE.
`denoise` | logical indicating whether to plot a denoised version of the data reconstructed using the MOFA factors.
`max.value` | numeric indicating the maximum value to display in the heatmap (i.e. the matrix values will be capped at `max.value` ).
`min.value` | numeric indicating the minimum value to display in the heatmap (i.e. the matrix values will be capped at `min.value` ). See `predict`. Default is FALSE.
`...` | further arguments that can be passed to `pheatmap`

### Details

One of the first steps for the annotation of a given factor is to visualise the corresponding weights, using for example `plot_weights` or `plot_top_weights`.
However, one might also be interested in visualising the direct relationship between features and factors, rather than looking at "abstract" weights.
This function generates a heatmap for selected features, which should reveal the underlying pattern that is captured by the latent factor.
A similar function for doing scatterplots rather than heatmaps is `plot_data_scatter`.

### Value

A `pheatmap` object

### Examples

    # Using an existing trained model
    file <- system.file("extdata", "model.hdf5", package = "MOFA2")
    model <- load_model(file)
    plot_data_heatmap(model, factor = 1, show_rownames = FALSE, show_colnames = FALSE)

[Package MOFA2 version 1.4.0 Index]