Skip to content

RRuntimeError: Error in colSums(x) : 'x' must be numeric #681

@ahmed-agami

Description

@ahmed-agami

Report

Hi Lukas,

I have followed the steps exactly here: https://pertpy.readthedocs.io/en/latest/tutorials/notebooks/milo.html under the section ''Milo - KNN based differential abundance analysis'' using my AnnData object and I had the above error when I tried to run the Differential abundance testing with GLM.


RRuntimeError Traceback (most recent call last)
Cell In[114], line 1
----> 1 milo.da_nhoods(mdata, design="~condition", model_contrasts="conditionGAPDH-conditioncontrol")

File ~/yes/envs/pertpy/lib/python3.10/site-packages/pertpy/tools/_milo.py:371, in Milo.da_nhoods(self, mdata, design, model_contrasts, subset_samples, add_intercept, feature_key, solver)
369 # Fit NB-GLM
370 dge = edgeR.DGEList(counts=count_mat[keep_nhoods, :][:, keep_smp], lib_size=lib_size[keep_smp])
--> 371 dge = edgeR.calcNormFactors(dge, method="TMM")
372 dge = edgeR.estimateDisp(dge, model)
373 fit = edgeR.glmQLFit(dge, model, robust=True)

File ~/yes/envs/pertpy/lib/python3.10/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 ~/yes/envs/pertpy/lib/python3.10/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)
132 res = cv.rpy2py(res)
133 return res

File ~/yes/envs/pertpy/lib/python3.10/site-packages/rpy2/rinterface_lib/conversion.py:45, in cdata_res_to_rinterface..(*args, **kwargs)
44 def _(*args, **kwargs):
---> 45 cdata = function(*args, **kwargs)
46 # TODO: test cdata is of the expected CType
47 return _cdata_to_rinterface(cdata)

File ~/yes/envs/pertpy/lib/python3.10/site-packages/rpy2/rinterface.py:890, in SexpClosure.call(self, *args, **kwargs)
883 res = rmemory.protect(
884 openrlib.rlib.R_tryEval(
885 call_r,
886 call_context.sexp._cdata,
887 error_occured)
888 )
889 if error_occured[0]:
--> 890 raise embedded.RRuntimeError(_rinterface._geterrmessage())
891 return res

RRuntimeError: Error in colSums(x) : 'x' must be numeric

Image

Version information


anndata 0.10.8
anndata2ri 1.3.2
matplotlib 3.9.2
mudata 0.3.1
numba 0.60.0
numpy 1.26.4
pandas 2.2.3
pertpy 0.9.4
rpy2 3.5.17
scanpy 1.10.4
scipy 1.14.1
scvi 1.2.0
seaborn 0.13.2
session_info 1.0.0

PIL 11.0.0
absl NA
adjustText 1.3.0
anyio NA
arrow 1.3.0
asttokens NA
attr 24.2.0
attrs 24.2.0
babel 2.16.0
backports NA
blitzgsea NA
certifi 2024.08.30
cffi 1.17.1
charset_normalizer 3.4.0
chex 0.1.87
comm 0.2.2
cycler 0.12.1
cython_runtime NA
dateutil 2.9.0.post0
debugpy 1.8.9
decorator 5.1.1
decoupler 1.8.0
defusedxml 0.7.1
docrep 0.3.2
equinox 0.11.9
etils 1.11.0
exceptiongroup 1.2.2
executing 2.1.0
fastjsonschema NA
filelock 3.16.1
flax 0.10.2
fqdn NA
fsspec 2024.10.0
h5py 3.12.1
idna 3.10
igraph 0.11.8
ipykernel 6.29.5
ipywidgets 8.1.5
isoduration NA
jaraco NA
jax 0.4.35
jaxlib 0.4.35
jaxopt NA
jaxtyping 0.2.36
jedi 0.19.2
jinja2 3.1.4
joblib 1.4.2
json5 0.10.0
jsonpointer 3.0.0
jsonschema 4.23.0
jsonschema_specifications NA
jupyter_events 0.10.0
jupyter_server 2.14.2
jupyterlab_server 2.27.3
kiwisolver 1.4.7
lamin_utils 0.13.9
legacy_api_wrap NA
leidenalg 0.10.2
lightning 2.4.0
lightning_fabric 2.4.0
lightning_utilities 0.11.9
lineax 0.0.7
llvmlite 0.43.0
markupsafe 3.0.2
matplotlib_inline 0.1.7
ml_collections 1.0.0
ml_dtypes 0.5.0
more_itertools 10.3.0
mpl_toolkits NA
mpmath 1.3.0
msgpack 1.1.0
multipledispatch 0.6.0
natsort 8.4.0
nbformat 5.10.4
numpyro 0.16.0
nvidia NA
opt_einsum 3.4.0
optax 0.2.4
ott 0.4.9
overrides NA
packaging 24.2
parso 0.8.4
patsy 1.0.1
platformdirs 4.3.6
ply 3.11
prometheus_client NA
prompt_toolkit 3.0.48
psutil 6.1.0
pubchempy 1.0.4
pure_eval 0.2.3
pyarrow 18.1.0
pycparser 2.22
pydev_ipython NA
pydevconsole NA
pydevd 3.2.3
pydevd_file_utils NA
pydevd_plugins NA
pydevd_tracing NA
pygments 2.18.0
pynndescent 0.5.13
pyomo 6.8.2
pyparsing 3.2.0
pyro 1.9.1
pythonjsonlogger NA
pytorch_lightning 2.4.0
pytz 2024.2
referencing NA
requests 2.32.3
rfc3339_validator 0.1.4
rfc3986_validator 0.1.1
rich NA
rpds NA
send2trash NA
setuptools 75.6.0
simplejson 3.19.3
six 1.16.0
sklearn 1.5.2
skmisc 0.5.1
sniffio 1.3.1
sparse 0.15.4
sparsecca 0.3.1
stack_data 0.6.3
statsmodels 0.14.4
sympy 1.13.1
texttable 1.7.0
threadpoolctl 3.5.0
toolz 1.0.0
torch 2.5.1+cu124
torchgen NA
torchmetrics 1.6.0
tornado 6.4.2
tqdm 4.67.1
traitlets 5.14.3
triton 3.1.0
typing_extensions NA
tzlocal NA
umap 0.5.7
uri_template NA
urllib3 2.2.3
wcwidth 0.2.13
webcolors NA
websocket 1.8.0
xarray 2024.11.0
yaml 6.0.2
zmq 26.2.0
zoneinfo NA

IPython 8.30.0
jupyter_client 8.6.3
jupyter_core 5.7.2
jupyterlab 4.2.6
notebook 7.2.2

Python 3.10.15 | packaged by conda-forge | (main, Oct 16 2024, 01:24:24) [GCC 13.3.0]
Linux-5.15.0-124-generic-x86_64-with-glibc2.31

Session information updated at 2024-11-29 19:32

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions