plot_percent_cells_positive: Plots the number of cells expressing one or more genes above...

plot_percent_cells_positiveR Documentation

Plots the number of cells expressing one or more genes above a given value as a barplot

Description

@description Accepts a subset cell_data_set and the parameter group_cells_by, used for dividing cells into groups. Returns one or more bar graphs (one graph for each gene in the cell_data_set). Each graph shows the percentage (or number) of cells that express a gene in each sub-group in the cell_data_set.

Usage

plot_percent_cells_positive(
  cds_subset,
  group_cells_by = NULL,
  min_expr = 0,
  nrow = NULL,
  ncol = 1,
  panel_order = NULL,
  plot_as_count = FALSE,
  label_by_short_name = TRUE,
  normalize = TRUE,
  plot_limits = NULL,
  bootstrap_samples = 100,
  conf_int_alpha = 0.95
)

Arguments

cds_subset

Subset cell_data_set to be plotted.

group_cells_by

the cell attribute (e.g. the column of colData(cds)) to group cells by on the horizontal axis. If NULL, all cells plotted as one group.

min_expr

the minimum (untransformed) expression level to consider the gene 'expressed'. Default is 0.

nrow

the number of panels per row in the figure.

ncol

the number of panels per column in the figure.

panel_order

the order in which genes should be laid out (left-to-right, top-to-bottom). Should be gene_short_name if label_by_short_name = TRUE or feature ID if label_by_short_name = FALSE.

plot_as_count

Logical, whether to plot as a count of cells rather than a percent. Default is FALSE.

label_by_short_name

label figure panels by gene_short_name (TRUE) or feature id (FALSE). Default is TRUE.

normalize

Logical, whether or not to normalize expression by size factor. Default is TRUE.

plot_limits

A pair of number specifying the limits of the y axis. If NULL, scale to the range of the data. Example c(0,100).

bootstrap_samples

The number of bootstrap replicates to generate when plotting error bars. Default is 100.

conf_int_alpha

The size of the confidence interval to use when plotting error bars. Default is 0.95.

Value

a ggplot2 plot object

Examples

  
    cds <- load_a549()
    cds_subset <- cds[row.names(subset(rowData(cds),
                                      gene_short_name %in% c("NDRG4", "HBG2"))),]
    plot_percent_cells_positive(cds_subset, group_cells_by="culture_plate")
  


cole-trapnell-lab/monocle3 documentation built on March 27, 2024, 8:59 a.m.