scanpy icon indicating copy to clipboard operation
scanpy copied to clipboard

Kernel dies when using batch in highly_variable_genes()

Open joseph-siefert opened this issue 2 years ago • 1 comments

When I run:

sc.pp.highly_variable_genes(
    adata,
    flavor="seurat_v3",
    batch_key="batch",
    n_top_genes=2000,
    subset=False,
)```

kernel dies in about 60-90 seconds. I have plenty of available memory, so don't see why, but happens again and again.

If I comment out batch:

```pytb
sc.pp.highly_variable_genes(
    adata,
    flavor="seurat_v3",
    #batch_key="batch",
    n_top_genes=2000,
    subset=False,
)```

It finished in about 10 seconds.

#### Versions

<details>

-----
anndata     0.8.0
scanpy      1.10.0.dev57+g08be4e9
-----
PIL                                         9.4.0
aa8f2297d25b4dc6fd3d98411eb3ba53823c4f42    NA
absl                                        NA
adjustText                                  0.8
anyio                                       NA
arrow                                       1.2.3
arviz                                       0.15.0
asciitree                                   NA
asttokens                                   NA
astunparse                                  1.6.3
attr                                        22.2.0
babel                                       2.12.1
backcall                                    0.2.0
beta_ufunc                                  NA
binom_ufunc                                 NA
bokeh                                       2.4.3
brotli                                      NA
captum                                      0.6.0
cellrank                                    1.5.1
certifi                                     2023.05.07
cffi                                        1.15.1
charset_normalizer                          2.1.1
chex                                        0.1.6
cloudpickle                                 2.2.1
colorama                                    0.4.6
comm                                        0.1.2
contextlib2                                 NA
cycler                                      0.10.0
cython_runtime                              NA
cytoolz                                     0.12.0
dask                                        2023.3.0
dask_image                                  2022.09.0
dateutil                                    2.8.2
debugpy                                     1.6.6
decorator                                   5.1.1
decoupler                                   1.4.0
defusedxml                                  0.7.1
dill                                        0.3.6
docrep                                      0.3.2
dot_parser                                  NA
entrypoints                                 0.4
executing                                   1.2.0
fasteners                                   0.17.3
fastjsonschema                              NA
flatbuffers                                 23.1.21
flax                                        0.5.0
fqdn                                        NA
fsspec                                      2023.1.0
gast                                        NA
google                                      NA
gseapy                                      1.0.4
h5py                                        3.8.0
hypergeom_ufunc                             NA
idna                                        3.4
igraph                                      0.10.3
imagecodecs                                 2023.1.23
imageio                                     2.26.0
invgauss_ufunc                              NA
ipykernel                                   6.21.2
ipython_genutils                            0.2.0
ipywidgets                                  8.0.4
isoduration                                 NA
jax                                         0.4.10
jaxlib                                      0.4.10
jedi                                        0.18.2
jinja2                                      3.0.3
joblib                                      1.2.0
json5                                       NA
jsonpointer                                 2.3
jsonschema                                  4.17.3
jupyter_events                              0.6.3
jupyter_server                              2.3.0
jupyterlab_server                           2.19.0
keras                                       2.11.0
kiwisolver                                  1.4.4
leidenalg                                   0.9.1
lightning_fabric                            1.9.3
lightning_utilities                         0.7.0
llvmlite                                    0.39.1
lz4                                         4.3.2
markupsafe                                  2.1.2
matplotlib                                  3.7.1
matplotlib_inline                           0.1.6
matplotlib_scalebar                         0.8.1
ml_collections                              NA
ml_dtypes                                   0.1.0
mpl_toolkits                                NA
msgpack                                     1.0.4
mudata                                      0.2.1
multigrate                                  0.0.2
multipledispatch                            0.6.0
natsort                                     8.3.1
nbformat                                    5.7.3
nbinom_ufunc                                NA
ncf_ufunc                                   NA
nct_ufunc                                   NA
ncx2_ufunc                                  NA
networkx                                    3.0
newick                                      1.0.0
numba                                       0.56.4
numcodecs                                   0.11.0
numpy                                       1.23.5
numpyro                                     0.11.0
opt_einsum                                  v3.3.0
optax                                       0.1.4
packaging                                   23.0
pandas                                      1.5.3
parso                                       0.8.3
paste                                       NA
patsy                                       0.5.3
petsc4py                                    3.19.0
pexpect                                     4.8.0
pickleshare                                 0.7.5
pkg_resources                               NA
platformdirs                                3.0.0
progressbar                                 4.2.0
prometheus_client                           NA
prompt_toolkit                              3.0.38
psutil                                      5.9.4
ptyprocess                                  0.7.0
pure_eval                                   0.2.2
pvectorc                                    NA
pycparser                                   2.21
pydev_ipython                               NA
pydevconsole                                NA
pydevd                                      2.9.5
pydevd_file_utils                           NA
pydevd_plugins                              NA
pydevd_tracing                              NA
pydot                                       1.4.2
pygam                                       0.8.0
pygments                                    2.14.0
pygpcca                                     1.0.4
pyparsing                                   3.0.9
pyro                                        1.8.4+9ed468d
pyrsistent                                  NA
python_utils                                NA
pythonjsonlogger                            NA
pytorch_lightning                           1.9.3
pytz                                        2022.7.1
pywt                                        1.4.1
requests                                    2.28.2
rfc3339_validator                           0.1.4
rfc3986_validator                           0.1.1
rich                                        NA
scHPL                                       NA
scarches                                    0.5.7
sccoda                                      0.1.9
scipy                                       1.10.1
scvelo                                      0.2.5
scvi                                        0.20.1
seaborn                                     0.12.2
send2trash                                  NA
session_info                                1.0.0
setuptools                                  67.4.0
six                                         1.16.0
skewnorm_ufunc                              NA
skimage                                     0.19.3
sklearn                                     1.2.1
slepc4py                                    3.19.0
sniffio                                     1.3.0
socks                                       1.7.1
squidpy                                     1.2.2
stack_data                                  0.6.2
statsmodels                                 0.13.5
tblib                                       1.7.0
tcr_embedding                               NA
tensorboard                                 2.11.2
tensorflow                                  2.11.0
tensorflow_probability                      0.19.0
termcolor                                   NA
texttable                                   1.6.7
threadpoolctl                               3.1.0
tifffile                                    2023.2.28
tlz                                         0.12.0
toolz                                       0.12.0
torch                                       1.13.1
torch_cluster                               1.6.0
torch_geometric                             2.2.0
torch_scatter                               2.1.0
torch_sparse                                0.6.15
torchmetrics                                0.11.3
torchvision                                 0.14.1
tornado                                     6.2
tqdm                                        4.64.1
traitlets                                   5.9.0
tree                                        0.1.7
typing_extensions                           NA
unicodedata2                                NA
uri_template                                NA
urllib3                                     1.26.14
validators                                  0.20.0
wcwidth                                     0.2.6
webcolors                                   1.11.1
websocket                                   1.5.1
wrapt                                       1.15.0
xarray                                      2023.2.0
xarray_einstats                             0.5.1
yaml                                        6.0
zarr                                        2.13.6
zipp                                        NA
zmq                                         25.0.0
zoneinfo                                    NA
zope                                        NA
-----
IPython             8.11.0
jupyter_client      8.0.3
jupyter_core        5.2.0
jupyterlab          3.6.1
notebook            6.5.2
-----
Python 3.10.9 | packaged by conda-forge | (main, Feb  2 2023, 20:20:04) [GCC 11.3.0]
Linux-3.10.0-1160.83.1.el7.x86_64-x86_64-with-glibc2.17
-----
Session information updated at 2023-05-26 01:06

</details>

joseph-siefert avatar May 25 '23 23:05 joseph-siefert

Dear @joseph-siefert do you have an anndata object which can help us reproduce this, please?

Zethson avatar Jul 24 '25 12:07 Zethson