plotExprsVsTxLength {scater} | R Documentation |
Plot expression values from an SingleCellExperiment
object
against transcript length values defined in the SingleCellExperiment object
or supplied as an argument.
plotExprsVsTxLength(object, tx_length = "median_feat_eff_len", exprs_values = "logcounts", 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)
object |
an |
tx_length |
transcript lengths to plot on the x-axis. Can be one of: (1)
the name of a column of |
exprs_values |
character string indicating which values should be used
as the expression values for this plot. Valid arguments are |
colour_by |
optional character string supplying name of a column of
|
shape_by |
optional character string supplying name of a column of
|
size_by |
optional character string supplying name of a column of
|
xlab |
label for x-axis; if |
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
|
se |
logical, should standard errors be shown (default |
a ggplot object
data("sc_example_counts") data("sc_example_cell_info") rd <- DataFrame(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(rd) <- rownames(sc_example_counts) example_sce <- SingleCellExperiment( assays = list(counts = sc_example_counts), colData = sc_example_cell_info, rowData = rd) example_sce <- normalize(example_sce) plotExprsVsTxLength(example_sce, "median_tx_length") plotExprsVsTxLength(example_sce, "median_tx_length", show_smooth = TRUE) plotExprsVsTxLength(example_sce, "median_tx_length", show_smooth = TRUE, show_exprs_sd = TRUE) ## using matrix of tx length values in assays(object) mat <- matrix(rnorm(ncol(example_sce) * nrow(example_sce), mean = 5000, sd = 500), nrow = nrow(example_sce)) dimnames(mat) <- dimnames(example_sce) assay(example_sce, "tx_len") <- mat plotExprsVsTxLength(example_sce, "tx_len", show_smooth = TRUE, show_exprs_sd = TRUE) ## using a vector of tx length values plotExprsVsTxLength(example_sce, rnorm(2000, mean = 5000, sd = 500))