Learn R Programming

MOFA (version 1.3.1)

plotDataScatter: Scatterplots of feature values against latent factors

Description

Function to do a scatterplot of the feature(s) values against the latent factor values.

Usage

plotDataScatter(object, view, factor, features = 10, color_by = NULL,
  name_color = "", shape_by = NULL, name_shape = "",
  showMissing = TRUE)

Arguments

object

a MOFAmodel object.

view

character vector with a view name, or numeric vector with the index of the view.

factor

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

features

if an integer, the total number of features to plot (10 by default). If a character vector, a set of manually-defined features.

color_by

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

name_color

name for the color legend

shape_by

specifies groups or values used to shape the samples. This can be either: (a) a character giving the name of a feature present in the training data, (b) a character giving the name of a covariate (only if using MultiAssayExperiment as input), or (c) a vector of the same length as the number of samples specifying discrete groups.

name_shape

name for the shape legend

showMissing

logical indicating whether to show samples with missing values for the color or the shape. Default is TRUE.

Value

a scatterplot of featurea against a factor

Details

One of the first steps for the annotation of a given factor is to visualise the corresponding loadings, using for example plotWeights or plotTopWeights. These functions display the top features that are driving the heterogeneity captured by a factor. However, one might also be interested in visualising the coordinated heterogeneity in the input data, rather than looking at "abstract" weights. This function generates scatterplots of features against factors (each dot is a sample), so that you can observe the association between them. A similar function for doing heatmaps rather than scatterplots is plotDataHeatmap.

Examples

Run this code
# NOT RUN {
# Load CLL data
filepath <- system.file("extdata", "CLL_model.hdf5", package = "MOFAdata")
MOFA_CLL <- loadModel(filepath)
# plot scatter for top 5 features on factor 1 in the view mRNA:
plotDataScatter(MOFA_CLL, view="mRNA", factor=1, features=5)
# coloring by the IGHV status (features in Mutations view), not showing samples with missing IGHV:
plotDataScatter(MOFA_CLL, view="mRNA", factor=1, features=5, color_by="IGHV", showMissing=FALSE)
# }

Run the code above in your browser using DataLab