Skip to content

Fix: raise error when cooks outliers should have been refitted but were not#48

Merged
BorisMuzellec merged 5 commits intomainfrom
cooks_not_refit_warning
Jan 13, 2023
Merged

Fix: raise error when cooks outliers should have been refitted but were not#48
BorisMuzellec merged 5 commits intomainfrom
cooks_not_refit_warning

Conversation

@BorisMuzellec
Copy link
Copy Markdown
Collaborator

@BorisMuzellec BorisMuzellec commented Jan 12, 2023

This PR addresses issue #46 by raising an AssertionError if one tries to initialize a DeseqStats object from a DeseqDataSet with refit_cooks=True but whose outliers were not refit.

This is detected by checking that the DeseqDataSet has a replaced attribute.

A corresponding pytest was also added.

Closes #46.

Boris MUZELLEC added 2 commits January 12, 2023 17:03
…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
@BorisMuzellec BorisMuzellec requested review from a user, arthurPignetOwkin and maikia January 12, 2023 16:17
@BorisMuzellec BorisMuzellec added the bug Something isn't working label Jan 12, 2023
Comment on lines +197 to +201
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."
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of an AssertionError, what about raising an AttributeError? Otherwise LGTM

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, an AttributeError might be more appropriate indeed

@BorisMuzellec BorisMuzellec requested a review from a user January 13, 2023 13:02
Copy link
Copy Markdown
Collaborator

@maikia maikia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@BorisMuzellec
Copy link
Copy Markdown
Collaborator Author

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 )

Thanks, I didn't know we could do that :)

@BorisMuzellec BorisMuzellec merged commit ca2fda5 into main Jan 13, 2023
@BorisMuzellec BorisMuzellec deleted the cooks_not_refit_warning branch January 13, 2023 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wald-test error if no Cook distance refit is performed

2 participants