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

Add MFAParams

parent 4d70c34c
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,8 @@ Suggests:
rmarkdown,
S4Vectors,
scDD,
scran
scran,
mfa
biocViews: SingleCell, RNASeq, Transcriptomics, GeneExpression, Sequencing,
Software
URL: https://github.com/Oshlack/splatter
......
......@@ -25,6 +25,7 @@ export(makeDiffPanel)
export(makeOverallPanel)
export(newLun2Params)
export(newLunParams)
export(newMFAParams)
export(newSCDDParams)
export(newSimpleParams)
export(newSplatParams)
......@@ -42,6 +43,7 @@ export(splatSimulateSingle)
export(summariseDiff)
exportClasses(Lun2Params)
exportClasses(LunParams)
exportClasses(MFAParams)
exportClasses(SCDDParams)
exportClasses(SimpleParams)
exportClasses(SplatParams)
......
......@@ -7,12 +7,12 @@
#' The Params class defines the following parameters:
#'
#' \describe{
#' \item{\code{[nGenes]}}{The number of genes to simulate.}
#' \item{\code{[nCells]}}{The number of cells to simulate.}
#' \item{\code{seed}}{Seed to use for generating random numbers.}
#' \item{\code{nGenes}}{The number of genes to simulate.}
#' \item{\code{nCells}}{The number of cells to simulate.}
#' \item{\code{[seed]}}{Seed to use for generating random numbers.}
#' }
#'
#' The parameters shown in brackets can be estimated from real data.
#' The parameters not shown in brackets can be estimated from real data.
#'
#' @name Params
#' @rdname Params
......@@ -460,3 +460,43 @@ setClass("SCDDParams",
modeFC = c(2, 3, 4),
varInflation = c(1, 1),
condition = "condition"))
#' The MFAParams class
#'
#' S4 class that holds parameters for the mfa simulation.
#'
#' @section Parameters:
#'
#' The mfa simulation uses the following parameters:
#'
#' \describe{
#' \item{\code{nGenes}}{The number of genes to simulate.}
#' \item{\code{nCells}}{The number of cells to simulate.}
#' \item{\code{[seed]}}{Seed to use for generating random numbers.}
#' \item{\code{[trans.prop]}}{Proportion of genes that show transient
#' expression. These genes are briefly up or down-regulated before returning
#' to their initial state}
#' \item{\code{[zero.neg]}}{Logical. Whether to set negative expression
#' values to zero. This will zero-inflate the data.}
#' \item{\code{[dropout.present]}}{Logical. Whether to simulate dropout.}
#' \item{\code{dropout.lambda}}{Lambda parameter for the exponential
#' dropout function.}
#' }
#'
#' The parameters not shown in brackets can be estimated from real data using
#' \code{\link{mfaEstimate}}. See \code{\link[mfa]{create_synthetic}} for more
#' details about the parameters. For details of the Splatter implementation of
#' the mfa simulation see \code{\link{mfaSimulate}}.
#'
#' @name MFAParams
#' @rdname MFAParams
#' @aliases MFAParams-class
#' @exportClass MFAParams
setClass("MFAParams",
contains = "Params",
slots = c(trans.prop = "numeric",
zero.neg = "logical",
dropout.present = "logical",
dropout.lambda = "numeric"),
prototype = prototype(trans.prop = 0, zero.neg = TRUE,
dropout.present = FALSE, dropout.lambda = 1))
#' @rdname newParams
#' @importFrom methods new
#' @export
newMFAParams <- function(...) {
if (!requireNamespace("mfa", quietly = TRUE)) {
stop("The mfa simulation requires the 'mfa' package.")
}
params <- new("MFAParams")
params <- setParams(params, ...)
return(params)
}
setValidity("MFAParams", function(object) {
v <- getParams(object, slotNames(object))
checks <- c(nGenes = checkmate::checkInt(v$nGenes, lower = 1),
nCells = checkmate::checkInt(v$nCells, lower = 1),
trans.prop = checkmate::checkNumber(v$trans.prop, lower = 0,
upper = 1),
zero.neg = checkmate::checkLogical(v$zero.neg,
any.missing = FALSE,
len = 1),
dropout.present = checkmate::checkLogical(v$dropout.present,
any.missing = FALSE,
len = 1),
dropout.lambda = checkmate::checkNumber(v$dropout.lambda),
seed = checkmate::checkInt(v$seed, lower = 0))
if (all(checks == TRUE)) {
valid <- TRUE
} else {
valid <- checks[checks != TRUE]
valid <- paste(names(valid), valid, sep = ": ")
}
return(valid)
})
setMethod("show", "MFAParams", function(object) {
pp <- list("Transient:" = c("[Proportion]" = "trans.prop"),
"Negative:" = c("[Zero]" = "zero.neg"),
"Dropout:" = c("[Present]" = "dropout.present",
"(Lambda)" = "dropout.lambda"))
callNextMethod()
showPP(object, pp)
})
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AllClasses.R
\docType{class}
\name{MFAParams}
\alias{MFAParams}
\alias{MFAParams-class}
\title{The MFAParams class}
\description{
S4 class that holds parameters for the mfa simulation.
}
\section{Parameters}{
The mfa simulation uses the following parameters:
\describe{
\item{\code{nGenes}}{The number of genes to simulate.}
\item{\code{nCells}}{The number of cells to simulate.}
\item{\code{[seed]}}{Seed to use for generating random numbers.}
\item{\code{[trans.prop]}}{Proportion of genes that show transient
expression. These genes are briefly up or down-regulated before returning
to their initial state}
\item{\code{[zero.neg]}}{Logical. Whether to set negative expression
values to zero. This will zero-inflate the data.}
\item{\code{[dropout.present]}}{Logical. Whether to simulate dropout.}
\item{\code{dropout.lambda}}{Lambda parameter for the exponential
dropout function.}
}
The parameters not shown in brackets can be estimated from real data using
\code{\link{mfaEstimate}}. See \code{\link[mfa]{create_synthetic}} for more
details about the parameters. For details of the Splatter implementation of
the mfa simulation see \code{\link{mfaSimulate}}.
}
......@@ -14,11 +14,11 @@ Virtual S4 class that all other Params classes inherit from.
The Params class defines the following parameters:
\describe{
\item{\code{[nGenes]}}{The number of genes to simulate.}
\item{\code{[nCells]}}{The number of cells to simulate.}
\item{\code{seed}}{Seed to use for generating random numbers.}
\item{\code{nGenes}}{The number of genes to simulate.}
\item{\code{nCells}}{The number of cells to simulate.}
\item{\code{[seed]}}{Seed to use for generating random numbers.}
}
The parameters shown in brackets can be estimated from real data.
The parameters not shown in brackets can be estimated from real data.
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AllGenerics.R, R/Lun2Params-methods.R,
% R/LunParams-methods.R, R/SCDDParams-methods.R, R/SimpleParams-methods.R,
% R/SplatParams-methods.R
% R/LunParams-methods.R, R/MFAParams-methods.R, R/SCDDParams-methods.R,
% R/SimpleParams-methods.R, R/SplatParams-methods.R
\name{newParams}
\alias{newParams}
\alias{newLun2Params}
\alias{newLunParams}
\alias{newMFAParams}
\alias{newSCDDParams}
\alias{newSimpleParams}
\alias{newSplatParams}
......@@ -15,6 +16,8 @@ newLun2Params(...)
newLunParams(...)
newMFAParams(...)
newSCDDParams(...)
newSimpleParams(...)
......
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