scverse / scanpy

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

ValueError: b'svddc failed in l2fit when using flavor = 'seurat_v3' #2034

Open dm8000 opened 3 years ago

dm8000 commented 3 years ago

Selection of highly variable genes works fine in default settings, but I get an error when I try to use seurat_v3 flavor.

adata2.layers["counts"] = adata2.X.copy()
adata2.raw = adata2  # keep full dimension safe
sc.pp.normalize_total(adata2, target_sum=1e4)
sc.pp.log1p(adata2)
sc.pp.highly_variable_genes(
    adata2,
    flavor="seurat_v3",
    n_top_genes=3000,
    layer="counts",
    batch_key="Sample",
    subset=True
)
ValueError                                Traceback (most recent call last)
<ipython-input-18-64d280f5029c> in <module>
      3 sc.pp.normalize_total(adata2, target_sum=1e4)
      4 sc.pp.log1p(adata2)
----> 5 sc.pp.highly_variable_genes(
      6     adata2,
      7     flavor="seurat_v3",

/data04/projects04/MarianaBoroni/lbbc_members/lib/conda_envs/diogoamb/lib/python3.9/site-packages/scanpy/preprocessing/_highly_variable_genes.py in highly_variable_genes(adata, layer, n_top_genes, min_disp, max_disp, min_mean, max_mean, span, n_bins, flavor, subset, inplace, batch_key, check_values)
    417 
    418     if flavor == 'seurat_v3':
--> 419         return _highly_variable_genes_seurat_v3(
    420             adata,
    421             layer=layer,

/data04/projects04/MarianaBoroni/lbbc_members/lib/conda_envs/diogoamb/lib/python3.9/site-packages/scanpy/preprocessing/_highly_variable_genes.py in _highly_variable_genes_seurat_v3(adata, layer, n_top_genes, batch_key, check_values, span, subset, inplace)
     83         x = np.log10(mean[not_const])
     84         model = loess(x, y, span=span, degree=2)
---> 85         model.fit()
     86         estimat_var[not_const] = model.outputs.fitted_values
     87         reg_std = np.sqrt(10 ** estimat_var)

_loess.pyx in _loess.loess.fit()

ValueError: b'svddc failed in l2fit.'

Versions

0.10.00

ivirshup commented 3 years ago

I'm having trouble with reproducing with one of our built-in datasets (sc.datasets.pbmc3k), so I'm suspecting this is dataset specific.

mairi-mcclean commented 1 year ago

Hello!

Hoping to reopen this discussion as I've just encountered the same error whilst trying to do some label transfer via scArches

My reference object is AIDA PBMCs and my query data object is a combined object from here and here

Versions scanpy v1.9.3 scarches v0.5.9 anndata v0.9.2
numpy v1.24.4 pandas v2.0.3
scvi-tools v1.0.3