plotExprsVsTxLength {scater} | R Documentation |
Plot mean expression values for all features in a SingleCellExperiment object against transcript length values.
This is deprecated in favour of directly using plotRowData
.
plotExprsVsTxLength(object, tx_length = "median_feat_eff_len", length_is_assay = FALSE, exprs_values = "logcounts", log2_values = FALSE, colour_by = NULL, shape_by = NULL, size_by = NULL, by_exprs_values = exprs_values, by_show_single = FALSE, xlab = "Median transcript length", show_exprs_sd = FALSE, ...)
object |
A SingleCellExperiment object. |
tx_length |
Transcript lengths for all features, to plot on the x-axis. If Alternatively, an AsIs vector or data.frame, see |
length_is_assay |
Logical scalar indicating whether |
exprs_values |
A string or integer scalar specifying which assay in |
log2_values |
Logical scalar, specifying whether the expression values be transformed to the log2-scale for plotting (with an offset of 1 to avoid logging zeroes). |
colour_by |
Specification of a row metadata field or a sample to colour by, see |
shape_by |
Specification of a row metadata field or a sample to shape by, see |
size_by |
Specification of a row metadata field or a sample to size by, see |
by_exprs_values |
A string or integer scalar specifying which assay to obtain expression values from,
for use in point aesthetics - see |
by_show_single |
Deprecated and ignored. |
xlab |
String specifying the label for x-axis. |
show_exprs_sd |
Logical scalar indicating whether the standard deviation of expression values for each feature should be plotted. |
... |
Additional arguments for visualization, see |
If length_is_assay=TRUE
, the median transcript length of each feature across all cells is used.
This may be necessary if the effective transcript length differs across cells, e.g., as observed in the results from pseudo-aligners.
A ggplot object.
Davis McCarthy, with modifications by Aaron Lun
example_sce <- mockSCE() rowData(example_sce) <- DataFrame(gene_id = rownames(example_sce), feature_id = paste("feature", rep(1:500, each = 4), sep = "_"), median_tx_length = rnorm(2000, mean = 5000, sd = 500), other = sample(LETTERS, 2000, replace = TRUE) ) example_sce <- logNormCounts(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, colour_by = "other", 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, length_is_assay = TRUE, show_exprs_sd = TRUE) ## using a vector of tx length values plotExprsVsTxLength(example_sce, data.frame(rnorm(2000, mean = 5000, sd = 500)))