Size factor methods {SingleCellExperiment} | R Documentation |
Gets or sets the size factors for all cells.
## S4 method for signature 'SingleCellExperiment' sizeFactors(object, type=NULL) ## S4 replacement method for signature 'SingleCellExperiment' sizeFactors(object, type=NULL) <- value ## S4 method for signature 'SingleCellExperiment' clearSizeFactors(object) ## S4 method for signature 'SingleCellExperiment' sizeFactorNames(object)
object |
A SingleCellExperiment object. |
type |
A string specifying the type of size factor to get or set. |
value |
A numeric vector of size factors for all cells. |
A size factor is a scaling factor used to divide the raw counts of a particular cell to obtain normalized expression values.
The sizeFactors
methods can be used to get or set size factors for all cells.
The type
argument allows storage of multiple vectors of size factors (e.g., different values for spike-ins versus endogenous genes).
If type
is NULL
, a “default” set of size factors is stored or returned.
If value
is NULL
for isSpike<-
, size factors of type
will be removed from object
.
All size factors can be removed from object
by using the clearSizeFactors
method.
The sizeFactorNames
method will return the names of all stored size factor sets.
This does not include the default set of size factors (obtained with isSpike(..., type=NULL)
) as these are unnamed.
For sizeFactors
, a numeric vector is returned containing size factors of the set type
for all cells.
If type
is not available, NULL
is returned instead.
For sizeFactors<-
, a SingleCellExperiment is returned with size factors stored in the internal metadata fields.
For clearSizeFactors
, a SingleCellExperiment is returned with no size factor information.
For sizeFactorNames
, a character vector is returned containing the names of all named size factor sets.
Aaron Lun
example(SingleCellExperiment, echo=FALSE) # Using the class example sizeFactors(sce) <- runif(ncol(sce)) sizeFactors(sce) sizeFactors(sce, "ERCC") <- runif(ncol(sce)) sizeFactors(sce, "ERCC") sizeFactors(sce) # unchanged. sizeFactors(sce, "ERCC") <- NULL sizeFactors(sce, "ERCC")