Entering edit mode
8 months ago
Shaimaa Gamal
▴
10
RUVG correction:
I am not satisfied with the RLE plot and I wonder if there are anything to improve it?
design = model.matrix(~factor+batch)
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=20)
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))+
ggtitle("After RUVg correction")