Skip to contents

Computes gene activity scores using ArchR's distance-weighted model. Wraps BPCells::gene_score_archr(). See that function for algorithmic details.

Usage

# S3 method for class 'MarchRDataset'
add_gene_score_matrix(
  proj,
  frags_name = NULL,
  output_assay_name = "GeneScoreMatrix",
  genome = NULL,
  genes = NULL,
  gene_name_column = "gene_name",
  blacklist = TRUE,
  chrom_sizes = NULL,
  exclude_chr = c("chrY", "chrM"),
  tile_width = 500,
  tile_max_count = 4,
  scale_factor = 10000,
  addArchRBug = FALSE,
  overwrite = FALSE,
  return_matrix = FALSE
)

# S3 method for class 'MarchRProject'
add_gene_score_matrix(
  proj,
  frags_name = NULL,
  dataset_names = character(0),
  output_assay_name = "GeneScoreMatrix",
  genes = NULL,
  gene_name_column = "gene_name",
  blacklist = TRUE,
  chrom_sizes = NULL,
  exclude_chr = c("chrY", "chrM"),
  tile_width = 500,
  tile_max_count = 4,
  scale_factor = 10000,
  addArchRBug = FALSE,
  overwrite = FALSE,
  return_matrix = FALSE
)

Arguments

proj

(MarchRProject or MarchRDataset) Object containing fragments.

frags_name

(character) Fragment assay name. Auto-selected if only one exists.

output_assay_name

(character) Assay name for gene scores. Default: "GeneScoreMatrix".

genome

(Genome; optional) Genome object for gene annotations, chromosome sizes, and blacklist. Required for MarchRDataset when these are not provided explicitly.

genes

(data.frame; optional) Gene coordinates with columns chr, start, end, strand, and a gene name column. If not provided, uses the stored "genes" annotations from genome/project.

gene_name_column

(character) Column in genes for gene names. Default: "gene_name".

blacklist

(logical, data.frame, or GRanges) Blacklist regions. TRUE retrieves from genome/project; FALSE skips.

chrom_sizes

(data.frame; optional) Chromosome sizes. If not provided, uses genome/project chromosome sizes.

exclude_chr

(character) Chromosomes to exclude. Default: c("chrY", "chrM").

tile_width

(numeric) Tile width for binning insertions. Default: 500.

tile_max_count

(numeric) Per-tile count ceiling. Default: 4.

scale_factor

(numeric) Depth normalization factor. Default: 10000.

addArchRBug

(logical) Replicate ArchR's nested gene handling. Default: FALSE. See BPCells::gene_score_weights_archr().

overwrite

(logical) Overwrite existing assay. Default: FALSE.

return_matrix

(logical) If TRUE, returns the matrix directly.

dataset_names

(character) Datasets to compute gene scores for. Defaults to all datasets with fragments.

Value

Modified object with gene score assay, or a lazy IterableMatrix (or named list for MarchRProject) if return_matrix = TRUE.