Using Milo in Pertpy: how to install the statmod R package for pertpy?

When I use milo in pertpy, I encounter the error


" --------------------------------------------------------------------------- RRuntimeError Traceback (most recent call last)
Cell 85 line 4 1 # Reorder categories 2 # (by default, the last category is taken as the condition of interest) 3 mdata[‘rna’].obs[‘Disease_Identity’] = mdata[‘rna’].obs[‘Disease_Identity’].cat.reorder_categories([‘Control’, ‘COPD’]) ----> 4 milo.da_nhoods(mdata, design=‘~Disease_Identity’) File ~/pertpy/pertpy/tools/_milo.py:323, in Milo.da_nhoods(self, mdata, design, model_contrasts, subset_samples, add_intercept, feature_key, solver) 321 dge = edgeR.calcNormFactors(dge, method=“TMM”) 322 dge = edgeR.estimateDisp(dge, model) → 323 fit = edgeR.glmQLFit(dge, model, robust=True) 325 # Test 326 n_coef = model.shape[1] File ~/miniconda3/envs/scanpy/lib/python3.11/site-packages/rpy2/robjects/functions.py:208, in SignatureTranslatedFunction.call(self, *args, **kwargs) 206 v = kwargs.pop(k) 207 kwargs[r_k] = v → 208 return (super(SignatureTranslatedFunction, self) 209 .call(*args, **kwargs)) File ~/miniconda3/envs/scanpy/lib/python3.11/site-packages/rpy2/robjects/functions.py:131, in Function.call(self, *args, **kwargs) 129 else: 130 new_kwargs[k] = cv.py2rpy(v) → 131 res = super(Function, self).call(*new_args, **new_kwargs)

874 return res RRuntimeError: Error in fitFDistRobustly(var, df1 = df, covariate = covariate, winsor.tail.p = winsor.tail.p) : statmod package required but is not installed"


How can I install the required statmod R package for pertpy?

Dear @hmnzo5gy

I’m sorry for the late answer.
How did you install pertpy so far? How did you install edge-r?

Thank you for the response @Zethson.
I have resolved the problem when I installed pertpy from source using the latest github deposit.

1 Like