Skip to contents

Emits one bedGraph per group giving the insertion count at each base. Used for visualization, QC, and comparing observed signal against model predictions.

Usage

write_pseudobulk_coverage(
  pb,
  dir,
  insertion_mode = c("both", "start_only", "end_only"),
  normalization = c("none", "cpm", "n_cells"),
  tile_width = 1L,
  shift_start = 0L,
  shift_end = 0L,
  chrom_sizes = NULL,
  verbose = getOption("MarchR.verbose", FALSE)
)

Arguments

pb

(MarchRPseudobulk) Output of pseudobulk_fragments().

dir

(character) Output directory. Files land in <dir>/coverage/.

insertion_mode

(character) Fragment ends to count. One of "both", "start_only", "end_only". Default "both".

normalization

(character) One of "none", "cpm", "n_cells". Default "none".

tile_width

(integer) Bin width for summing insertions. Requires chrom_sizes when above 1. Default 1L.

shift_start

(integer) Basepairs to shift fragment starts. Default 0L.

shift_end

(integer) Basepairs to shift fragment ends. Default 0L.

chrom_sizes

(data.frame or NULL) Chromosome sizes for clipping tiles. Default NULL.

verbose

(logical) Print progress messages. Default getOption("MarchR.verbose", FALSE).

Value

pb with a coverage_path column added to its manifest.

Details

normalization = "none" is the default because count-based models expect raw integer insertion counts; scaling produces non-integer values they cannot consume.

All groups are written in a single pass over the fragments. The grouping factor is handed to the writer rather than iterating pb$fragments, which would rescan the fragments once per group.