owkin / PyDESeq2

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

[BUG] DeseqDataSet.deseq2() still prints when quiet=True is set #287

Open yihming opened 2 months ago

yihming commented 2 months ago

Describe the bug

My following code

from pydeseq2.dds import DeseqDataSet
from pydeseq2.default_inference import DefaultInference

inference = DefaultInference(n_cpus=1)

dds = DeseqDataSet(counts=..., metadata=..., design_factors=..., inference=inference, quiet=True)
dds.deseq2()

still prints the following 3 sentences when quiet=True, while from the source code they should be controlled by quiet parameter:

Fitting dispersions...
... done in 0.20 seconds.

Fitting MAP dispersions...
... done in 0.22 seconds.

Fitting LFCs...
... done in 0.17 seconds.

To Reproduce

This case happens for some data, not all. However, my case uses internal data, so I may have to do some anonymization work before sharing it with you.

Expected behavior

These sentences should not be printed if quiet=True is set.

Screenshots

Already shown above.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

umarteauowkin commented 2 months ago

Hi ! Thanks for reporting. I haven't been able to reproduce yet. Could you assess if the self.quiet attribute has been changed during the pipeline ? (typically by debugging before printing one of these three sentences). It would be a great help. Thanks !

yihming commented 2 months ago

Hi @umarteauowkin ,

In the attachment is a test file which triggers the issue at my side. The counts is count_df.csv, and metadata is metadata.csv. The design factor is condition, and contrast is ["condition", "A", "B"].

count_df.csv metadata.csv

yihming commented 2 months ago

And just let you know that all the 3 places show that self.quiet is False. However, I cannot find any other places where self.quiet is changed in dds.py file.

However, if I print self.quiet before and after each step in deseq2 function, it's all True...

umarteauowkin commented 2 months ago

I m quite puzzled here. I will take a look (but maybe more in July as this is not too blocking). Thanks for the minimal example !