fitType = local for vst function
Is your feature request related to a problem? Please describe. vst doent have 'local' as a fitType option
Describe the solution you'd like If vst could also have local as an option, that would be great
Describe alternatives you've considered Alternatively, I just import my code into R and do it from there
Description
I am encountering consistent convergence issues when trying to fit the dispersion curve using the vst_fit function in the PyDESeq2 package. These issues occur regardless of whether I use the full design matrix or not.
Steps to Reproduce
- Load data into a DESeqDataSet object
dds. - Attempt to fit dispersion using
dds.vst_fit(use_design=True)anddds.vst_fit(use_design=False). - Both methods trigger a warning and fail to converge.
- Attempt to apply the VST transformation with
dds.vst().
Expected Behavior
I expect the dispersion fitting process to converge properly so that I can proceed with applying the variance stabilizing transformation.
Actual Behavior
Both attempts to fit the dispersion with use_design=True and use_design=False result in warnings and do not converge. Subsequently, when attempting to apply the VST transformation directly using dds.vst(), another runtime error is triggered:
-
When using
use_design=True: /home/vjsanchez/miniforge3/envs/pydeseq2/lib/python3.10/site-packages/pydeseq2/dds.py:363: UserWarning: The dispersion trend curve fitting did not converge. Switching to a mean-based dispersion trend. self._fit_parametric_dispersion_trend(vst=True) -
When using
use_design=False: Fitting dispersions... done in 20.00 seconds. /home/vjsanchez/miniforge3/envs/pydeseq2/lib/python3.10/site-packages/pydeseq2/dds.py:381: UserWarning: The dispersion trend curve fitting did not converge. Switching to a mean-based dispersion trend. self._fit_parametric_dispersion_trend(vst=True) -
Error upon calling
dds.vst(): /home/vjsanchez/miniforge3/envs/pydeseq2/lib/python3.10/site-packages/pydeseq2/dds.py:333 in vst self.layers["vst_counts"] = self.vst_transform()
/home/vjsanchez/miniforge3/envs/pydeseq2/lib/python3.10/site-packages/pydeseq2/dds.py:435 in vst_transform raise RuntimeError("Fit the dispersion curve prior to applying VST.")
RuntimeError: Fit the dispersion curve prior to applying VST.
Additional Information
- I have tried adjusting the input data by filtering out low count genes and checking for outliers, but the issue persists.
- This issue is blocking further analysis as I cannot proceed with variance stabilizing transformations without a successful dispersion fitting.
Thank you for your assistance!
Sorry for the delay @victorsanchezarevalo, it seems like you are indeed having problems with the parametric fit. Try using dds.vst(fit_type = 'mean')
Solved, Thank you very much!