Skip to content

Commit

Permalink
fix crash filter_data due to cells with zero total counts
Browse files Browse the repository at this point in the history
  • Loading branch information
oospina committed Mar 22, 2024
1 parent 8a032e0 commit 40a6826
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions R/filter_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ filter_data = function(x=NULL,
col_expr_reads = colSums(df_tmp[grepl(spot_pct_expr, rownames(df_tmp)), ])
col_expr_percent = col_expr_reads/col_total_reads
rm(col_expr_reads) # Clean env
# Force NaNs tp zero, which result from zero as denominator (i.e., zero counts in the cell)
col_expr_percent[is.na(col_expr_percent)] = 0

# If no maximum counts set by user, then make it the max counts of each spot/cell
if(is.null(spot_maxreads)){
Expand Down

0 comments on commit 40a6826

Please sign in to comment.