question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IndexError with remove-background

See original GitHub issue

Hey! We are running into a weird indexing error when trying to run remove-background on our dataset.

We run the following command:

cellbender remove-background --input /path/to/filtered_feature_bc_matrix.h5 --output /path/to/filtered_feature_bc_matrix_Cellbender.h5 --expected-cells 13000 --total-droplets-included 20000 --fpr 0.01 --epochs 150

And get this error message:

cellbender:remove-background: 2022-07-22 15:38:16
cellbender:remove-background: Running remove-background
cellbender:remove-background: Loading data from file /path/to/filtered_feature_bc_matrix.h5
cellbender:remove-background: CellRanger v3 format
cellbender:remove-background: Trimming dataset for inference.
cellbender:remove-background: Including 21515 genes that have nonzero counts.
cellbender:remove-background: Prior on counts in empty droplets is 1479
cellbender:remove-background: Prior on counts for cells is 4829
cellbender:remove-background: Excluding barcodes with counts below 739
Traceback (most recent call last):
  File "/home/user/anaconda3/envs/cellbender2/bin/cellbender", line 33, in <module>
    sys.exit(load_entry_point('cellbender', 'console_scripts', 'cellbender')())
  File "/mnt/c/Users/User/Karl/Python/Projects/CellBender/cellbender/base_cli.py", line 101, in main
    cli_dict[args.tool].run(args)
  File "/mnt/c/Users/User/Karl/Python/Projects/CellBender/cellbender/remove_background/cli.py", line 109, in run
    main(args)
  File "/mnt/c/Users/User/Karl/Python/Projects/CellBender/cellbender/remove_background/cli.py", line 204, in main
    run_remove_background(args)
  File "/mnt/c/Users/User/Karl/Python/Projects/CellBender/cellbender/remove_background/cli.py", line 159, in run_remove_background
    fpr=args.fpr)
  File "/mnt/c/Users/User/Karl/Python/Projects/CellBender/cellbender/remove_background/data/dataset.py", line 101, in __init__
    gene_blacklist=gene_blacklist)
  File "/mnt/c/Users/User/Karl/Python/Projects/CellBender/cellbender/remove_background/data/dataset.py", line 339, in _trim_dataset_for_analysis
    [last_analyzed_bc])
IndexError: index 15845 is out of bounds for axis 0 with size 15845

The input file is the output we get from CellRanger and it opens without problems in Scanpy. Is there anything we could try to resolve the issue or are we missing something obvious?

Full list of installed packages

Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                  2_kmp_llvm    conda-forge
alabaster                 0.7.12                     py_0    conda-forge
alsa-lib                  1.2.6.1              h7f98852_0    conda-forge
anndata                   0.8.0              pyhd8ed1ab_1    conda-forge
argon2-cffi               21.3.0             pyhd8ed1ab_0    conda-forge
argon2-cffi-bindings      21.2.0           py37h540881e_2    conda-forge
attr                      2.5.1                h166bdaf_0    conda-forge
attrs                     21.4.0             pyhd8ed1ab_0    conda-forge
babel                     2.10.3             pyhd8ed1ab_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
beautifulsoup4            4.11.1             pyha770c72_0    conda-forge
blas                      2.115                       mkl    conda-forge
blas-devel                3.9.0            15_linux64_mkl    conda-forge
bleach                    5.0.1              pyhd8ed1ab_0    conda-forge
blosc                     1.21.1               h83bc5f7_3    conda-forge
brotli                    1.0.9                h166bdaf_7    conda-forge
brotli-bin                1.0.9                h166bdaf_7    conda-forge
brotlipy                  0.7.0           py37h540881e_1004    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2022.6.15            ha878542_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
cellbender                0.2.0                     dev_0    <develop>
certifi                   2022.6.15        py37h89c1867_0    conda-forge
cffi                      1.15.1           py37h43b0acd_0    conda-forge
charset-normalizer        2.1.0              pyhd8ed1ab_0    conda-forge
click                     8.1.3            py37h89c1867_0    conda-forge
colorama                  0.4.5              pyhd8ed1ab_0    conda-forge
cryptography              37.0.4           py37h38fbfac_0    conda-forge
cudatoolkit               11.6.0              hecad31d_10    conda-forge
curl                      7.83.1               h7bff187_0    conda-forge
cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
dbus                      1.13.6               h5008d03_3    conda-forge
debugpy                   1.6.0            py37hd23a5d3_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
docutils                  0.17.1                   pypi_0    pypi
dunamai                   1.12.0             pyhd8ed1ab_0    conda-forge
entrypoints               0.4                pyhd8ed1ab_0    conda-forge
expat                     2.4.8                h27087fc_0    conda-forge
ffmpeg                    4.3                  hf484d3e_0    pytorch
fftw                      3.3.10          nompi_h77c792f_102    conda-forge
flit-core                 3.7.1              pyhd8ed1ab_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.14.0               h8e229c2_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.34.4           py37h540881e_0    conda-forge
freetype                  2.10.4               h0708190_1    conda-forge
get_version               3.5.4              pyhd8ed1ab_0    conda-forge
gettext                   0.19.8.1          h73d1719_1008    conda-forge
giflib                    5.2.1                h36c2ea0_2    conda-forge
git                       2.37.1          pl5321h36853c3_0    conda-forge
glib                      2.72.1               h6239696_0    conda-forge
glib-tools                2.72.1               h6239696_0    conda-forge
gmp                       6.2.1                h58526e2_0    conda-forge
gnutls                    3.6.13               h85f3911_1    conda-forge
gst-plugins-base          1.20.3               hf6a322e_0    conda-forge
gstreamer                 1.20.3               hd4edc92_0    conda-forge
h5py                      3.6.0           nompi_py37hd308b1e_100    conda-forge
hdf5                      1.12.1          nompi_h2386368_104    conda-forge
icu                       70.1                 h27087fc_0    conda-forge
idna                      3.3                pyhd8ed1ab_0    conda-forge
imagesize                 1.4.1              pyhd8ed1ab_0    conda-forge
importlib-metadata        4.11.4           py37h89c1867_0    conda-forge
importlib_metadata        4.11.4               hd8ed1ab_0    conda-forge
importlib_resources       5.8.0              pyhd8ed1ab_0    conda-forge
ipykernel                 6.15.1             pyh210e3f2_0    conda-forge
ipython                   7.33.0           py37h89c1867_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
ipywidgets                7.7.1              pyhd8ed1ab_0    conda-forge
jack                      1.9.18            h8c3723f_1002    conda-forge
jedi                      0.18.1           py37h89c1867_1    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
joblib                    1.1.0              pyhd8ed1ab_0    conda-forge
jpeg                      9e                   h166bdaf_2    conda-forge
jsonschema                4.7.2              pyhd8ed1ab_0    conda-forge
jupyter                   1.0.0            py37h89c1867_7    conda-forge
jupyter_client            7.3.4              pyhd8ed1ab_0    conda-forge
jupyter_console           6.4.4              pyhd8ed1ab_0    conda-forge
jupyter_core              4.11.1           py37h89c1867_0    conda-forge
jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
jupyterlab_widgets        1.1.1              pyhd8ed1ab_0    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
kiwisolver                1.4.4            py37h7cecad7_0    conda-forge
krb5                      1.19.3               h3790be6_0    conda-forge
lame                      3.100             h7f98852_1001    conda-forge
lcms2                     2.12                 hddcbb42_0    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
legacy-api-wrap           1.2                        py_0    conda-forge
lerc                      3.0                  h9c3ff4c_0    conda-forge
libblas                   3.9.0            15_linux64_mkl    conda-forge
libbrotlicommon           1.0.9                h166bdaf_7    conda-forge
libbrotlidec              1.0.9                h166bdaf_7    conda-forge
libbrotlienc              1.0.9                h166bdaf_7    conda-forge
libcap                    2.64                 ha37c62d_0    conda-forge
libcblas                  3.9.0            15_linux64_mkl    conda-forge
libclang                  14.0.6          default_h2e3cab8_0    conda-forge
libclang13                14.0.6          default_h3a83d3e_0    conda-forge
libcups                   2.3.3                hf5a7f15_1    conda-forge
libcurl                   7.83.1               h7bff187_0    conda-forge
libdb                     6.2.32               h9c3ff4c_0    conda-forge
libdeflate                1.12                 h166bdaf_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libevent                  2.1.10               h9b69904_4    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libflac                   1.3.4                h27087fc_0    conda-forge
libgcc-ng                 12.1.0              h8d9b700_16    conda-forge
libgfortran-ng            12.1.0              h69a702a_16    conda-forge
libgfortran5              12.1.0              hdcd56e2_16    conda-forge
libglib                   2.72.1               h2d90d5f_0    conda-forge
libgomp                   12.1.0              h8d9b700_16    conda-forge
libiconv                  1.16                 h516909a_0    conda-forge
liblapack                 3.9.0            15_linux64_mkl    conda-forge
liblapacke                3.9.0            15_linux64_mkl    conda-forge
libllvm11                 11.1.0               hf817b99_3    conda-forge
libllvm14                 14.0.6               he0ac6c6_0    conda-forge
libnghttp2                1.47.0               h727a467_0    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libogg                    1.3.4                h7f98852_1    conda-forge
libopenblas               0.3.20          pthreads_h78a6416_0    conda-forge
libopus                   1.3.1                h7f98852_1    conda-forge
libpng                    1.6.37               h753d276_3    conda-forge
libpq                     14.4                 hd77ab85_0    conda-forge
libsndfile                1.0.31               h9c3ff4c_1    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libssh2                   1.10.0               ha56f1ee_2    conda-forge
libstdcxx-ng              12.1.0              ha89aaad_16    conda-forge
libtiff                   4.4.0                hc85c160_1    conda-forge
libtool                   2.4.6             h9c3ff4c_1008    conda-forge
libudev1                  249                  h166bdaf_4    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
libwebp                   1.2.3                h522a892_0    conda-forge
libwebp-base              1.2.3                h166bdaf_0    conda-forge
libxcb                    1.13              h7f98852_1004    conda-forge
libxkbcommon              1.0.3                he3ba5ed_0    conda-forge
libxml2                   2.9.14               h22db469_3    conda-forge
libzlib                   1.2.12               h166bdaf_2    conda-forge
llvm-openmp               14.0.4               he0ac6c6_0    conda-forge
llvmlite                  0.38.1           py37h0761922_0    conda-forge
loompy                    3.0.6                      py_0    conda-forge
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
lzo                       2.10              h516909a_1000    conda-forge
markupsafe                2.1.1            py37h540881e_1    conda-forge
matplotlib                3.5.2            py37h89c1867_0    conda-forge
matplotlib-base           3.5.2            py37hc347a89_0    conda-forge
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
mistune                   0.8.4           py37h5e8e339_1005    conda-forge
mkl                       2022.1.0           h84fe81f_915    conda-forge
mkl-devel                 2022.1.0           ha770c72_916    conda-forge
mkl-include               2022.1.0           h84fe81f_915    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
mysql-common              8.0.29               haf5c9bc_1    conda-forge
mysql-libs                8.0.29               h28c427c_1    conda-forge
natsort                   8.1.0              pyhd8ed1ab_0    conda-forge
nbclient                  0.6.6              pyhd8ed1ab_0    conda-forge
nbconvert                 6.5.0              pyhd8ed1ab_0    conda-forge
nbconvert-core            6.5.0              pyhd8ed1ab_0    conda-forge
nbconvert-pandoc          6.5.0              pyhd8ed1ab_0    conda-forge
nbformat                  5.4.0              pyhd8ed1ab_0    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
nest-asyncio              1.5.5              pyhd8ed1ab_0    conda-forge
nettle                    3.6                  he412f7d_0    conda-forge
networkx                  2.7.1              pyhd8ed1ab_0    conda-forge
notebook                  6.4.12             pyha770c72_0    conda-forge
nspr                      4.32                 h9c3ff4c_1    conda-forge
nss                       3.78                 h2350873_0    conda-forge
numba                     0.55.2           py37h43839f2_0    conda-forge
numexpr                   2.7.3            py37he8f5f7f_1    conda-forge
numpy                     1.21.6           py37h976b520_0    conda-forge
numpy_groupies            0.9.17             pyhd8ed1ab_0    conda-forge
openh264                  2.1.1                h780b84a_0    conda-forge
openjpeg                  2.4.0                hb52868f_1    conda-forge
openssl                   1.1.1q               h166bdaf_0    conda-forge
opt-einsum                3.3.0                    pypi_0    pypi
packaging                 21.3               pyhd8ed1ab_0    conda-forge
pandas                    1.3.5            py37he8f5f7f_0    conda-forge
pandoc                    2.18                 ha770c72_0    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
patsy                     0.5.2              pyhd8ed1ab_0    conda-forge
pcre                      8.45                 h9c3ff4c_0    conda-forge
pcre2                     10.37                h032f7d1_0    conda-forge
perl                      5.32.1          2_h7f98852_perl5    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    9.2.0            py37h44f0d7a_0    conda-forge
pip                       22.1.2             pyhd8ed1ab_0    conda-forge
ply                       3.11                       py_1    conda-forge
portaudio                 19.6.0               h57a0ea0_5    conda-forge
prometheus_client         0.14.1             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.30             pyha770c72_0    conda-forge
prompt_toolkit            3.0.30               hd8ed1ab_0    conda-forge
psutil                    5.9.1            py37h540881e_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pulseaudio                14.0                 h7f54b18_8    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pygments                  2.12.0             pyhd8ed1ab_0    conda-forge
pynndescent               0.5.7              pyh6c4a22f_0    conda-forge
pyopenssl                 22.0.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.9              pyhd8ed1ab_0    conda-forge
pyqt                      5.15.7           py37hf30b843_0    conda-forge
pyqt5-sip                 12.11.0          py37hd23a5d3_0    conda-forge
pyro-api                  0.1.2              pyhd8ed1ab_0    conda-forge
pyro-ppl                  1.8.1                    pypi_0    pypi
pyrsistent                0.18.1           py37h540881e_1    conda-forge
pysocks                   1.7.1            py37h89c1867_5    conda-forge
pytables                  3.7.0            py37h5dea08b_0    conda-forge
python                    3.7.12          hb7a2778_100_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-fastjsonschema     2.16.1             pyhd8ed1ab_0    conda-forge
python_abi                3.7                     2_cp37m    conda-forge
pytorch                   1.12.0          py3.7_cuda11.6_cudnn8.3.2_0    pytorch
pytorch-mutex             1.0                        cuda    pytorch
pytz                      2022.1             pyhd8ed1ab_0    conda-forge
pyzmq                     23.2.0           py37h0c0c2a8_0    conda-forge
qt-main                   5.15.4               ha5833f6_2    conda-forge
qtconsole                 5.3.1              pyhd8ed1ab_0    conda-forge
qtconsole-base            5.3.1              pyha770c72_0    conda-forge
qtpy                      2.1.0              pyhd8ed1ab_0    conda-forge
readline                  8.1.2                h0f457ee_0    conda-forge
requests                  2.28.1             pyhd8ed1ab_0    conda-forge
scanpy                    1.8.2              pyhd8ed1ab_0    conda-forge
scikit-learn              1.0.2            py37hf9e9bfc_0    conda-forge
scipy                     1.7.3            py37hf2a6cf1_0    conda-forge
seaborn                   0.11.2               hd8ed1ab_0    conda-forge
seaborn-base              0.11.2             pyhd8ed1ab_0    conda-forge
send2trash                1.8.0              pyhd8ed1ab_0    conda-forge
session-info              1.0.0              pyhd8ed1ab_0    conda-forge
setuptools                59.8.0           py37h89c1867_1    conda-forge
sinfo                     0.3.1                      py_0    conda-forge
sip                       6.6.2            py37hd23a5d3_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snappy                    1.1.9                hbd366e4_1    conda-forge
snowballstemmer           2.2.0              pyhd8ed1ab_0    conda-forge
soupsieve                 2.3.2.post1        pyhd8ed1ab_0    conda-forge
sphinx                    5.0.2              pyh6c4a22f_0    conda-forge
sphinx-argparse           0.3.1                    pypi_0    pypi
sphinx-autodoc-typehints  1.18.3                   pypi_0    pypi
sphinx-rtd-theme          1.0.0                    pypi_0    pypi
sphinxcontrib-applehelp   1.0.2                      py_0    conda-forge
sphinxcontrib-devhelp     1.0.2                      py_0    conda-forge
sphinxcontrib-htmlhelp    2.0.0              pyhd8ed1ab_0    conda-forge
sphinxcontrib-jsmath      1.0.1                      py_0    conda-forge
sphinxcontrib-programoutput 0.17                     pypi_0    pypi
sphinxcontrib-qthelp      1.0.3                      py_0    conda-forge
sphinxcontrib-serializinghtml 1.1.5              pyhd8ed1ab_2    conda-forge
sqlite                    3.39.1               h4ff8645_0    conda-forge
statsmodels               0.13.2           py37hda87dfa_0    conda-forge
stdlib-list               0.7.0                      py_2    conda-forge
tbb                       2021.5.0             h924138e_1    conda-forge
terminado                 0.15.0           py37h89c1867_0    conda-forge
threadpoolctl             3.1.0              pyh8a188c0_0    conda-forge
tinycss2                  1.1.1              pyhd8ed1ab_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
torchaudio                0.12.0               py37_cu116    pytorch
torchvision               0.13.0               py37_cu116    pytorch
tornado                   6.2              py37h540881e_0    conda-forge
tqdm                      4.64.0             pyhd8ed1ab_0    conda-forge
traitlets                 5.3.0              pyhd8ed1ab_0    conda-forge
typing-extensions         4.3.0                hd8ed1ab_0    conda-forge
typing_extensions         4.3.0              pyha770c72_0    conda-forge
umap-learn                0.5.3            py37h89c1867_0    conda-forge
unicodedata2              14.0.0           py37h540881e_1    conda-forge
urllib3                   1.26.10            pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
widgetsnbextension        3.6.1              pyha770c72_0    conda-forge
xcb-util                  0.4.0                h516909a_0    conda-forge
xcb-util-image            0.4.0                h166bdaf_0    conda-forge
xcb-util-keysyms          0.4.0                h516909a_0    conda-forge
xcb-util-renderutil       0.3.9                h166bdaf_0    conda-forge
xcb-util-wm               0.4.1                h516909a_0    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
zeromq                    4.3.4                h9c3ff4c_1    conda-forge
zipp                      3.8.0              pyhd8ed1ab_0    conda-forge
zlib                      1.2.12               h166bdaf_2    conda-forge
zstd                      1.5.2                h8a70e8d_2    conda-forge

Thanks!

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
diigpcommented, Jul 27, 2022

Hello @sjfleming, I have just sent an email sharing the file. And yes, we installed that CellBender version. Many thanks.

0reactions
sjflemingcommented, Aug 5, 2022

@vkartha how many total droplet barcodes are included in your h5ad file? Do you include all the empty droplets?

Read more comments on GitHub >

github_iconTop Results From Across the Web

remove-background option raises exception for some files #725
Describe the bug. Running ocrmypdf with the --remove-background option produces an error and quits. To Reproduce
Read more >
python - Unexpected IndexError while removing list items
You are changing the length of the list while looping over a range that goes up to the starting length of the list;...
Read more >
IndexError'Invalid Index') (Example) | Treehouse Community
Any idea why I keep getting the Invalid Index Error, I have raised the IndexError, but it wouldn't pass. Thank you.
Read more >
How to fix a JIRA application that is unable to perform a ...
... that is unable to perform a background re-index "at this time error" ... If possible, test any alter, insert, update, or delete...
Read more >
Remove the background of a picture in Office - Microsoft Support
Learn how to remove the background from a picture in a Microsoft Office file. Use the automatic background removal or draw lines to...
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