Skip to content

BUG wrong lfc_shrink sign display#131

Merged
BorisMuzellec merged 7 commits intomainfrom
fix_lfc_shrink_sign
Jun 1, 2023
Merged

BUG wrong lfc_shrink sign display#131
BorisMuzellec merged 7 commits intomainfrom
fix_lfc_shrink_sign

Conversation

@BorisMuzellec
Copy link
Copy Markdown
Collaborator

Reference Issue or PRs

Fixes #121

What does your PR implement? Be specific.

This PR addresses #121 (wrong display of shrunk factors). More precisely:

  • the message output by lfc_shrink was fixed to match the coefficient that was actually shrunk
  • when the coefficient is not available, the error message now explains how to set ref_level in DeseqDataSet
  • it is now possible to set coeff=None
  • coeff=None is tested in test_edge_cases.py

@BorisMuzellec BorisMuzellec changed the title BUG lfc_shrink sign BUG wrong lfc_shrink sign display May 10, 2023
@BorisMuzellec BorisMuzellec marked this pull request as ready for review May 10, 2023 13:05
@BorisMuzellec BorisMuzellec requested a review from a user May 10, 2023 13:05
print(
f"Shrunk Log2 fold change & Wald test p-value: "
f"{self.contrast[0]} {self.contrast[1]} vs {self.contrast[2]}"
f"{split_coeff[0]} {split_coeff[1]} vs {split_coeff[3]}"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I got a bit lost, I was expecting split_coeff[2] instead of 3. can you write a short comment so it's easier to follow on what's in the coeff (or split_coeff) when reading the code?

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.

I've added a comment to explain (coeffs are of the form factor_A_vs_B, so because of the "vs" it's split_coeff[3] and not split_coeff[2]).


res = DeseqStats(dds)
res.summary()
res.lfc_shrink(coeff=None)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

would it be worth adding a test for other coeff values?

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.

I've updated the test to check that the same result is obtained with the implicit coeff condition_B_vs_A (the case where an incorrect coeff is provided is already covered)

@BorisMuzellec
Copy link
Copy Markdown
Collaborator Author

Thanks for your review @maikia! Could you have a look at the updates I made and see if they answer the points you raised?

@BorisMuzellec BorisMuzellec requested a review from maikia May 31, 2023 15:56
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, thanks @BorisMuzellec

@BorisMuzellec BorisMuzellec merged commit 0333ad3 into main Jun 1, 2023
@BorisMuzellec BorisMuzellec deleted the fix_lfc_shrink_sign branch June 1, 2023 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] pydeseq2.ds.DeseqStats.lfc_shrink gives wrong log2FoldChange signs

2 participants