createSnapFromPmat: Create a snap object from cell-by-peak matrix

View source: R/snap-utilities.R

createSnapFromPmatR Documentation

Create a snap object from cell-by-peak matrix

Description

This function takes a cell-by-peak count matrix as input and returns a snap object.

Usage

createSnapFromPmat(mat, barcodes, peaks)

Arguments

mat

A sparse matrix

barcodes

Corresponding barcodes

peaks

A GRanges object for the genomic coordinates of peaks

Examples

library("GenomicRanges");
mat = Matrix(sample(0:10, 100, replace=TRUE),sparse=TRUE, ncol=5);
barcodes = paste("barcode", seq(nrow(mat)), sep=".");
chroms = c("chr1", "chr1", "chr1", "chr1", "chr1");
pos = c(1, 5001, 10001, 15001, 20001);
peaks = GRanges(chroms, IRanges(pos, pos+100));
x.sp = createSnapFromPmat(
mat, 
barcodes=barcodes,
peaks=peaks
);

r3fang/SnapATAC documentation built on March 29, 2022, 4:33 p.m.