theislab / diffxpy

Differential expression analysis for single-cell RNA-seq data.
https://diffxpy.rtfd.io
BSD 3-Clause "New" or "Revised" License
179 stars 23 forks source link

TypeError: sum() got an unexpected keyword argument 'keepdims' #203

Closed Gibbsdavidl closed 2 years ago

Gibbsdavidl commented 2 years ago

Anyone know how to solve this?

Seems like it's a dask / pandas conflict.

I'm on ubuntu 20.04, pandas 1.3, and whatever the newest dask is (2021.7.0)?

Seems similar to this dask issue.

trying: test = de.test.pairwise( data=qci, grouping="coef", test="z-test", lazy=False, noise_model="nb" ) ## where qci is an anndata object

I can't get any of the wald or z-tests to work. t-test and rank sum are working.

Actually, using the sim data in the tutorial, it works... but still have this problem with real data.

Thank you!!

davidsebfischer commented 2 years ago

Might be derived from an issue arising with a dependency related to using sparse data, the quickest fix might be to turn adata.X dense.

Gibbsdavidl commented 2 years ago

Hmmm. Actually using dense matrix. Sorry missing that detail. Thanks for the idea. Might just strip it down until it's as close to the sim data as possible, see what the difference is.

Gibbsdavidl commented 2 years ago

So I've had a few problems disappear by making a new anndata object. Maybe the anndata I was using was from a slightly older version. Who knows. This can be closed.

q = My_Old_Adata

data = anndata.AnnData( X=q.X, var=q.var, obs=q.obs )

test_tt = de.test.wald( data=data, formula_loc="~ 1 + diagnosis", factor_loc_totest="diagnosis" )

davidsebfischer commented 2 years ago

Thank you for following this up! It may be that the old object messed up matrix typing somewhere. Good luck with the rest of the project!