DESeq2: Size factor estimations for type = "poscounts" different between estimateSizeFactors() and estimateSizeFactorsForMatrix()
1
1
Entering edit mode
@andreasgschwind-20672
Last seen 2.2 years ago
Germany

Hi,

I noticed that the size factor estimations when using type = "poscounts" with estimateSizeFactors() and estimateSizeFactorsForMatrix() differ slightly. From looking at the source code it appears that code to calculate the geometric means is different for the two functions. Is there particular reason for this, or does the difference in size factors comes from something else?

I'm using DESeq2 1.30.1 with R 4.0.2.

Thanks, Andreas

DESeq2 • 1.1k views
ADD COMMENT
1
Entering edit mode
@mikelove
Last seen 2 hours ago
United States

Thanks for pointing this out -- the code in estimateSizeFactors() is the standard, and it looks like I implemented the other code in ...ForMatrix() more recently (2020) -- not sure why it's there actually. I should review and make sure it accords with the original.

ADD COMMENT
0
Entering edit mode

Oh I see now, the difference is just in scaling, which is arbitrary. So these differences you see shouldn't cause any downstream issues, and they are intentional. I just forgot the origin of this.

We have this following code in estimateSizeFactorsForMatrix. It is not strictly necessary (the scaling of the size factors just changes the intercept), but ensures the size factors have geometric mean of 1. In order to not have any changes with respect to the original DESeq and its size factors, the default size factor correction in DESeq2 is identical to the original 2010 paper's implementation and the geometric mean is not equal to 1.

  if (incomingGeoMeans) {
    # stabilize size factors to have geometric mean of 1
    sf <- sf/exp(mean(log(sf)))
  }
ADD REPLY

Login before adding your answer.

Traffic: 613 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