plotExprsVsTxLength: Plot expression against transcript length

Description Usage Arguments Value Examples

View source: R/plotting.R

Description

Plot expression values from an SCESet object against transcript length values defined in the SCESet object or supplied as an argument.

Usage

1
2
3
4
5
plotExprsVsTxLength(object, tx_length = "median_feat_eff_len",
  exprs_values = "exprs", colour_by = NULL, shape_by = NULL,
  size_by = NULL, xlab = NULL, show_exprs_sd = FALSE,
  show_smooth = FALSE, alpha = 0.6, theme_size = 10,
  log2_values = FALSE, size = NULL, se = TRUE)

Arguments

object

an SCESet object

tx_length

transcript lengths to plot on the x-axis. Can be one of: (1) the name of a column of fData(object) containing the transcript length values, or (2) the name of an element of assayData(object) containing a matrix of transcript length values, or (3) a numeric vector of length equal to the number of rows of object (number of features).

exprs_values

character string indicating which values should be used as the expression values for this plot. Valid arguments are "tpm" (transcripts per million), "norm_tpm" (normalised TPM values), "fpkm" (FPKM values), "norm_fpkm" (normalised FPKM values), "counts" (counts for each feature), "norm_counts", "cpm" (counts-per-million), "norm_cpm" (normalised counts-per-million), "exprs" (whatever is in the 'exprs' slot of the SCESet object; default), "norm_exprs" (normalised expression values) or "stand_exprs" (standardised expression values) or any other slots that have been added to the "assayData" slot by the user.

colour_by

optional character string supplying name of a column of fData(object) which will be used as a variable by which to colour expression values on the plot. Alternatively, a data frame with one column, containing a value for each feature to map to a colour.

shape_by

optional character string supplying name of a column of fData(object) which will be used as a variable to define the shape of points for expression values on the plot. Alternatively, a data frame with one column containing values to map to shapes.

size_by

optional character string supplying name of a column of fData(object) which will be used as a variable to define the size of points for expression values on the plot. Alternatively, a data frame with one column containing values to map to sizes.

xlab

label for x-axis; if NULL (default), then x will be used as the x-axis label

show_exprs_sd

logical, show the standard deviation of expression values for each feature on the plot

show_smooth

logical, show a smoothed fit through the expression values on the plot

alpha

numeric value between 0 (completely transparent) and 1 (completely solid) defining how transparent plotted points (cells) should be. Points are jittered horizontally if the x-axis value is categorical rather than numeric to avoid overplotting.

theme_size

numeric scalar giving default font size for plotting theme (default is 10)

log2_values

should the expression values be transformed to the log2-scale for plotting (with an offset of 1 to avoid logging zeroes)?

size

numeric scalar optionally providing size for points if size_by argument is not given. Default is NULL, in which case ggplot2 default is used.

se

logical, should standard errors be shown (default TRUE) for the smoothed fit through the cells. (Ignored if show_smooth is FALSE).

Value

a ggplot object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
data("sc_example_counts")
data("sc_example_cell_info")
pd <- new("AnnotatedDataFrame", data = sc_example_cell_info)
fd <- new("AnnotatedDataFrame", data =
data.frame(gene_id = rownames(sc_example_counts),
        feature_id = paste("feature", rep(1:500, each = 4), sep = "_"),
     median_tx_length = rnorm(2000, mean = 5000, sd = 500)))
rownames(fd) <- rownames(sc_example_counts)
example_sceset <- newSCESet(countData = sc_example_counts, phenoData = pd,
featureData = fd)

plotExprsVsTxLength(example_sceset, "median_tx_length")
plotExprsVsTxLength(example_sceset, "median_tx_length", show_smooth = TRUE)
plotExprsVsTxLength(example_sceset, "median_tx_length", show_smooth = TRUE,
show_exprs_sd = TRUE)

## using matrix of tx length values in assayData(object)
mat <- matrix(rnorm(ncol(example_sceset) * nrow(example_sceset), mean = 5000,
 sd = 500), nrow = nrow(example_sceset))
dimnames(mat) <- dimnames(example_sceset)
set_exprs(example_sceset, "tx_len") <- mat

plotExprsVsTxLength(example_sceset, "tx_len", show_smooth = TRUE,
show_exprs_sd = TRUE)

## using a vector of tx length values
plotExprsVsTxLength(example_sceset, rnorm(2000, mean = 5000, sd = 500))

dynverse/scaterlegacy documentation built on Feb. 17, 2020, 5:07 a.m.