% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/snap-utilities.R
\name{createSnapFromPmat}
\alias{createSnapFromPmat}
\title{Create a snap object from cell-by-peak matrix}
\usage{
createSnapFromPmat(mat, barcodes, peaks)
}
\arguments{
\item{mat}{A sparse matrix}

\item{barcodes}{Corresponding barcodes}

\item{peaks}{A GRanges object for the genomic coordinates of peaks}
}
\description{
This function takes a cell-by-peak count matrix as input and returns 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);
peaks = GRanges(chroms, IRanges(pos, pos+100));
x.sp = createSnapFromPmat(
mat, 
barcodes=barcodes,
peaks=peaks
);
}
