createSnapFromBmat: Create a snap object from cell-by-bin matrix

View source: R/snap-utilities.R

createSnapFromBmatR Documentation

Create a snap object from cell-by-bin matrix

Description

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

Usage

createSnapFromBmat(mat, barcodes, bins)

Arguments

mat

A sparse matrix

barcodes

Corresponding barcodes

bins

A GenomicRanges object for the genomic coordinates of the bins

Value

Return a snap object

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);
bins = GRanges(chroms, IRanges(pos, pos+5000));
x.sp = createSnapFromBmat(
mat, 
barcodes=barcodes,
bins=bins
);

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