prcomp.DGEList: Principal component analysis of DGEList

View source: R/pca.R

prcomp.DGEListR Documentation

Principal component analysis of DGEList

Description

Principal component analysis of DGEList

Usage

## S3 method for class 'DGEList'
prcomp(x, ntop = NULL, scale = FALSE, verbose = FALSE, ...)

Arguments

x

A DGEList object

ntop

Integer, how many top-variable features should be used? If NULL, all features are used

scale

Logical, whether variance of features should be scaled to 1. FALSE by default (recommended!); set it to TRUE only if you are sure what you are doing

verbose

Logical, whether the function should print messages.

...

Other parameters passed to vsnMatrix

The function first remove all-zero-count features, because they can make the PCA plot of samples delusive.

Next, it applies vsn transformation implemented in the vsn package to the count matrix.

Finally, PCA is applied to the vsn-transformed matrix.

Value

The function returns a prcomp object. The fit object is saved in the vsnFit field in the returned object, and the transformed matrix is saved in the vsnMat field.

See Also

prcompExprs

Examples


myCounts <- matrix(rnbinom(10000, 3, 0.25), nrow=1000)
myDgeList <- DGEList(counts=myCounts,
  samples=data.frame(group=gl(5,2)))
myPrcomp <- prcomp(myDgeList)

## Not run: 
  vsn::meanSdPlot(myPrcomp$vsnFit)

## End(Not run)

## features with zero count in all samples do not contribute to the PCA analysis
myDgeList2 <- DGEList(counts=rbind(myCounts, rep(0, 10)),
  samples=data.frame(group=gl(5,2)))
myPrcomp2 <- prcomp(myDgeList2)
stopifnot(identical(myPrcomp, myPrcomp2))


bedapub/ribiosNGS documentation built on Feb. 10, 2025, 12:34 a.m.