R/AllGenerics.R

##############################
## Base
###############################

##' Deprecated cell/feature data accessors/mutators
##'
##' These functions are now all deprecated and will be removed in a future release.
##'
##' @section Replacement Functions:
##' You should transition to use the following replacements:
##' \describe{
##'   \item{\code{cData}}{\link{colData}}
##'   \item{\code{fData}}{\link{mcols}}
##'   \item{\code{exprs}}{\link{assay}}
##'   \item{\code{combine}}{\link{cbind2} or \link{rbind2}}
##' }
##' @param sc An object with \code{cellData}
##' @return \code{DataFrame} or modifies the \code{SingleCellAssay} object in place
##' @details \code{cData(sc)}: Return the \code{cellData} \code{data.frame}.
##' @seealso exprs
##' @rdname cData
##' @examples
##' data(vbetaFA)
##' stopifnot(all.equal(hushWarning(cData(vbetaFA), 'deprecated'),colData(vbetaFA)))
##' stopifnot(all.equal(hushWarning(fData(vbetaFA), 'deprecated'), mcols(vbetaFA)))
##' stopifnot(all.equal(hushWarning(exprs(vbetaFA), 'deprecated'), t(assay(vbetaFA))))
##' @export
setGeneric('cData', function(sc) standardGeneric('cData'))

##' Accessor for wellKey
##'
##' This returns the wellKey, which is a unique identifier generated by \code{idvars} in the \code{mapping}
##' @param sc An object with a \code{wellKey}
##' @return \code{integer} giving the unique id generated
##' @aliases getwellKey,SingleCellAssay-method
##' @examples
##' data(vbetaFA)
##' getwellKey(vbetaFA)
##' colData(vbetaFA)$wellKey
##' @export
setGeneric('getwellKey', function(sc) standardGeneric('getwellKey'))

##' @export
##' @rdname cData
##' @details \code{cData(sc)<-value}: Replace the cellData with \code{value}, which can be either an \code{AnnotatedDataFrame} or \code{data.frame}.  The replacement is checked that it has mandatory fields defined by its class.
##' @param value replacement value
setGeneric("cData<-", function(sc, value) standardGeneric("cData<-"))

##' Accessor for featureData \code{data.frame}
##'
##' Returns the \code{featureData} \code{data.frame}.
##' @title fData
##' @param object An object with \code{featureData}
##' @return \code{data.frame} 
##' @docType methods
##' @rdname fData-methods
##' @name fData
##' @aliases fData,SingleCellAssay-method
##' @importMethodsFrom Biobase fData
                                        #setGeneric('fData', function(sc) standardGeneric('fData'))
NULL

##' Accessor for featureData \code{AnnotatedDataFrame}
##'
##' Returns the \code{featureData}.
##' @param object An object with \code{featureData}
##' @return \code{AnnotatedDataFrame}
##' @docType methods
##' @rdname featureData-methods
##' @name featureData
##' @aliases featureData,SingleCellAssay-method
##' @importMethodsFrom Biobase featureData
                                        #setGeneric('featureData', function(object) standardGeneric('featureData'))
NULL

##' @import BiocGenerics
##' @importMethodsFrom BiocGenerics subset
NULL

###############################
## LmWrapper
###############################
##' fit a zero-inflated regression
##'
##' Given a design and formula, fit the zero inflated regression, storing the fits in slots
##' \code{fitC} and \code{fitD}
##' @param object inheriting from \code{LMlike}
##' @param response a vector, same length as the design, or if missing then use the current response
##' @param ... currently ignored
##' @return LMlike or subclass
##' @aliases fit,GLMlike,missing-method
##' @aliases fit,BayesGLMlike,missing-method
setGeneric('fit', function(object, response, ...) standardGeneric('fit'))

##' Return coefficient standard errors
##'
##' Given a fitted model, return the standard errors of the coefficient
##' @param object a model implementing \code{vcov}
##' @param ... passed to methods
##' @seealso ZlmFit-class
##' @return vector or matrix
##' 
##' @examples
##' #see ZlmFit-class for examples
##' example('ZlmFit-class')
setGeneric('se.coef', function(object, ...) standardGeneric('se.coef'))


##' Run a likelihood-ratio test
##'
##' Compares the change in likelihood between the current model and one subject to contrasts tested in \code{hypothesis}.
##' \code{hypothesis} can be one of a \code{character} giving complete factors or terms to be dropped from the model, \code{CoefficientHypothesis} giving names of  coefficients to be dropped, \code{Hypothesis} giving contrasts using the symbolically, or a contrast \code{matrix}, with one row for each coefficient in the full model, and one column for each contrast being tested.
##' @param object LMlike or subclass
##' @param hypothesis the hypothesis to be tested.  See details.
##' @return array giving test statistics
##' @export
##' @seealso fit
##' @seealso waldTest
##' @seealso Hypothesis
##' @seealso CoefficientHypothesis
##' 
##' @examples
##' #see ZlmFit-class for examples
##' example('ZlmFit-class')
setGeneric('lrTest', function(object, hypothesis) standardGeneric('lrTest'))

##' Run a Wald test
##'
##' Run a Wald tests on discrete and continuous components
##' \code{hypothesis} can be one of a \code{character} giving complete factors or terms to be dropped from the model, \code{CoefficientHypothesis} giving names of  coefficients to be dropped, \code{Hypothesis} giving contrasts using the symbolically, or a contrast \code{matrix}, with one row for each coefficient in the full model, and one column for each contrast being tested.
##' @param object LMlike or subclass
##' @param hypothesis the hypothesis to be tested.  See details.
##' @return array giving test statistics
##' @export
##' @seealso fit
##' @seealso lrTest
##' @seealso lht
##' @examples
##' #see ZlmFit-class for examples
##' example('ZlmFit-class')
setGeneric('waldTest', function(object, hypothesis) standardGeneric('waldTest'))

##' Degrees of freedom of Zero inflated model
##'
##' @param object LMlike or subclass
##' @return vector giving the model degrees of freedom for continuous and discrete
##' @aliases dof,GLMlike-method
##' @aliases dof,LMERlike-method
setGeneric('dof', function(object) standardGeneric('dof'))


##' Model matrix accessor
##'
##' @param object LMlike or subclass
##' @return model.matrix if present
setGeneric('model.matrix', function(object) standardGeneric('model.matrix'))

##' Replace model matrix
##'
##' @param object LMlike or subclass
##' @param value matrix
##' @return modify object
setGeneric('model.matrix<-', function(object, value) standardGeneric('model.matrix<-'))


##' Return programmatically useful summary of a fit
##'
##' @param object LMlike or subclass
##' @param ... other arguments
##' @return list of parameters characterizing fit
setGeneric('summarize', function(object, ...) standardGeneric('summarize'))


###############################
## old style LRT
###############################
##' Likelihood Ratio Tests for SingleCellAssays
##'
##' Tests for a change in ET binomial proportion or mean of positive ET
##' Likelihood Ratio Test for SingleCellAssay objects
##'
##' Combined Likelihood ratio test (binomial and normal) for SingleCellAssay and derived objects.
##' This function is deprecated, please use \link{lrTest} instead.
##' @seealso zlm ZlmFit
##' @param ... ignored
##' @export
setGeneric("LRT",function(sca,comparison,...) standardGeneric("LRT"))

Try the MAST package in your browser

Any scripts or data that you put into this service are public.

MAST documentation built on Nov. 17, 2017, 1:28 p.m.