View source: R/snap-utilities.R
| createSnapFromBmat | R Documentation | 
This function takes a cell-by-bin count matrix as input and returns a snap object.
createSnapFromBmat(mat, barcodes, bins)
| mat | A sparse matrix | 
| barcodes | Corresponding barcodes | 
| bins | A GenomicRanges object for the genomic coordinates of the bins | 
Return a snap object
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
);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.