Skip to content
Snippets Groups Projects
Commit 712fe45c authored by Luke Zappia's avatar Luke Zappia
Browse files

Add mfaEstimate

parent d173ae09
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,8 @@ S3method(lun2Estimate,SingleCellExperiment) ...@@ -4,6 +4,8 @@ S3method(lun2Estimate,SingleCellExperiment)
S3method(lun2Estimate,matrix) S3method(lun2Estimate,matrix)
S3method(lunEstimate,SingleCellExperiment) S3method(lunEstimate,SingleCellExperiment)
S3method(lunEstimate,matrix) S3method(lunEstimate,matrix)
S3method(mfaEstimate,SingleCellExperiment)
S3method(mfaEstimate,matrix)
S3method(scDDEstimate,SingleCellExperiment) S3method(scDDEstimate,SingleCellExperiment)
S3method(scDDEstimate,matrix) S3method(scDDEstimate,matrix)
S3method(simpleEstimate,SingleCellExperiment) S3method(simpleEstimate,SingleCellExperiment)
...@@ -23,6 +25,7 @@ export(lunSimulate) ...@@ -23,6 +25,7 @@ export(lunSimulate)
export(makeCompPanel) export(makeCompPanel)
export(makeDiffPanel) export(makeDiffPanel)
export(makeOverallPanel) export(makeOverallPanel)
export(mfaEstimate)
export(newLun2Params) export(newLun2Params)
export(newLunParams) export(newLunParams)
export(newMFAParams) export(newMFAParams)
......
#' Estimate mfa simulation parameters
#'
#' Estimate simulation parameters for the mfa simulation from a real dataset.
#'
#' @param counts either a counts matrix or a SingleCellExperiment object
#' containing count data to estimate parameters from.
#' @param params MFAParams object to store estimated values in.
#'
#' @details
#' The \code{nGenes} and \code{nCells} parameters are taken from the size of the
#' input data. The dropout lambda parameter is estimate using
#' \code{\link[mfa]{empirical_lambda}}. See \code{\link{MFAParams}} for more
#' details on the parameters.
#'
#' @return MFAParams object containing the estimated parameters.
#'
#' @examples
#' data("sc_example_counts")
#' params <- mfaEstimate(sc_example_counts)
#' params
#' @export
mfaEstimate <- function(counts, params = newMFAParams()) {
UseMethod("mfaEstimate")
}
#' @rdname mfaEstimate
#' @export
mfaEstimate.SingleCellExperiment <- function(counts,
params = newMFAParams()) {
counts <- BiocGenerics::counts(counts)
mfaEstimate(counts, params)
}
#' @rdname mfaEstimate
#' @export
mfaEstimate.matrix <- function(counts, params = newMFAParams()) {
checkmate::assertClass(params, "MFAParams")
dropout.lambda <- mfa::empirical_lambda(t(counts))
params <- setParams(params, nGenes = nrow(counts), nCells = ncol(counts),
dropout.lambda = dropout.lambda)
return(params)
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mfa-estimate.R
\name{mfaEstimate}
\alias{mfaEstimate}
\alias{mfaEstimate.SingleCellExperiment}
\alias{mfaEstimate.matrix}
\title{Estimate mfa simulation parameters}
\usage{
mfaEstimate(counts, params = newMFAParams())
\method{mfaEstimate}{SingleCellExperiment}(counts, params = newMFAParams())
\method{mfaEstimate}{matrix}(counts, params = newMFAParams())
}
\arguments{
\item{counts}{either a counts matrix or a SingleCellExperiment object
containing count data to estimate parameters from.}
\item{params}{MFAParams object to store estimated values in.}
}
\value{
MFAParams object containing the estimated parameters.
}
\description{
Estimate simulation parameters for the mfa simulation from a real dataset.
}
\details{
The \code{nGenes} and \code{nCells} parameters are taken from the size of the
input data. The dropout lambda parameter is estimate using
\code{\link[mfa]{empirical_lambda}}. See \code{\link{MFAParams}} for more
details on the parameters.
}
\examples{
data("sc_example_counts")
params <- mfaEstimate(sc_example_counts)
params
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment