-
Notifications
You must be signed in to change notification settings - Fork 81
Description
Is your feature request related to a problem? Please describe.
With the switch to formulaic designs in v0.5.0, the ref_level argument of DeseqDataSet was deprecated. As a result, we may encounter cases in which it is not possible to shrink a given LFC coefficient because it does not correspond to a column in the design matrix. C.f. #361.
Describe the solution you'd like
The reference level can actually be set using the following syntax: design = '~ C(condition, contr.treatment(base="B")).
As this requires some knowledge of formulaic's API, we should
- Add an example in the tutorials
- Update
ref_level's deprecation message - Update
lfc_shrink's docstring (and maybe raise a warning whenlfc_shrinkis called on a non-existant coefficient?)
Describe alternatives you've considered
It might be possible to update the columns of the design matrix without re-fitting dispersions. Something like
dds.design = '~ C(condition, contr.treatment(base="B"))
dds.formulaic_contrasts = FormulaicContrasts(dds.obs, dds.design)
dds.obsm["design_matrix"] = dds.formulaic_contrasts.design_matrixAnd then run the pipeline step by step from dds.fit_LFC().
We could consider implementing a method to achieve this.
Additional context
C.f. the discussion in #361.