Lib sizes in the DGE object are different from original lib sizes
1
0
Entering edit mode
@14ef1b09
Last seen 7 weeks ago
Egypt

Why library sizes in the DGE object are different from original library sizes? And which library sizes should be used in differential expression analysis?

Original lib sizes Lib sizes after creating DGE object

dge <- DGEList(counts = Counts,
               group = sampleInfo$Group,
               genes = genes[which(rownames(genes) %in% rownames(Counts)),]
)
edgeR DifferentialExpression • 537 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 10 hours ago
United States

It appears you have filtered your genes, and probably set keep.lib.size = FALSE when doing so.

Example data from ?glmQLFit

>  nlibs <- 4
>  ngenes <- 1000
>  dispersion.true <- 1/rchisq(ngenes, df=10)
>  design <- model.matrix(~factor(c(1,1,2,2)))

     # Generate count data
> y <- rnbinom(ngenes*nlibs,mu=20,size=1/dispersion.true)
>  y <- matrix(y,ngenes,nlibs)
>  d <- DGEList(y)
>  d <- normLibSizes(d)


> colSums(y)
[1] 20298 20327 19928 20307
> d$samples
        group lib.size norm.factors
Sample1     1    20298    0.9941360
Sample2     1    20327    1.0029198
Sample3     1    19928    1.0044059
Sample4     1    20307    0.9985705

## fake filter
> keep <- sample(1:1000, 900)
> d.filt <- d[keep,, keep.lib.sizes = FALSE]
> d.filt$samples
        group lib.size norm.factors
Sample1     1    18223    0.9941360
Sample2     1    18298    1.0029198
Sample3     1    17862    1.0044059
Sample4     1    18175    0.9985705
0
Entering edit mode

No I didn't filter the low expressed genes. I just created the DGE object and checked the library sizes within it and found them to be different from the library sizes in the metadata. So, I am wondering why the library sizes are different. What happens to them when creating a DGE object?

ADD REPLY
1
Entering edit mode

I just showed you that creating the DGEList object doesn't change the library sizes. You can try running my code to prove it to yourself.

ADD REPLY

Login before adding your answer.

Traffic: 558 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6