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

Index Error in priors.py #343

Open
Ratoncito opened this issue Mar 26, 2024 · 2 comments
Open

Index Error in priors.py #343

Ratoncito opened this issue Mar 26, 2024 · 2 comments
Labels
enhancement New feature or improvement

Comments

@Ratoncito
Copy link

Ran ~ 70 .h5 files through cellbender sbatch array script and all but one file completed successfully. One file gave the following error:

cellbender:remove-background: Command:
cellbender remove-background --cuda --input ../../data/D22-5737_raw_feature_bc_matrix.h5 --output D22-5737_background_removed_raw_feature_bc_matrix.h5
cellbender:remove-background: CellBender 0.3.0
cellbender:remove-background: (Workflow hash 6c01e194fa)
cellbender:remove-background: 2024-03-26 11:10:27
cellbender:remove-background: Running remove-background
cellbender:remove-background: Loading data from ../../data/D22-5737_raw_feature_bc_matrix.h5
cellbender:remove-background: CellRanger v3 format
cellbender:remove-background: Features in dataset: 32285 Gene Expression
cellbender:remove-background: Trimming features for inference.
cellbender:remove-background: 7855 features have nonzero counts.
Traceback (most recent call last):
  File "/net/vast-storage.ib.cluster/scratch/vast/kellislab/shared/software/miniconda3/envs/cellbender/bin/cellbender", line 8, in <module>
    sys.exit(main())
  File "/net/vast-storage.ib.cluster/scratch/vast/kellislab/shared/software/miniconda3/envs/cellbender/lib/python3.7/site-packages/cellbender/base_cli.py", line 118, in main
    cli_dict[args.tool].run(args)
  File "/net/vast-storage.ib.cluster/scratch/vast/kellislab/shared/software/miniconda3/envs/cellbender/lib/python3.7/site-packages/cellbender/remove_background/cli.py", line 185, in run
    return main(args)
  File "/net/vast-storage.ib.cluster/scratch/vast/kellislab/shared/software/miniconda3/envs/cellbender/lib/python3.7/site-packages/cellbender/remove_background/cli.py", line 230, in main
    posterior = run_remove_background(args)
  File "/net/vast-storage.ib.cluster/scratch/vast/kellislab/shared/software/miniconda3/envs/cellbender/lib/python3.7/site-packages/cellbender/remove_background/run.py", line 84, in run_remove_background
    dataset_obj = get_dataset_obj(args=args)
  File "/net/vast-storage.ib.cluster/scratch/vast/kellislab/shared/software/miniconda3/envs/cellbender/lib/python3.7/site-packages/cellbender/remove_background/data/dataset.py", line 538, in get_dataset_obj
    fpr=args.fpr,
  File "/net/vast-storage.ib.cluster/scratch/vast/kellislab/shared/software/miniconda3/envs/cellbender/lib/python3.7/site-packages/cellbender/remove_background/data/dataset.py", line 116, in __init__
    self.priors = get_priors(umi_counts=counts, low_count_threshold=low_count_threshold)
  File "/net/vast-storage.ib.cluster/scratch/vast/kellislab/shared/software/miniconda3/envs/cellbender/lib/python3.7/site-packages/cellbender/remove_background/data/priors.py", line 337, in get_priors
    low_count_threshold=low_count_threshold,
  File "/net/vast-storage.ib.cluster/scratch/vast/kellislab/shared/software/miniconda3/envs/cellbender/lib/python3.7/site-packages/cellbender/remove_background/data/priors.py", line 237, in get_cell_count_empty_count
    cell_count_low_limit=cell_count_low_limit,
  File "/net/vast-storage.ib.cluster/scratch/vast/kellislab/shared/software/miniconda3/envs/cellbender/lib/python3.7/site-packages/cellbender/remove_background/data/priors.py", line 98, in _peak_density_given_cutoff
    noncell_counts = np.sort(noncell_counts)[::-1][inds]
IndexError: index 0 is out of bounds for axis 0 with size 0

Turns out this sample is just really really poor quality and (probably) none of the cells passed the min requirements for number of features or counts. Maybe the cellbender dev team could include an error catch or message at one of the above lines of code to help future users figure this out more quickly. Or even run a quick QC on the samples before they are run.

image

Or I could be wrong and this is not the reason it failed. Not 100% sure but thought I would share my experience with the community.

@sjfleming
Copy link
Member

Thanks for sharing @Ratoncito , and yes I think you are right! I should fix this so that it gives a real error message and not a cryptic IndexError.

@sjfleming sjfleming added the enhancement New feature or improvement label Apr 22, 2024
@albert239825
Copy link

Hi, I am also getting this issue, however, I have a pretty big dataset and don't think the lack of quality cells is the issue. I have run it on the the original dataset as well as the dataset after QC and arrived at the same issue.
#190 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement
Projects
Status: To Do
Development

No branches or pull requests

3 participants