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