owkin / PyDESeq2

A Python implementation of the DESeq2 pipeline for bulk RNA-seq DEA.
https://pydeseq2.readthedocs.io/en/latest/
MIT License
573 stars 60 forks source link

[BUG] local variable 'beta_init' referenced before assignment #280

Closed redst4r closed 3 months ago

redst4r commented 4 months ago

Describe the bug

Under certain circumstances, dds.deseq2() crashes with a UnboundLocalError: 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:

Desktop (please complete the following information):

BorisMuzellec commented 4 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.

redst4r commented 3 months ago

'm not quite sure how I got there. I'll try to put together a minimal example.