Skip to content

Fix: calculate Cooks distances with few samples #44

Merged
BorisMuzellec merged 4 commits intomainfrom
fix_small_sample_cooks
Jan 13, 2023
Merged

Fix: calculate Cooks distances with few samples #44
BorisMuzellec merged 4 commits intomainfrom
fix_small_sample_cooks

Conversation

@BorisMuzellec
Copy link
Copy Markdown
Collaborator

This PR aims to fix the bug described in Issue #43.

The issue seemed to be that the summation was done on the wrong axis in the trimmed_variance function, called through robust_method_of_moments_disp in the calculate_cooks method of the DeseqDataSet class.

Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Very high level review, but is there any way to add a unit test to check the behaviour that lead to this bug? This way, we make sure the codebase does not forget about it. Also, it's a good way to ensure this PR really fixes the related issue.

@BorisMuzellec
Copy link
Copy Markdown
Collaborator Author

Very high level review, but is there any way to add a unit test to check the behaviour that lead to this bug?

I guess we could add a test where the pipeline is run on a dataset with few samples, as the piece of code responsible for the bug only is run only when no cohort has 3 or more samples. Not sure what to test for though, would error-free execution be enough?

@ghost
Copy link
Copy Markdown

ghost commented Jan 12, 2023

Not sure what to test for though, would error-free execution be enough?

Yes I think that simply adding this corner case and ensuring it runs without error is a good starting point!

@BorisMuzellec BorisMuzellec force-pushed the fix_small_sample_cooks branch from 449442a to 580f216 Compare January 12, 2023 13:59
@BorisMuzellec BorisMuzellec requested a review from a user January 12, 2023 14:15
Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @BorisMuzellec

@BorisMuzellec BorisMuzellec merged commit 56a37f3 into main Jan 13, 2023
@BorisMuzellec BorisMuzellec deleted the fix_small_sample_cooks branch January 13, 2023 08:52
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.

1 participant