Entering edit mode
8 months ago
Shaimaa Gamal
▴
10
How can I improve RUVg correction? The RLE plot isn't still perfect
design = model.matrix(~factor, data = pData(set1))
design=as.matrix(design)
y <- DGEList(counts=counts(set1), group=factor)
y <- calcNormFactors(y, method="TMM")
y <- estimateGLMCommonDisp(y, design)
y <- estimateGLMTagwiseDisp(y, design)
fit <- glmFit(y, design)
lrt <- glmLRT(fit, coef=ncol(fit$design))
top <- topTags(lrt, n=nrow(set1))$table
empirical <- rownames(set1)[which(!(rownames(set1) %in% rownames(top)[1:5000]))]
library(RUVSeq)
set2 <- RUVg(set1, empirical, k=3)
W=pData(set2)
ruv_counts=as.data.frame(set2@assayData[["normalizedCounts"]])
rownames(W)=NULL
W=W[,-1]
W=as.matrix(W)
sce2 <- SingleCellExperiment(assays = list(counts =ruv_counts))
colData(sce2)$Institute=sampleInfo$Sample.supplying.institution
colData(sce2)
plotRLE(sce2, exprs_values = "counts", exprs_logged=FALSE, color_by = colData(sce2), style = "minimal")+
ggtitle("After RUVg correction")