plot_biplot: Biplot of expression data

Description Usage Arguments Details Value Author(s) Examples

View source: R/plot.R

Description

Produce a ggplot object containing a biplot of expression data.

Usage

1
2
3
4
5
6
7
8
plot_biplot(
  x,
  sample_labels = NULL,
  feature_labels = NULL,
  n_features = 20,
  balance = 0.25,
  text_size = 0.025
)

Arguments

x

Matrix of expression levels, with features (eg genes) as rows and samples as columns. For example, you could use the output of varistran::vst here.

sample_labels

Sample labels.

feature_labels

Feature labels.

n_features

Number of extreme features to label.

balance

Relative scaling of features and samples.

text_size

plot_biplot attempts to stop labels from overlapping. Adjust this so that text just doesn't overlap. Set to zero to allow labels to completely overlap.

Details

Biplot based on the Singular Value Decomposition of the matrix x, after subtracting row means. The dimensions corresponding to the two largest singular values are shown.

Genes are shown in blue and samples in red.

The dot product of the gene and sample vectors approximates the difference from the average expression level of that gene in that sample.

Sample points (red) are scaled to have the same variance in the two dimensions. Therefore the gene points (blue) may have greater variance along dimension 1 if dimension 1 explains more of the variance than dimension 2.

Value

A ggplot object.

This must be print()-ed to actually plot.

Author(s)

Paul Harrison

Examples

1
2
3
4
5
# Generate some random data.
counts <- matrix(rnbinom(1000, size=1/0.01, mu=100), ncol=10)

y <- varistran::vst(counts)
print( varistran::plot_biplot(y) )

MonashBioinformaticsPlatform/varistran documentation built on March 21, 2020, 3:20 p.m.