scverse / scanpy

Single-cell analysis in Python. Scales to >1M cells.
https://scanpy.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.93k stars 603 forks source link

fix bug for partial_fit when the number of batch samples is less than n_comp #3313

Open DingWB opened 1 month ago

DingWB commented 1 month ago

For example, my adata.shape[0] is 1041 and I run IncrementalPCA sc.tl.pca(adata, n_comps=100, chunked=True,chunk_size=1000), and I got an error: ValueError: n_components=100 must be less or equal to the batch number of samples 40 on scanpy/preprocessing/_pca.py:256