Construct a feature x cell matrix from a genomic fragments file

FeatureMatrix(
  fragments,
  features,
  cells = NULL,
  chunk = 50,
  sep = c("-", "-"),
  verbose = TRUE
)

Arguments

fragments

Path to tabix-indexed fragments file

features

A GRanges object containing a set of genomic intervals. These will form the rows of the matrix, with each entry recording the number of unique reads falling in the genomic region for each cell.

cells

Vector of cells to include. If NULL, include all cells found in the fragments file

chunk

Number of chunks to use when processing the fragments file. Fewer chunks may enable faster processing, but will use more memory.

sep

Vector of separators to use for genomic string. First element is used to separate chromosome and coordinates, second separator is used to separate start and end coordinates.

verbose

Display messages

Value

Returns a sparse matrix

Examples

fpath <- system.file("extdata", "fragments.tsv.gz", package="Signac") FeatureMatrix( fragments = fpath, features = StringToGRanges(rownames(atac_small), sep = c(":", "-")) )
#> Extracting reads overlapping genomic regions
#> Constructing matrix
#> 5 x 51 sparse Matrix of class "dgCMatrix"
#> [[ suppressing 51 column names ‘AAACTGCAGTCTGTGT-1’, ‘AAACTCGCAGCGTCGT-1’, ‘AAACGAAGTGCCCGAT-1’ ... ]]
#> #> chr1-565107-565550 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> chr1-713460-714823 . 1 1 1 1 2 1 3 4 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 #> chr1-752422-753038 . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . #> chr1-762106-763359 . . . . . . 1 . 1 . . 1 1 1 . . . . . . 1 . . 1 . 2 . . . 1 #> chr1-779589-780271 . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . #> #> chr1-565107-565550 . . . . . . . . . . . . . . . . . . . . . #> chr1-713460-714823 1 2 1 1 . . . . . . . . . . . . . . . . . #> chr1-752422-753038 . . . . 1 1 1 1 1 1 1 . . . . . . . . . . #> chr1-762106-763359 . . . . 2 . 1 . . 1 . 1 1 1 1 1 1 1 1 1 1 #> chr1-779589-780271 . 1 . . . . . . . . . . . . . . . . . . .