% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gene_expression.R, R/generics.R
\name{scExpMat.default}
\alias{scExpMat.default}
\alias{scExpMat.Seurat}
\alias{scExpMat.SingleCellExperiment}
\alias{scExpMat.dgCMatrix}
\alias{scExpMat.matrix}
\alias{scExpMat}
\title{Extracts the expression matrix from object.}
\usage{
\method{scExpMat}{default}(scObj, slot = NULL, genes = NULL, densify = TRUE)

\method{scExpMat}{Seurat}(scObj, slot = "data", genes = NULL, densify = TRUE)

\method{scExpMat}{SingleCellExperiment}(scObj, slot = "logcounts", genes = NULL, densify = TRUE)

\method{scExpMat}{dgCMatrix}(scObj, slot = NULL, genes = NULL, densify = TRUE)

\method{scExpMat}{matrix}(scObj, slot = NULL, genes = NULL, densify = TRUE)

scExpMat(scObj, slot, genes = NULL, densify = TRUE)
}
\arguments{
\item{scObj}{A \code{Seurat}, \code{SingleCellExperiment},
\code{dgCMatrix} or \code{matrix} object.}

\item{slot}{Gene expression slot. Ignored if \code{scObj} is of class
\code{dgCMatrix} or \code{matrix}.}

\item{genes}{Selected genes. If \code{NULL}, all genes will be retained.}

\item{densify}{Whether to convert to dense matrix.}
}
\value{
An expression matrix.
}
\description{
This function extracts an expression matrix from a \code{Seurat} or
\code{SingleCellExperiment} object. For additional flexibility, the input
can alternatively be provided as a \code{dgCMatrix} object
(and an option to densify it is also available) or as a \code{matrix}
object.
}
\examples{
scePath <- system.file('extdata', 'sceObj.qs2', package='scLang')
sceObj <- qs2::qs_read(scePath)
mat <- scExpMat(sceObj, 'counts')

}
