-
Notifications
You must be signed in to change notification settings - Fork 434
feat: add differential abundance for scvi-tools models #3618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3618 +/- ##
==========================================
- Coverage 84.70% 74.92% -9.78%
==========================================
Files 225 225
Lines 21637 21680 +43
==========================================
- Hits 18327 16244 -2083
- Misses 3310 5436 +2126
🚀 New features to boost your workflow:
|
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lordy5, I have a few questions/clarifications, mainly engineering wise.
The general idea is to do as much code reuse, add more tests and have the support for the generalization of this function to all models in a proper way.
So far, we had the DA support for CytoVi and MrVI only.
- Is this implementation here should be general enough for all models?
- If this is the case, I would expect this PR to have more tests, for other models as well. I would at least add tests for SCANVI, TOTALVI (with mudata input) and a spatial model (RESOLVI, SCVIVA). This is something users are going to try out and lets make sure it works.
- If theres no support for specific models I would add a warning of "DA is currently not supported" - This is something we did for get_normalized_expression function.
- However, (3) was achieved because get_normalized_expression and for that manner, differential_expression, are implemented in _vaemixin.py. So model that does not inherit this mixin will not have it and the message of "not implemented" will appear. In your implementation all is implemented directly in base path in da_pytoch, but like _de_core, we might be missing the wrapper to the DA in _vaemixin.py (like we do for DE) - so this is how I would recommend it to be implemented, otherwise it is has less control and will likely break for users who try out anything.
- So, seems CytoVi and mrVI added their own things on top of your DA, its fine and we have many cases that a model expand on a base/mixin function, question is whether your implementation can support those models implementations with minimum additions, if so, much code can be removed (we want to reuse as much as possible). In such case need to update those models as well and validate for correctness in their tutorials.
- (5) is also relvant as @canergen responded to a user that we are going to have the memory saving version of DA in MRVI soon (#3624 (comment)) however as I wrote right now, the implementation here has no connection to the MRVI implementation unless we will do something about it and we should (update mrvi's DA or have this one supports it).
- Add changlog
|
Some comments
|
|
Hi Ori and Can,
|
|
I think for CytoVI I would keep the DA as is (otherwise there may be some adaptation needed). I would also expose the aggregation function as for many cases the logsumexp favors high DA scores for outlier samples compared to sth like the logmedian. |
@ori-kron-wis @canergen I've finished fixing some issues with the code and have now added tests. Let me know if there's anything else I should do.