Clarification on DESeq2 normalizationFactors(), estimateDispersions() and varianceStabilizingTransformation()
1
2
Entering edit mode
enricoferrero ▴ 660
@enricoferrero-6037
Last seen 2.4 years ago
Switzerland

Hello,

I'm using DESeq2 on a non-standard dataset where I wish to supply my own normalisation factors. I'm getting an error message from varianceStabilizingTransformation() which made me question the workflow I'm using:

# This works as expected, no warnings or errors
dds <- DESeqDataSetFromMatrix(countData = cnts, colData = smpls, design = ~ Batch + Condition_Treatment_Time)
normalizationFactors(dds) <- normfacs
dds <- DESeq(dds, test="Wald", parallel=TRUE)
using pre-existing normalization factors
estimating dispersions
gene-wise dispersion estimates: 16 workers
mean-dispersion relationship
final dispersion estimates, MLE betas: 16 workers
fitting model and testing: 16 workers

# However I get an error here
vsd <- varianceStabilizingTransformation(dds)
-- note: fitType='parametric', but the dispersion trend was not well captured by the
   function: y = a/x + b, and a local regression fit was automatically substituted.
   specify fitType='local' or 'mean' to avoid this message next time.
Error in getVarianceStabilizedData(object) :
  call estimateSizeFactors before calling getVarianceStabilizedData if using local dispersion fit

# same error using fitType="local"
> vsd <- vst(dds, fitType="local")
Error in getVarianceStabilizedData(object) :
  call estimateSizeFactors before calling getVarianceStabilizedData if using local dispersion fit


# but it works fine with fitType="mean"
vsd <- varianceStabilizingTransformation(dds, fitType="mean")

The error is about not having called estimateSizeFactors(), which I don't want to do because I supplied my own normalisation factors. fitType="mean" solves the issue but I'm wondering if I should also pass the same argument when building the dds object in the first place (even though I don't get any warnings or error at that stage).

I.e., change this:

dds <- DESeq(dds, test="Wald", parallel=TRUE)

to this:

dds <- DESeq(dds, test="Wald", fitType="mean", parallel=TRUE)

Thanks

Enrico

 

deseq2 • 1.3k views
ADD COMMENT
2
Entering edit mode
@mikelove
Last seen 18 hours ago
United States

hi Enrico,

Thanks for reporting this. This is just a small bug from some old code I didn't update. It is just a test which should also succeed if there are normalization factors, but it's looking only for size factors. I can write a fix soon and push it to the release branch.

ADD COMMENT
0
Entering edit mode

Great, thanks Michael.

So you're saying that varianceStabilizingTransformation() should not give that error message and hence I don't need to specify fitType="mean" anywhere?

Can you give me a shout once you've pushed the fix to release?

Thanks!

 

ADD REPLY
1
Entering edit mode

Correct. The problem is solely the test (that generates the error message).

Yes, I'll post to this thread when I've pushed a fix.

ADD REPLY
1
Entering edit mode

I just pushed the fix to release. thanks for the bug report.

ADD REPLY

Login before adding your answer.

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