svaseqRemove | R Documentation |
Detect surrogate variables from count data and remove their effects VSN-transformed counts
svaseqRemove(dgeList, design, nullModel, verbose = FALSE, offset)
dgeList |
An |
design |
Design matrix |
nullModel |
Null model matrix |
verbose |
Logical |
offset |
If provided, it is passed to In case no significant surrogate variables are detected, PCA analysis is applied to the vsn-transformed matrix. |
A list with following items
svaResults of svaseq
vsnFitFit object of vsn
vsnMatFitted matrix of vsn
vsnBatchRemovedFitted matrix of vsn, with surrogates' effect removed
vsnBatchRemovedPcaPCA object derived from vsnBatchRemoved
vsnBatchRemovedPcaScoresPCA scores with annotations
designWithSVDesign matrix with surrogates variables appended if any
This function needs to be harmonized with the other SVA functions. The reason is that svaseq was for a long time not stable until recently. Therefore this function is written later, and unfortunately the outcome is not harmonized yet.
pcaScores
y1org <- matrix(rnbinom(4000, mu=5, size=2), ncol=8)
genes1 <- data.frame(GeneSymbol=sprintf("Gene%d", 1:nrow(y1org)))
y1 <- y1org
y1[30:120, 4:7] <- y1[30:120, 4:7]+9 ## mimicking batch effect
rownames(y1org) <- rownames(y1) <- rownames(genes1) <- 1:nrow(y1)
anno1 <- data.frame(treatment=gl(2,4, labels=c("ctrl", "tmt")),
donor=factor(rep(c(1,2), 4)))
d1 <- DGEList(counts=y1, genes=genes1, samples=anno1)
d2 <- DGEList(counts=y1org, genes=genes1, samples=anno1)
design <- model.matrix(~treatment+donor, data=d1$samples)
nullModel <- model.matrix(~donor, data=d1$samples)
d1VsnSvaRes <- svaseqRemove(d1, design, nullModel)
d2VsnSvaRes <- svaseqRemove(d2, design, nullModel)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.