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

Add lunEstimate function

parent 3dce282b
No related branches found
No related tags found
No related merge requests found
Package: splatter
Type: Package
Title: Simple Simulation of Single-cell RNA Sequencing Data
Version: 0.6.11
Version: 0.6.12
Date: 2016-10-14
Author: Luke Zappia
Authors@R: as.person(c(
......
......@@ -36,7 +36,7 @@ setMethod("show", "SimpleParams", function(object) {
"(Shape)" = "mean.shape"),
"Counts:" = c("[Dispersion]" = "count.disp"))
# Mean parameters aren't estiamated for the LunParams object which
# Mean parameters aren't estimated for the LunParams object which
# inherits from SimpleParams
if (class(object) == "LunParams") {
pp[["Mean:"]] <- c("[Rate]" = "mean.rate", "[Shape]" = "mean.shape")
......
#' Estimate Lun simulation parameters
#'
#' Estimate simulation parameters for the Lun simulation from a real dataset.
#'
#' @param counts either a counts matrix or an SCESet object containing count
#' data to estimate parameters from.
#' @param params LunParams object to store estimated values in.
#'
#' @details
#' The \code{nGenes} and \code{nCells} parameters are taken from the size of the
#' input data. No other parameters are estimated. See \code{\link{LunParams}}
#' for more details on the parameters.
#'
#' @return LunParams object containing the estimated parameters.
#'
#' @examples
#' data("sc_example_counts")
#' params <- lunEstimate(sc_example_counts)
#' params
#' @export
lunEstimate <- function(counts, params = newLunParams()) {
UseMethod("lunEstimate")
}
#' @rdname lunEstimate
#' @export
lunEstimate.SCESet <- function(counts, params = newLunParams()) {
counts <- scater::counts(counts)
lunEstimate(counts, params)
}
#' @rdname lunEstimate
#' @importFrom stats median
#' @export
lunEstimate.matrix <- function(counts, params = newLunParams()) {
checkmate::assertClass(params, "LunParams")
params <- setParams(params, nGenes = nrow(counts),
groupCells = ncol(counts))
return(params)
}
\ No newline at end of file
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