namedAssays {SingleCellExperiment} | R Documentation |
Convenience methods to get or set named assay fields.
## S4 method for signature 'SingleCellExperiment' counts(object, ...) ## S4 replacement method for signature 'SingleCellExperiment' counts(object, ...) <- value ## S4 method for signature 'SingleCellExperiment' normcounts(object, ...) ## S4 replacement method for signature 'SingleCellExperiment' normcounts(object, ...) <- value ## S4 method for signature 'SingleCellExperiment' logcounts(object, ...) ## S4 replacement method for signature 'SingleCellExperiment' logcounts(object, ...) <- value ## S4 method for signature 'SingleCellExperiment' cpm(object, ...) ## S4 replacement method for signature 'SingleCellExperiment' cpm(object, ...) <- value ## S4 method for signature 'SingleCellExperiment' tpm(object, ...) ## S4 replacement method for signature 'SingleCellExperiment' tpm(object, ...) <- value ## S4 method for signature 'SingleCellExperiment' weights(object, ...) ## S4 replacement method for signature 'SingleCellExperiment' weights(object, ...) <- value
object |
A SingleCellExperiment object. |
value |
A numeric matrix of the same dimensions as |
... |
May contain |
.
These are wrapper methods for getting or setting assay(object, i=X, ...)
where X
is the name of the method.
For example, counts
will get or set X="counts"
.
This provide some convenience for users as well as encouraging standardization of naming across packages.
Our suggested interpretation of the fields are as follows:
counts
:Raw count data, e.g., number of reads or transcripts.
normcounts
:Normalized values on the same scale as the original counts. For example, counts divided by cell-specific size factors that are centred at unity.
logcounts
:Log-transformed counts or count-like values.
In most cases, this will be defined as log-transformed normcounts
, e.g., using log base 2 and a pseudo-count of 1.
cpm
:Counts-per-million. This is the read count for each gene in each cell, divided by the library size of each cell in millions.
tpm
:Transcripts-per-million. This is the number of transcripts for each gene in each cell, divided by the total number of transcripts in that cell (in millions).
weights
:A matrix of weights, e.g., observational weights to be used in differential expression analysis.
Each method returns a matrix from the correspondingly named field in the assays
slot.
Aaron Lun
example(SingleCellExperiment, echo=FALSE) # Using the class example counts(sce) <- matrix(rnorm(nrow(sce)*ncol(sce)), ncol=ncol(sce)) dim(counts(sce)) # One possible way of computing normalized "counts" sf <- 2^rnorm(ncol(sce)) sf <- sf/mean(sf) normcounts(sce) <- t(t(counts(sce))/sf) dim(normcounts(sce)) # One possible way of computing log-counts logcounts(sce) <- log2(normcounts(sce)+1) dim(normcounts(sce))