theislab / scib

Benchmarking analysis of data integration tools
MIT License
294 stars 63 forks source link

pcr when cells per batch is less than 50 #313

Closed jayypaul closed 2 years ago

jayypaul commented 2 years ago

Some of my samples (batch) have less than 50 cells (doing an analysis of cell compartments of a sample so I'm looking at much less of the total cell number for the original sample), thus I get this error:

in pc_regression pca = sc.tl.pca(matrix, n_comps=n_comps, use_highly_variable=False, File "/home/jaaayy/miniconda3/envs/scib/lib/python3.10/site-packages/scanpy/preprocessing/_pca.py", line 195, in pca raise ValueError( ValueError: svd_solver: {svd_solver} can not be used with sparse input. Use "arpack" (the default) or "lobpcg" instead.

Anyway to add option for this case so I can use the convenience functions without having to run the internal code myself piece by piece? For some reason this only happens with scib.metrics.cell_cycle and not scib.metrics.pcr thought... not sure why..

Would be greatly appreciated!!

jayypaul commented 2 years ago

Nevermind, i fixed with:

import scipy.sparse

temp=object.copy() temp.X = temp.X.todense()