Principal components analysis of an spectral counts matrix.

Description

A summary and different plots are given as a result of principal components analysis of an spectral counts matrix.

Usage

1
counts.pca(msnset, facs = NULL, do.plot = TRUE, snms = NULL, wait = TRUE)

Arguments

msnset

A MSnSet with spectral counts in the expression matrix.

do.plot

A logical indicating whether to plot the PCA PC1/PC2 map.

facs

NULL or a data frame with factors. See details below.

snms

Character vector with sample short names to be plotted. If NULL then 'Xnn' is plotted where 'nn' is the column number in the datset.

wait

This function may draw different plots, one by given factor in facs. When in interactive mode the default is to wait for confirmation before proceeding to the next plot. When wait is FALSE and R in interactive mode, instructs not to wait for confirmation.

Details

The spectral counts matrix is decomposed by means of prcomp. If do.plot is TRUE, a plot is generated for each factor showing the PC1/PC2 samples map, with samples colored as per factor level. If facs is NULL then the factors are taken from pData(msnset).

Value

Invisibly returns a list with values:

pca

The return value obtained from prcomp.

pc.vars

The percentage of variability corresponding to each principal component.

Author(s)

Josep Gregori

See Also

MSnSet, prcomp

Examples

1
2
3
4
5
data(msms.dataset)
msnset <- pp.msms.data(msms.dataset)
lst <- counts.pca(msnset)
str(lst)
print(lst$pc.vars[,1:4])