Question: EdgeR for single cell differential expression analysis
gravatar for kvshamsudheen
12 months ago by
kvshamsudheen60 wrote:

I am trying to perform a more faster way of differential analysis between KO and WT single cell data. I have intergated the data using Seurat pipeline and the differential expression using DESeq2 Seurat implementation. As I have about 4k cells in each clusters, it is taking forever. Meanwhile I found the edgeR and make it working based on consolidating many biostar discussions and the edgeR manual as below

## subset Seurat object for the cluster     
seurat_object_cellfor_edgeR <- subset(seurat_object, subset = seurat_cluster == 0)

# count matrix 
counts <- as.matrix(seurat_object_cellfor_edgeR@assays$RNA@counts)
counts <- counts[Matrix::rowSums(counts >= 1) >= 1, ]
# subset the meta data fro filtered gene/cells
metadata <-
metadata <- metadata[,c("nCount_RNA", "cell_info")]
metadata <- metadata[colnames(counts),]

### Make single cell experiment
sce <- SingleCellExperiment(assays = counts, 
                                    colData = metadata)

## convert to edgR object
dge <- convertTo(sce, type="edgeR", assay.type = 1)
meta_dge <- dge$samples
meta_dge <- meta_dge[,c("lib.size","norm.factors")]
meta_dge <- cbind(meta_dge, metadata)
meta_dge$group <- factor(meta_dge$cell_info)
meta_dge$group <- relevel(meta_dge$group, "KO")
dge$samples <- meta_dge

model fit

dge <- calcNormFactors(dge)
design <- model.matrix(~0+group, data=dge$samples)
dge <- estimateDisp(dge, design = design)    
fit <- glmQLFit(dge, design = design)

Differential expression test <- glmQLFTest(fit)
# top genes$table)
               logFC   logCPM         F PValue
AL627309.1 -15.82462 8.083615 1355354.8      0
AL669831.5 -15.42607 8.111567  444435.6      0
LINC00115  -15.76849 8.087425  576319.8      0
FAM41C     -15.66446 8.094247  501766.5      0
AL645608.3 -15.76752 8.087299  591389.5      0
AL645608.1 -15.83204 8.083359 1661128.7      0

and found to be all the genes are differentially regulated, no FDR and all p value is zero. So I explored the contrast for the testing and that gave me much more reasonable and expected results (but the FC is too low!)

my.contrasts <- makeContrasts(KO_vs_WT = groupKO-groupWT, levels=design)
qlf.contrast <- glmQLFTest(fit, contrast=my.contrasts[,"KO_vs_WT"])
                 logFC   logCPM          F    PValue
AL627309.1 -0.02402289 8.083615 36.0058677 0.3631278
AL669831.5 -0.16083392 8.111567  6.8890345 0.1892858
LINC00115   0.02784262 8.087425  2.5886375 0.6827443
FAM41C     -0.02251330 8.094247  0.4922016 0.8021113
AL645608.3 -0.02544709 8.087299  2.4978086 0.6936892
AL645608.1  0.03523809 8.083359 48.3970011 0.3426162

With this back ground my questions are

  1. Which one of this method is correct? If none of them, how to perform the differential testing?.
  2. Why the FDR is not present in any one of the model. Am I missing something?
  3. Can I include mitochondria read percentage as a covariant and is it require to include UMI count for the model?

Any help is highly appreciated!.

ADD COMMENTlink modified 9 weeks ago by ATpoint41k • written 12 months ago by kvshamsudheen60

Can you post a snippet of what your design looks like? and also my.contrasts. I think without knowing what your design/test is, it's hard to get an understanding.

For starts, the glmQLFTest requires you to specify either a coef or a contrast.

eg: glmQLFTest(fit, contrast=my.contrasts) (there's no need to subset the my.contrasts object)

I think this is the reason why no fdr/pvalue is given. edgeR is unsure what to test.

Final point, can you try topTags function to view the results instead of head? Not sure if it will make a difference but this is the method I always use (and is noted in the manual)

ADD REPLYlink modified 12 months ago • written 12 months ago by Mark800

Thanks. Yes, the topTags gives the FDR, but I am not sure why I am getting too low fold change

                                          groupKO             groupWT
    AAACCCAAGCGTCTCG                      1                   0
    AAACCCACAAGTTCCA                      1                   0
    AAACCCACAAGTTCGT                      1                   0
    AAACCCACAGCACGAA                      1                   0
    AAACGAAAGACTGTTC                      1                   0
    AAACGAAAGGTCACTT                      1                   0
Levels            KO_vs_WT
  groupWT          -1
  groupKO           1
ADD REPLYlink modified 12 months ago • written 12 months ago by kvshamsudheen60

Thank you. Your design and contrasts are fine and you should perform the glmQLFTest as described above. Regarding your question about FC, not 100% sure sorry it's outside of my expertise. You should read these to get a better understanding: and

I take the logFC values produced by edgeR at face value, that is if you average the counts and take the difference between groups (and factor in lib differences). Of course as noted in by Prof Smyth, it's much more complicated than simply adding and dividing. In other words, you have small logFC values because the expression differences between those genes is small. Don't get fixated on the logFC values of genes. You should consider the overall "picture" of the expression profile between your groups. A small fold change can still have a remarkable effect on the biological system you're studying.

ADD REPLYlink modified 12 months ago • written 12 months ago by Mark800
gravatar for kvshamsudheen
12 months ago by
kvshamsudheen60 wrote:

For those who are still looking for the right answer, can have a look at these scripts used for the Soneson and Robinson 2018, Nat. Meth: PMID: 29481549 paper for comparing different DE methods for single cell RNA data set. Both of them are a great start for the same. Cheers!.

ADD COMMENTlink written 12 months ago by kvshamsudheen60


Helpful post. I have a question hopefully you can help. I am comparing differentially expressed genes (DEGs) between WT and KO. When I want to compare DEGs between conditions specific to particular cluster I use Findcluster function of Seurat tool.

Now I wanted to compare overall DEGs between WT and KO and NOT specific to any cluster. Could you let me know how can I accomplish in Seurat or using edgeR. Thank you,

ADD REPLYlink written 4 months ago by singcell0
gravatar for ATpoint
9 weeks ago by
ATpoint41k wrote:

There was a recent preprint introducing a new tool making the dispersion estimation and model fitting to single-cell data notable faster compared to the current implementations of edgeR / DESeq2. It also implements a quasi-likelihood ratio test very similar to what edgeR does. Might be worth considering as a replacement for edgeR/DESeq2 when working on single-cell since these tools are quite slow due to the large number of cells that have to be considered.

ADD COMMENTlink modified 9 weeks ago • written 9 weeks ago by ATpoint41k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1919 users visited in the last hour