Skip to contents

Plot a pseudobulk genome track, showing the number of fragment insertions across a region.

Usage

trackplot_bulk(
  fragments,
  region,
  groups,
  cell_read_counts,
  group_order = NULL,
  bins = 200,
  clip_quantile = 0.999,
  colors = discrete_palette("stallion"),
  legend_label = "group",
  zero_based_coords = !is(region, "GRanges"),
  return_data = FALSE,
  return_plot_list = FALSE,
  apply_styling = TRUE
)

Arguments

fragments

Fragments object

region

GRanges of length 1 with region to plot, or list/data.frame with one entry each for chr, start, end. See gene_region() or genomic-ranges 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

Custom label to put on the legend

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.

return_plot_list

If TRUE, return multiple plots as a list, rather than a single plot combined using patchwork::wrap_plots()

apply_styling

If false, return a plot without pretty styling applied

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.