scverse / scverse/scanpy

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

Open
#2,034 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs info❔ Upstream
Dominant language
Python
Stars
2.6k
Forks
779
Avg merge
1d 4h
Merged PRs (30d)
27

Description

  • [x ] I have checked that this issue has not already been reported.
  • [ x] I have confirmed this bug exists on the latest version of scanpy.
  • (optional) I have confirmed this bug exists on the master branch of scanpy.

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the shown sc.pp.highly_variable_genes call with flavor="seurat_v3", layer="counts", and batch_key="Sample". Read scanpy/preprocessing/_highly_variable_genes.py around _highly_variable_genes_seurat_v3 and the _loess.pyx l2fit failure; done means the reported input no longer raises ValueError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
bioinformatics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.