plot.COMPASSResult {COMPASS}R Documentation

Plot a COMPASSResult

Description

This function can be used to visualize the mean probability of response; that is, the probability that there is a difference in response between samples subjected to the 'treatment' condition, and samples subjected to the 'control' condition.

Usage

## S3 method for class 'COMPASSResult'
plot(x, y, subset = NULL, threshold = 0.01,
  minimum_dof = 1, maximum_dof = Inf, must_express = NULL,
  row_annotation, palette = colorRampPalette(brewer.pal(10,
  "Purples"))(20), show_rownames = FALSE, show_colnames = FALSE,
  measure = NULL, order_by = FunctionalityScore,
  order_by_max_functionality = TRUE, markers = NULL, ...)

Arguments

x

An object of class COMPASSResult.

y

This argument gets passed to row_annotation, if row_annotation is missing. It can be used to group rows (individuals) by different conditions as defined in the metadata.

subset

An R expression, evaluated within the metadata, used to determine which individuals should be kept.

threshold

A numeric threshold for filtering under-expressed categories. Any categories with mean score < threshold are removed.

minimum_dof

The minimum degree of functionality for the categories to be plotted.

maximum_dof

The maximum degree of functionality for the categories to be plotted.

must_express

A character vector of markers that should be included in each subset plotted. For example, must_express=c("TNFa & IFNg") says we include only subsets that are positive for both TNFa or IFNg, while must_express=c("TNFa", "IFNg") says we should keep subsets which are positive for either TNFa or IFNg.

row_annotation

A vector of names, pulled from the metadata, to be used for row annotation.

palette

The colour palette to be used.

show_rownames

Boolean; if TRUE we display row names (ie, the individual ids).

show_colnames

Boolean; if TRUE we display column names (ie, the column name associated with a cytokine; typically not needed)

measure

Optional. By default, we produce a heatmap of the mean gammas produced in a model fit. We can override this by supplying a matrix of suitable dimension as well; these can be generated with the Posterior* functions – see Posterior for examples.

order_by

Order rows within a group. This should be a function; e.g. FunctionalityScore, mean, median, and so on. Set this to NULL to preserve the original ordering of the data.

order_by_max_functionality

Order columns by functionality within each degree subset. to TRUE.

markers

specifies a subset of markers to plot. default is NULL, which means all markers.

...

Optional arguments passed to pheatmap.

Value

The plot as a grid object (grob). It can be redrawn with e.g. grid::grid.draw().

Examples

## visualize the mean probability of reponse
plot(CR)

## visualize the proportion of cells belonging to a category
plot(CR, measure=PosteriorPs(CR))

[Package COMPASS version 1.26.0 Index]