Skip to contents

Line plot of normalized Tn5 insertion enrichment around transcription start sites, grouped by dataset or cell group. Wraps BPCells::footprint() for computation and applies ArchR-style aesthetics by default.

Usage

plot_tss_profile(
  x,
  genes = NULL,
  group_by = "dataset_name",
  cell_groups = NULL,
  flank = 2000L,
  norm_width = 100L,
  smooth = 11L,
  style = c("ArchR", "BPCells"),
  colors = NULL,
  title = NULL,
  return_data = FALSE,
  ...
)

# S3 method for class 'IterableFragments'
plot_tss_profile(
  x,
  genes,
  cell_groups = rlang::rep_along(cellNames(x), "all"),
  flank = 2000L,
  norm_width = 100L,
  smooth = 11L,
  style = c("ArchR", "BPCells"),
  colors = NULL,
  title = NULL,
  return_data = FALSE,
  ...
)

# S3 method for class 'MarchRDataset'
plot_tss_profile(
  x,
  genes = NULL,
  cell_groups = NULL,
  frags_name = character(0),
  flank = 2000L,
  norm_width = 100L,
  smooth = 11L,
  style = c("ArchR", "BPCells"),
  colors = NULL,
  title = NULL,
  return_data = FALSE,
  ...
)

# S3 method for class 'MarchRProject'
plot_tss_profile(
  x,
  genes = NULL,
  group_by = "dataset_name",
  cell_groups = NULL,
  dataset_names = character(0),
  frags_name = character(0),
  flank = 2000L,
  norm_width = 100L,
  smooth = 11L,
  style = c("ArchR", "BPCells"),
  colors = NULL,
  title = NULL,
  return_data = FALSE,
  ...
)

Arguments

x

(IterableFragments | MarchRDataset | MarchRProject) Fragment source.

genes

Gene annotations with strand (data.frame or GRanges). Default extracted from project genome when NULL.

group_by

(character) Column name in cell metadata for grouping cells. Default "dataset_name". When set to "dataset_name", groups are derived from the project structure without requiring cell metadata. Ignored for IterableFragments method. (MarchRProject only.)

cell_groups

(character | factor) Direct cell-group assignment vector, overrides group_by. Length must match number of cells in x.

flank

(integer) Basepairs flanking TSS center. Default 2000.

norm_width

(integer) Basepairs at each flank edge used for normalization. Default 100 (matching ArchR).

smooth

(integer) Rolling mean window size in bp. Default 11. Set to 0 for no smoothing.

style

(character) "ArchR" or "BPCells". Default "ArchR".

colors

(character) Color vector for groups. Default uses palette_discrete().

title

(character) Plot title. NULL omits title.

return_data

(logical) If TRUE, return the data tibble instead of a plot. Default FALSE.

...

Additional arguments passed to BPCells::footprint().

frags_name

(character) Fragment name. Auto-selected if one per dataset.

dataset_names

(character) Dataset names to include (MarchRProject only). Default uses all datasets.

Value

A ggplot2 object, or a tibble if return_data = TRUE.

Details

ArchR equivalent: plotTSSEnrichment(). Computes per-position insertion counts in a flanking window around all TSS sites, normalizes by the mean signal at the window edges, and optionally smooths with a centered rolling mean. Groups are typically datasets but can be any cell grouping (clusters, conditions, etc.).

Absolute enrichment values will differ from ArchR due to differences in how BPCells::footprint() counts insertions internally. The relative signal shape and between-sample comparisons are equivalent for QC purposes.