Learn R Programming

MOFA (version 1.3.1)

plotWeightsHeatmap: Plot heatmap of the weights

Description

Function to visualize the loadings for a given set of factors in a given view. This is useful to visualize the overall pattern of the weights but not to individually characterise the factors. To inspect the loadings of individual factors, use the functions plotWeights and plotTopWeights

Usage

plotWeightsHeatmap(object, view, features = "all", factors = "all",
  threshold = 0, ...)

Arguments

object

a trained MOFAmodel object.

view

character vector with the view name(s), or numeric vector with the index of the view(s) to use. Default is 'all'

features

character vector with the feature name(s), or numeric vector with the index of the feature(s) to use. Default is 'all'

factors

character vector with the factor name(s), or numeric vector with the index of the factor(s) to use. Default is 'all'

threshold

threshold on absolute weight values, so that loadings with a magnitude below this threshold (in all factors) are removed

...

extra arguments passed to pheatmap.

Value

produces a heatmap of feature weights for all factors

Details

The weights, or the loadings, provide the mapping between the high-dimensional space (the genes) and the low-dimensional space (the factors). They define a score for each gene on each factor, such that genes with no association with the factor are expected to have values close to zero, whereas genes with strong association with the factor are expected to have large absolute values. The sign of the loading indicates the direction of the effect: A positive loading indicates that the feature is more active in the cells with positive factor values, while a negative loading indicates that the feature is more active in the cells with negative factor values.

Examples

Run this code
# NOT RUN {
# Example on the CLL data
filepath <- system.file("extdata", "CLL_model.hdf5", package = "MOFAdata")
MOFA_CLL <- loadModel(filepath)
plotWeightsHeatmap(MOFA_CLL, view="Mutations")
plotWeightsHeatmap(MOFA_CLL, view="Mutations", factors=1:3)

# Example on the scMT data
filepath <- system.file("extdata", "scMT_model.hdf5", package = "MOFAdata")
MOFA_scMT <- loadModel(filepath)
plotWeightsHeatmap(MOFA_scMT, view="RNA expression")
# }

Run the code above in your browser using DataLab