ValueError: b'There are other near singularities as well. 0.090619\n'

See original GitHub issue
  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of scanpy.

Hi,

Trying to run scVI to analyse my data using the latest scanpy+scvi-tools workflow, as described here.

However, I’m running into a weird issue with the new seurat_v3 flavour to call HVGs. When I run this:

sc.pp.highly_variable_genes(
    adata,
    flavor = "seurat_v3",
    n_top_genes = 7000,
    layer = "counts",
    batch_key = "combined",
    subset = True
)

I get the following error:

If you pass `n_top_genes`, all cutoffs are ignored.
extracting highly variable genes
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-19-3748de5bacdc> in <module>
      5     layer = "counts",
      6     batch_key = "combined",
----> 7     subset = True
      8 )
      9 adata

/opt/conda/lib/python3.7/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)
    420             span=span,
    421             subset=subset,
--> 422             inplace=inplace,
    423         )
    424 

/opt/conda/lib/python3.7/site-packages/scanpy/preprocessing/_highly_variable_genes.py in _highly_variable_genes_seurat_v3(adata, layer, n_top_genes, batch_key, span, subset, inplace)
     82         x = np.log10(mean[not_const])
     83         model = loess(x, y, span=span, degree=2)
---> 84         model.fit()
     85         estimat_var[not_const] = model.outputs.fitted_values
     86         reg_std = np.sqrt(10 ** estimat_var)

_loess.pyx in _loess.loess.fit()

ValueError: b'There are other near singularities as well. 0.090619\n'

While looking for a solution, I came across this issue that reports a similar problem.

Any ideas of what this may be?

Thanks

Versions

[WARNING: If you miss a compact list, please try print_header!

anndata 0.7.4 scanpy 1.6.0 sinfo 0.3.1

PIL 8.0.1 SCCAF NA anndata 0.7.4 backcall 0.1.0 cffi 1.14.3 colorama 0.4.4 cycler 0.10.0 cython_runtime NA dateutil 2.8.1 decorator 4.4.1 get_version 2.1 google NA h5py 2.10.0 igraph 0.8.0 importlib_metadata 1.7.0 ipykernel 5.1.4 ipython_genutils 0.2.0 ipywidgets 7.5.1 jedi 0.16.0 joblib 0.17.0 kiwisolver 1.1.0 legacy_api_wrap 1.2 leidenalg 0.8.2 llvmlite 0.31.0 louvain 0.6.1 matplotlib 3.1.3 mpl_toolkits NA natsort 7.0.1 numba 0.48.0 numexpr 2.7.1 numpy 1.19.4 packaging 20.4 pandas 1.1.4 parso 0.6.1 patsy 0.5.1 pexpect 4.8.0 pickleshare 0.7.5 pkg_resources NA prompt_toolkit 3.0.3 psutil 5.7.2 ptyprocess 0.6.0 pycparser 2.20 pygments 2.7.2 pyparsing 2.4.7 pytz 2020.1 rich NA ruamel NA scanpy 1.6.0 scipy 1.5.4 scvi 0.7.1 seaborn 0.10.0 setuptools_scm NA sinfo 0.3.1 six 1.15.0 sklearn 0.23.2 statsmodels 0.11.1 storemagic NA tables 3.6.1 texttable 1.6.2 threadpoolctl 2.1.0 torch 1.6.0 tornado 6.0.3 tqdm 4.32.2 traitlets 4.3.3 typing_extensions NA umap 0.3.10 wcwidth NA yaml 5.3.1 zipp NA zmq 19.0.0

IPython 7.12.0 jupyter_client 6.0.0 jupyter_core 4.6.3 jupyterlab 1.2.5 notebook 6.0.3

Python 3.7.6 | packaged by conda-forge | (default, Jan 7 2020, 22:33:48) [GCC 7.3.0] Linux-4.4.0-189-generic-x86_64-with-debian-buster-sid 24 logical CPU cores, x86_64

Session information updated at 2020-11-23 09:17

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ivirshupcommented, Nov 24, 2020

Seems like this is a known issue in the source library: https://github.com/has2k1/scikit-misc/issues/9.

I don’t think I could comment much more off the top of my head. @adamgayoso, do you have any suggestions here? Is trying to increase the span fine?

0reactions
xiachenruicommented, Mar 25, 2022

I think the problem happen when some category in ‘batch_key’ only have one sample

Read more comments on GitHub >

github_iconTop Results From Across the Web

b'There are other near singularities as well. 0.090619\n ...
Trying to run scVI to analyse my data using the latest scanpy+scvi-tools workflow, as described here. However, I'm running into a weird issue ......
Read more >
LOESS warnings/errors related to span in R - Stack Overflow
4: In simpleLoess(y, x, w, span, degree = degree, parametric = parametric, : There are other near singularities as well. 6.1623e+005.
Read more >
R warnings - simpleLoess, pseudoinverse etc - tidyverse
I am getting lot of warning while plotting data using ggplot2. Code below seems to work fine. > library(tidyverse) > ggplot(mpg) + ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found