Fix: raise error when cooks outliers should have been refitted but were not#48
Fix: raise error when cooks outliers should have been refitted but were not#48BorisMuzellec merged 5 commits intomainfrom
Conversation
…ed DeseqDataSet has "refit_cooks" set to True but Cooks outlier were not refitted
…ing a DeseqStats object from a DeseqDataSet object whose Cooks outliers were not refitted but should have been
pydeseq2/DeseqStats.py
Outdated
| assert hasattr(dds, "replaced"), ( | ||
| "dds has 'refit_cooks' set to True but Cooks outliers have not been " | ||
| "refitted. Please run 'dds.refit()' first or set 'dds.refit_cooks' " | ||
| "to False." | ||
| ) |
There was a problem hiding this comment.
Instead of an AssertionError, what about raising an AttributeError? Otherwise LGTM
There was a problem hiding this comment.
Good idea, an AttributeError might be more appropriate indeed
…liers were not refit but should have been
maikia
left a comment
There was a problem hiding this comment.
LGTM
if in the description of the PR you use: closes #issue_number the issue will automatically be closed when the PR is merged ( there are other possible keywords: https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue )
Co-authored-by: Maria Telenczuk <maria.telenczuk@owkin.com>
Thanks, I didn't know we could do that :) |
This PR addresses issue #46 by raising an
AssertionErrorif one tries to initialize aDeseqStatsobject from aDeseqDataSetwithrefit_cooks=Truebut whose outliers were not refit.This is detected by checking that the
DeseqDataSethas areplacedattribute.A corresponding pytest was also added.
Closes #46.