View source: R/functions-MSnSet.R
nQuants | R Documentation |
This function counts the number of quantified features, i.e
non NA quantitation values, for each group of features
for all the samples in an "MSnSet"
object.
The group of features are defined by a feature variable names, i.e
the name of a column of fData(object)
.
nQuants(x, groupBy)
x |
An instance of class |
groupBy |
An object of class |
This function is typically used after topN
and before
combineFeatures
, when the summerising function is
sum
, or any function that does not normalise to the number of
features aggregated. In the former case, sums of features might
be the result of 0 (if no feature was quantified) to n
(if all topN
's n
features were quantified) features,
and one might want to rescale the sums based on the number of
non-NA features effectively summed.
A matrix
of dimensions
length(levels(groupBy))
by ncol(x)
A matrix
of dimensions
length(levels(factor(fData(object)[, fcol])))
by
ncol(object)
of integers.
Laurent Gatto lg390@cam.ac.uk, Sebastian Gibb mail@sebastiangibb.de
data(msnset)
n <- 2
msnset <- topN(msnset, groupBy = fData(msnset)$ProteinAccession, n)
m <- nQuants(msnset, groupBy = fData(msnset)$ProteinAccession)
msnset2 <- combineFeatures(msnset,
groupBy = fData(msnset)$ProteinAccession,
method = sum)
stopifnot(dim(n) == dim(msnset2))
head(exprs(msnset2))
head(exprs(msnset2) * (n/m))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.