Closed redst4r closed 3 months ago
Hi @redst4r, good catch, thanks for pointing out this bug!
The issue with the non-full-rank: I know it doesn't make sense to run DESeq2 with that, but an error should make that more obvious (rather some error thrown due to an uninitialized variable).
Agreed, but I'm curious about the context in which you obtained this error. DeseqDataSet
should normally throw a warning at initialization if the design matrix is rank-deficient.
'm not quite sure how I got there. I'll try to put together a minimal example.
Describe the bug
Under certain circumstances,
dds.deseq2()
crashes with aUnboundLocalError: local variable 'beta_init' referenced before assignment
(originating in pyydeseq2/utils.py)From what I can tell, two conditions have to be met for this bug to trigger:
beta_init
never gets initialized):IRLS starts diverging, and we switch to LBFGS:
I don't know enough about IRLS (and its probably a bad thing that my design matrix is rank-deficient), but it might be as simple as modifying it to this:
That ensures that if we switch to BFGS, we have an initial beta to start at. The issue with the non-full-rank: I know it doesn't make sense to run DESeq2 with that, but an error should make that more obvious (rather some error thrown due to an uninitialized variable).
Desktop (please complete the following information):