bpcells.experimental.precalculate_insertion_counts#

bpcells.experimental.precalculate_insertion_counts(fragments: str, output_dir: str, cell_groups: Sequence[int], chrom_sizes: str | Dict[str, int], threads: int = 0)[source]#

Precalculate per-base insertion counts from fragment data

The current implementation is EXPERIMENTAL, and will crash for matrices with more than 2^32-1 non-zero entries.

Parameters:
  • fragments (str) – Path to a BPCells fragments directory

  • output_dir (str) – Path to save the insertion counts in

  • cell_groups (list[int]) – List of pseudbulk groupings as created by build_cell_groups()

  • chrom_sizes (str | dict[str, int]) – Path/URL of UCSC-style chrom.sizes file, or dictionary mapping chromosome names to sizes

  • threads (int) – Number of threads to use during matrix calculation (default = 1)

Returns:

A PrecalculatedInsertionMatrix object