plotFactorHist: Plot histogram of latent factor values

Description Usage Arguments Details Value Examples

View source: R/plotFactors.R

Description

Plot a histogram of latent factor values.

Usage

1
2
plotFactorHist(object, factor, group_by = NULL, group_names = "",
  alpha = 0.5, binwidth = NULL, showMissing = FALSE)

Arguments

object

a trained MOFAmodel object.

factor

character vector with the factor name or numeric vector with the index of the factor.

group_by

specifies groups used to color the samples of the histogram. This can be either: a character giving the name of a feature, the name of a covariate (only if using a MultiAssayExperiment as input), or a vector of the same length as the number of samples.

group_names

names for the groups.

alpha

transparency parameter. Default is 0.5

binwidth

binwidth for histogram. Default is NULL, which uses ggplot2 default calculation.

showMissing

boolean indicating whether to remove sample for which group_by is missing (default is FALSE)

Details

One of the first steps for the annotation of factors is to visualise and color them using known covariates such as phenotypic or clinical data.
This method generates a histogram of the sample values in a given latent factor.
Similar functions are plotFactorScatter for doing scatter plots between pairs of factors and plotFactorBeeswarm for doing Beeswarm plots of single factors.

Value

Returns a ggplot2 object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Example on the CLL data
filepath <- system.file("extdata", "CLL_model.hdf5", package = "MOFAdata")
MOFA_CLL <- loadModel(filepath)
plotFactorHist(MOFA_CLL, factor=1)
plotFactorHist(MOFA_CLL, factor=1, group_by= "IGHV")

# Example on the scMT data
filepath <- system.file("extdata", "scMT_model.hdf5", package = "MOFAdata")
MOFA_scMT <- loadModel(filepath)
plotFactorHist(MOFA_scMT, factor=2)

MOFA documentation built on Feb. 11, 2021, 2:01 a.m.