Skip to contents

Create an ScPeaks,McPeaks object from matrix and peaks

Usage

import_from_matrix(
  mat,
  peaks,
  genome,
  id = NULL,
  description = NULL,
  metadata = NULL,
  class = "ScPeaks",
  rm_zero_peaks = TRUE,
  tad_based = TRUE,
  zero_based = FALSE,
  mc_size_eps_q = 0.1
)

Arguments

mat

a matrix/sparse matrix of counts

peaks

an intervals set where each row corresponds to a row in mat. Can contain an additional column named 'peak_name' with peak names, in which case the rownames of mat are expected to equal to this column.

genome

genome assembly of the peaks. e.g. "hg38", "hg19", "mm9", "mm10"

id

an identifier for the object, e.g. "pbmc". If NULL - a random id would be assigned.

description

(Optional) description of the object, e.g. "PBMC from a healthy donor - granulocytes removed through cell sorting (10k)".

metadata

(Optional) data frame with a column called 'metacell' and additional metacell annotations, or the name of a delimited file which contains such annotations.

class

should the output object be a ScPeaks or McPeaks

rm_zero_peaks

remove peaks without any reads (all-zero peaks). Default: TRUE

tad_based

whether to name peaks based on TADs if possible (when an intervals set named "intervs.global.tad_names" exists). When FALSE - peaks are named based on their coordinates.

zero_based

are the coordinates of the features 0-based? Note that when this is FALSE (default) the coordinates of the created object would be different from the ones in features_fn by 1 bp.

mc_size_eps_q

(optional) quantile of MC size (in UMIs) to scale the number of UMIs per metacell. \(egc_ij\) would then be the fraction of peak i in metacell j multiplied by the mc_size_eps_q quantile of metacell sizes.

Examples

if (FALSE) {
atac_sc <- import_from_matrix(mat, peaks, genome = "hg38")
atac_mc <- import_from_matrix(mat, peaks, genome = "hg38", class = "McPeaks")
}