Skip to contents

Plot a pseudobulk genome track, showing the number of fragment insertions across a region for each cell type or group.

Usage

trackplot_coverage(
  fragments,
  region,
  groups,
  cell_read_counts,
  group_order = NULL,
  bins = 500,
  clip_quantile = 0.999,
  colors = discrete_palette("stallion"),
  legend_label = NULL,
  zero_based_coords = !is(region, "GRanges"),
  return_data = FALSE
)

Arguments

fragments

Fragments object

region

Region to plot, e.g. output from gene_region(). String of format "chr1:100-200", or list/data.frame/GRanges of length 1 specifying chr, start, end. See help("genomic-ranges-like") for details

groups

Vector with one entry per cell, specifying the cell's group

cell_read_counts

Numeric vector of read counts for each cell (used for normalization)

group_order

Optional vector listing ordering of groups

bins

Number of bins to plot across the region

clip_quantile

(optional) Quantile of values for clipping y-axis limits. Default of 0.999 will crop out just the most extreme outliers across the region. NULL to disable clipping

colors

Character vector of color values (optionally named by group)

legend_label

[Deprecated] Custom label to put on the legend (no longer used as color legend is not shown anymore)

zero_based_coords

Whether to convert the ranges from a 1-based end-inclusive coordinate system to a 0-based end-exclusive coordinate system. Defaults to true for GRanges and false for other formats (see this archived UCSC blogpost)

return_data

If true, return data from just before plotting rather than a plot.

scale_bar

Whether to include a scale bar in the top track (TRUE or FALSE)

Value

Returns a combined plot of pseudobulk genome tracks. For compatability with draw_trackplot_grid(), the extra attribute $patches$labels will be added to specify the labels for each track. If return_data or return_plot_list is TRUE, the return value will be modified accordingly.