broadinstitute / CellBender

CellBender is a software package for eliminating technical artifacts from high-throughput single-cell RNA sequencing (scRNA-seq) data.
https://cellbender.rtfd.io
BSD 3-Clause "New" or "Revised" License
271 stars 50 forks source link

Is it possible to adjust the priors so that cellbender can work with shallow-sequenced data? #353

Open onurcanbektas opened 2 months ago

onurcanbektas commented 2 months ago

Is it possible to adjust the priors so that cellbender can work with shallow-sequenced data?

At the moment, possibly because of the fewer number of counts in droplet, it is giving me this error in a shallow-sequnced data:

cellbender:remove-background: CellBender 0.3.0 cellbender:remove-background: (Workflow hash 84b52a7a4f) cellbender:remove-background: 2024-03-24 14:01:33 cellbender:remove-background: Running remove-background cellbender:remove-background: Loading data from /scratch/o/Onurcan.Bektas/axolotl.rulands.yun/data/230112ITR/cooked/cellranger.gex_only.cellbender//sn188/raw_feature_bc_matrix.h5 cellbender:remove-background: CellRanger v3 format cellbender:remove-background: WARNING: Only 45938 barcodes in the input file. Ensure this is a raw (unfiltered) file with all barcodes, including the empty droplets. cellbender:remove-background: Features in dataset: 99102 Gene Expression cellbender:remove-background: Excluding Peaks features (output will equal input). cellbender:remove-background: - This results in the exclusion of 0 features. cellbender:remove-background: Trimming features for inference. cellbender:remove-background: 17873 features have nonzero counts. /home/o/Onurcan.Bektas/.local/lib/python3.10/site-packages/cellbender/remove_background/data/priors.py:144: RuntimeWarning: divide by zero encountered in log cell_counts = np.exp(np.mean(np.log(umi_counts[order][:expected_cells]))).item() /home/o/Onurcan.Bektas/.local/lib/python3.10/site-packages/cellbender/remove_background/data/priors.py:170: RuntimeWarning: divide by zero encountered in log cell_counts = np.exp(np.mean(np.log(umi_counts[order][:expected_cells]))).item() /home/o/Onurcan.Bektas/.local/lib/python3.10/site-packages/cellbender/remove_background/data/priors.py:383: RuntimeWarning: divide by zero encountered in log log_counts_crossover = (np.log(surely_empty_counts) + np.log(priors['cell_counts'])) / 2 cellbender:remove-background: Prior on counts for cells is 0 cellbender:remove-background: Prior on counts for empty droplets is 0 Traceback (most recent call last): File "/home/o/Onurcan.Bektas/.local/bin/cellbender", line 8, in sys.exit(main()) File "/home/o/Onurcan.Bektas/.local/lib/python3.10/site-packages/cellbender/base_cli.py", line 118, in main cli_dict[args.tool].run(args) File "/home/o/Onurcan.Bektas/.local/lib/python3.10/site-packages/cellbender/remove_background/cli.py", line 185, in run return main(args) File "/home/o/Onurcan.Bektas/.local/lib/python3.10/site-packages/cellbender/remove_background/cli.py", line 230, in main posterior = run_remove_background(args) File "/home/o/Onurcan.Bektas/.local/lib/python3.10/site-packages/cellbender/remove_background/run.py", line 84, in run_remove_background dataset_obj = get_dataset_obj(args=args) File "/home/o/Onurcan.Bektas/.local/lib/python3.10/site-packages/cellbender/remove_background/data/dataset.py", line 526, in get_dataset_obj return SingleCellRNACountsDataset( File "/home/o/Onurcan.Bektas/.local/lib/python3.10/site-packages/cellbender/remove_background/data/dataset.py", line 167, in init self._trim_noiseless_features() File "/home/o/Onurcan.Bektas/.local/lib/python3.10/site-packages/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 "/software/opt/focal/x86_64/python/3.10-2022.08/lib/python3.10/site-packages/scipy/sparse/_base.py", line 1191, in mean return (inter_self * (1.0 / self.shape[0])).sum( ZeroDivisionError: float division by zero