PaulingLiu / ROGUE

Assessing the purity of single cell population
BSD 3-Clause "New" or "Revised" License
96 stars 12 forks source link

SE_fun function giving a error in predLoess #2

Closed makloufg closed 3 years ago

makloufg commented 3 years ago

Hi there,

I'm constantly using ROGUE to analyze my data following the tutorial available in the vignettes, but I had this error with some datasets when I run rogue():

Error in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), : NA/NaN/Inf in foreign function call (arg 5)

I tried to really deep dive into your code to see if I could debug cause initially, I thought that my data had some problem (like a NA value). But after some time, I think that's not the case. :pensive: What I was able to do was to isolate the problem: I found that the error happens when a pass the data into the SE_fun() - that's is inside rogue() - in line 348, file /R/ROGUE.R

I'm attaching the 'expr' in the file expr.txt so you can try to reproduce using the following parameters:

ROGUE:::SE_fun(new_exp, span=0.6, r =1)

expr.txt

ROGUE has been absolutely important to my analysis, so I'm hoping we can find what's going on :sweat_smile:

Thanks in advance!

PaulingLiu commented 3 years ago

Hi @giomaklouf. Thanks for using ROGUE in your analysis. It turns out that the small value of the parameter span is causing this problem. The parameter span controls the degree of smoothing for a loess fitting, but there would be errors when a small number of cells are used. A larger span value, for example 0.7, would address this. Please let me know if this works.

ROGUE::SE_fun(new_exp, span=0.7, r =1)
makloufg commented 3 years ago

It worked @PaulingLiu. Thanks for the assistance!