Skip to content

Add DRVI#3699

Open
moinfar wants to merge 20 commits intoscverse:mainfrom
moinfar:main
Open

Add DRVI#3699
moinfar wants to merge 20 commits intoscverse:mainfrom
moinfar:main

Conversation

@moinfar
Copy link

@moinfar moinfar commented Feb 4, 2026

Dear Maintainers,

Here, I have prepared DRVI for contribution as an external model, matching the latest version of scvi-tools.
In short, it contains:

  • DRVI models with all the required PyTorch modules I wrote. Specifically,
    • FCLayers are modified to decode multiple parallel splits of the latent space at once. For this, we have a factory that generates hidden layers based on user setup.
    • The scArches Q2R mapping is implemented differently but shares some functionality.
    • The gene likelihood somehow registers parameters it needs to the model. So the wrappers are implemented separately.
  • There are some additional functions to iterate over data and provide model outputs for interpretability, reconstruction, etc. Some of them seem redundant, but they have some details currently not available in RNASeqMixins.
  • Interpretability functions to interpret additive decoders and plot latent space details and relevant genes.
  • All the functions have tests to my knowledge.

I removed some extra stuff. The model may still contain much extra functionality. We can prune some after a discussion.
Please let me know if you need any further explanation of the code's functionality.

Thanks for your time.

for key in self.attr_keys:
categorical_dtype = (
CategoricalDtype(categories=category_dict[key])
CategoricalDtype(categories=category_dict[key], ordered=True)
Copy link
Author

Choose a reason for hiding this comment

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

This is required so that we can have query to reference mapping beyond just batch_key (also for cols in cat_covs_key)

@ori-kron-wis ori-kron-wis added the on-merge: backport to 1.4.x on-merge: backport to 1.4.x label Feb 10, 2026
@ori-kron-wis ori-kron-wis self-requested a review February 10, 2026 11:47
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 83.87446% with 298 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.63%. Comparing base (aa862eb) to head (3d683fb).

Files with missing lines Patch % Lines
src/scvi/external/drvi/nn/_base_components.py 84.34% 62 Missing ⚠️
src/scvi/external/drvi/nn_modules/noise_model.py 79.50% 41 Missing ⚠️
src/scvi/external/drvi/model/base/_archesmixin.py 72.22% 40 Missing ⚠️
src/scvi/external/drvi/nn_modules/embedding.py 82.45% 30 Missing ⚠️
...scvi/external/drvi/model/base/_generative_mixin.py 78.44% 25 Missing ⚠️
src/scvi/external/drvi/module/_drvi.py 89.33% 24 Missing ⚠️
src/scvi/external/drvi/model/_drvi.py 83.13% 14 Missing ⚠️
src/scvi/external/drvi/nn_modules/layer/factory.py 75.00% 11 Missing ⚠️
src/scvi/external/drvi/utils/pl/_latent.py 84.93% 11 Missing ⚠️
src/scvi/external/drvi/utils/tl/_latent.py 70.27% 11 Missing ⚠️
... and 7 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3699      +/-   ##
==========================================
+ Coverage   72.76%   73.63%   +0.86%     
==========================================
  Files         226      256      +30     
  Lines       21901    23748    +1847     
==========================================
+ Hits        15937    17486    +1549     
- Misses       5964     6262     +298     
Files with missing lines Coverage Δ
src/scvi/data/fields/_arraylike_field.py 92.34% <ø> (ø)
src/scvi/external/__init__.py 85.71% <100.00%> (+0.42%) ⬆️
src/scvi/external/drvi/__init__.py 100.00% <100.00%> (ø)
src/scvi/external/drvi/model/__init__.py 100.00% <100.00%> (ø)
src/scvi/external/drvi/model/base/__init__.py 100.00% <100.00%> (ø)
src/scvi/external/drvi/module/__init__.py 100.00% <100.00%> (ø)
src/scvi/external/drvi/module/_constants.py 100.00% <100.00%> (ø)
src/scvi/external/drvi/nn/__init__.py 100.00% <100.00%> (ø)
src/scvi/external/drvi/nn_modules/__init__.py 100.00% <100.00%> (ø)
src/scvi/external/drvi/nn_modules/freezable.py 100.00% <100.00%> (ø)
... and 23 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on-merge: backport to 1.4.x on-merge: backport to 1.4.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants