Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled division by zero #363

Open
fm361 opened this issue May 30, 2024 · 0 comments
Open

Unhandled division by zero #363

fm361 opened this issue May 30, 2024 · 0 comments

Comments

@fm361
Copy link

fm361 commented May 30, 2024

Hello,

I'm trying to run cellbender 0.3.0 (python 3.8.19) on 10X data aligned with STARsolo. The data are quite shallow, so I expect lots of droplets with very low counts.

I repeatedly run into the following issue, which seems to be an edge case that is not handled.

cellbender:remove-background: Command:
cellbender remove-background --input Solo.out/Gene/raw --output Solo.out/Gene/cellbender.h5 --expected-cells 5000 --model full --z-dim 64 --z-layers 512 --estimator-multiple-cpu
cellbender:remove-background: CellBender 0.3.0
cellbender:remove-background: (Workflow hash f46bbc8ba0)
cellbender:remove-background: 2024-05-30 09:44:08
cellbender:remove-background: Running remove-background
cellbender:remove-background: Loading data from Solo.out/Gene/raw
cellbender:remove-background: CellRanger v2 format
cellbender:remove-background: Features in dataset: 38606 NA
cellbender:remove-background: Trimming features for inference.
cellbender:remove-background: 14717 features have nonzero counts.
cellbender:remove-background: Prior on counts for cells is 24
cellbender:remove-background: Prior on counts for empty droplets is 1
Traceback (most recent call last):
  File "/mnt/data/micromamba/envs/my_env/bin/cellbender", line 33, in <module>
    sys.exit(load_entry_point('cellbender', 'console_scripts', 'cellbender')())
  File "/mnt/data/micromamba/envs/my_env/opt/CellBender/cellbender/base_cli.py", line 123, in main
    cli_dict[args.tool].run(args)
  File "/mnt/data/micromamba/envs/my_env/opt/CellBender/cellbender/remove_background/cli.py", line 185, in run
    return main(args)
  File "/mnt/data/micromamba/envs/my_env/opt/CellBender/cellbender/remove_background/cli.py", line 230, in main
    posterior = run_remove_background(args)
  File "/mnt/data/micromamba/envs/my_env/opt/CellBender/cellbender/remove_background/run.py", line 84, in run_remove_background
    dataset_obj = get_dataset_obj(args=args)
  File "/mnt/data/micromamba/envs/my_env/opt/CellBender/cellbender/remove_background/data/dataset.py", line 526, in get_dataset_obj
    return SingleCellRNACountsDataset(
  File "/mnt/data/micromamba/envs/my_env/opt/CellBender/cellbender/remove_background/data/dataset.py", line 167, in __init__
    self._trim_noiseless_features()
  File "/mnt/data/micromamba/envs/my_env/opt/CellBender/cellbender/remove_background/data/dataset.py", line 290, in _trim_noiseless_features
    mean_counts_per_empty_g = np.array(count_matrix_empties.mean(axis=0)).squeeze()
  File "/mnt/data/micromamba/envs/my_env/lib/python3.8/site-packages/scipy/sparse/_base.py", line 1191, in mean
    return (inter_self * (1.0 / self.shape[0])).sum(
ZeroDivisionError: float division by zero
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant