inmoose.deseq2.estimateDispersionsMAP
- inmoose.deseq2.estimateDispersionsMAP(obj, outlierSD=2, dispPriorVar=None, minDisp=1e-08, kappa_0=1, dispTol=1e-06, maxit=100, useCR=True, weightThreshold=0.01, modelMatrix=None, type_='DESeq2', quiet=False)
Low-level function to fit dispersion estimates
Normal users should instead use
DESeqDataSet.estimateDispersions(). This low-level function is called byDESeqDataSet.estimateDispersions(), but is exported and documented for non-standard usage. For instance, it is possible to replace fitted values with a custom fit and continue with the maximum a posteriori dispersion estimate.estimateDispersionsPriorVar()is called inside this function, and stores the dispersion prior variance as an attribute ofDESeqDataSet.dispersionFunction, which can be manually provided toestimateDispersionsMAPfor parallel execution.- Parameters:
obj (DESeqDataSet) – the input dataset
outlierSD (int) – the number of standard deviations of log gene-wise estimates above the prior mean (fitted value), above which dispersion estimates will be labelled outliers. Outliers will keep their original value and not be shrunk using the prior.
dispPriorVar (array-like) – the variance of the normal priori on the log dispersions. If not supplied, it is calculated as the difference between the mean squared residuals of gene-wise estimates to the fitted dispersion and the expected sampling variance of the log dispersion.
minDisp (float) – small value for the minimum dispersion, to allow for calculations in log scale, one order of magnitude above this value is used as a test for inclusion in mean-dispersion fitting
kappa_0 (float) – parameter used in setting the initial proposal in backtracking search, higher
kappa_0results in larger stepsdispTol (float) – parameter to test for convergence of log dispersion, stop when increase in log posterior is less than
dispTolmaxit (int) – maximum number of iterations to allow for convergence
useCR (bool) – whether to use Cox-Reid adjustment
weightThreshold (float) – threshold for subsetting the design matrix and GLM weights for calculating the Cox-Reid correction
quiet (bool) – whether to print messages at each step
modelMatrix (array-like) – for advanced use only, a substitute model matrix for gene-wise and MAP dispersion estimation
type ("DESeq2" or "glmGamPoi") – specify if the glmGamPoi package is used to calculate the dispersion. This can be significantly faster if there are many replicates with small counts.
- Returns:
the input
objwith final MAP dispersion estimates- Return type: