powellgenomicslab/Nebulosa

Make function density_plot to work smoothly with genes that have only zero read counts

Opened this issue · 0 comments

aghr commented

Dear Nebulosa developers,

Nice tool. I work with Nebulosa_1.8.0. One suggestion for improvement: If you run the function plot_density on a gene that has only zero counts, it currently throws a rather cryptic error and doesn't produce any plot:

Error in linbin2D.ks(x, gpoints[[1]], gpoints[[2]], w = w) :
NA/NaN/Inf in foreign function call (arg 10)
In addition: Warning message:
In ks.defaults(x = x, w = w, binned = binned, bgridsize = bgridsize, :
Weights don't sum to sample size - they have been scaled accordingly

Instead, the function could check the read counts and in case they are all zero generate a simple plot with all dots of color = zero counts omitting the density estimation in this case.

Background: I want to use Nebulosa in a script that runs automatically over genes and it may happen in a few cases that all their read counts are zero.