MSnSetList-class: Storing multiple related MSnSets

MSnSetList-classR Documentation

Storing multiple related MSnSets

Description

A class for storing lists of MSnSet instances.

Details

There are two ways to store different sets of measurements pertaining an experimental unit, such as replicated measures of different conditions that were recorded over more than one MS acquisition. Without focusing on any proteomics technology in particular, these multiple assays can be recorded as

  • A single combined MSnSet (see the section Combining MSnSet instances in the MSnbase-demo section). In such cases, the different experimental (phenotypical) conditions are recorded as an AnnotatedDataFrame in the phenoData slots.

    Quantitative data for features that were missing in an assay are generally encode as missing with NA values. Alternatively, only features observed in all assays could be selected. See the commonFeatureNames functions to select only common features among two or more MSnSet instance.

  • Each set of measurements is stored in an MSnSet which are combined into one MSnSetList. Each MSnSet elements can have identical or different samples and features. Unless compiled directly manually by the user, one would expect at least one of these dimensions (features/rows or samples/columns) are conserved (i.e. all feature or samples names are identical). See split/unsplit below.

Objects from the Class

Objects can be created and manipluated with:

MSnSetList(x, log, featureDAta)

The class constructor that takes a list of valid MSnSet instances as input x, an optional logging list, and an optional feature metadata data.frame.

split(x, f)

An MSnSetList can be created from an MSnSet instance. x is a single MSnSet and f is a factor or a character of length 1. In the latter case, f will be matched to the feature- and phenodata variable names (in that order). If a match is found, the respective variable is extracted, converted to a factor if it is not one already, and used to split x along the features/rows (f was a feature variable name) or samples/columns (f was a phenotypic variable name). If f is passed as a factor, its length will be matched to nrow(x) or ncol(x) (in that order) to determine if x will be split along the features (rows) or sample (columns). Hence, the length of f must match exactly to either dimension.

unsplit(value, f)

The unsplit method reverses the effect of splitting the value MSnSet along the groups f.

as(x, "MSnSetList")

Where x is an instance of class MzTab. See the class documentation for details.

Slots

x:

Object of class list containing valid MSnSet instances. Can be extracted with the msnsets() accessor.

log:

Object of class list containing an object creation log, containing among other elements the call that generated the object. Can be accessed with objlog().

featureData:

Object of class DataFrame that stores metadata for each object in the x slot. The number of rows of this data.frame must be equal to the number of items in the x slot and their respective (row)names must be identical.

.__classVersion__:

The version of the instance. For development purposes only.

Methods

"[["

Extracts a single MSnSet at position.

"["

Extracts one of more MSnSets as MSnSetList.

length

Returns the number of MSnSets.

names

Returns the names of MSnSets, if available. The replacement method is also available.

show

Display the object by printing a short summary.

lapply(x, FUN, ...)

Apply function FUN to each element of the input x. If the application of FUN returns and MSnSet, then the return value is an MSnSetList, otherwise a list

.

sapply(x, FUN, ..., simplify = TRUE, USE.NAMES = TRUE)

A lapply wrapper that simplifies the ouptut to a vector, matric or array is possible. See ?base::sapply for details.

.

fData

Returns the features metadata featureData slot.

fData<-

Features metadata featureData replacement method.

Author(s)

Laurent Gatto

See Also

The commonFeatureNames function to select common features among MSnSet instances.

Examples

library("pRolocdata")
data(tan2009r1)
data(tan2009r2)

## The MSnSetList class
##  for an unnamed list, names are set to indices
msnl <- MSnSetList(list(tan2009r1, tan2009r2))
names(msnl)
##  a named example
msnl <- MSnSetList(list(A = tan2009r1, B = tan2009r2))
names(msnl)
msnsets(msnl)
length(msnl)
objlog(msnl)
msnl[[1]] ## an MSnSet
msnl[1]   ## an MSnSetList of length 1

## Iterating over the elements
lapply(msnl, dim) ## a list
lapply(msnl, normalise, method = "quantiles") ## an MSnSetList

fData(msnl)
fData(msnl)$X <- sapply(msnl, nrow)
fData(msnl)

## Splitting and unsplitting
##  splitting along the columns/samples
data(dunkley2006)
head(pData(dunkley2006))
(splt <- split(dunkley2006, "replicate"))
lapply(splt, dim) ## the number of rows and columns of the split elements
unsplt <- unsplit(splt, dunkley2006$replicate)
stopifnot(compareMSnSets(dunkley2006, unsplt))

##  splitting along the rows/features
head(fData(dunkley2006))
(splt <- split(dunkley2006, "markers"))
unsplt <- unsplit(splt, factor(fData(dunkley2006)$markers))
simplify2array(lapply(splt, dim))
stopifnot(compareMSnSets(dunkley2006, unsplt))


lgatto/MSnbase documentation built on Nov. 12, 2024, 10:58 a.m.