PaulingLiu/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)

Dana11T opened this issue · 3 comments

I encountered an error when running this line of code, rogue.res <- rogue(expr, labels = meta$Tcluster, samples = meta$source, platform = "UMI", span = 0.6)
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)
In addition: There were 50 or more warnings (use warnings() to see the first 50)
Through tracing, I found that there was a problem during the calculation of prd <- predict(fit, .x$mean.expr) in SE_fun(), specifically in the ROGUE::entropy_fit step.
Here's what my data looks like, and I'm not quite sure where the problem is occurring. Can you provide some insights.
fit
Call:
loess(formula = entropy ~ mean.expr, data = tmp, span = span)

Number of Observations: 3379
Equivalent Number of Parameters: NaN
Residual Standard Error: NaN

.x$mean.expr
NOC2L ISG15 C1orf159 TNFRSF4 SDF4 B3GALT6 PUSL1
0.08004271 0.22314355 0.08004271 0.08004271 0.08004271 0.08004271 0.08004271
AURKAIP1 CCNL2 MRPL20 SSU72 MIB2 GNB1 FAAP20
0.08004271 0.08004271 0.28768207 0.08004271 0.08004271 0.08004271 0.15415068
RER1 TNFRSF14 RPL22 TNFRSF25 CAMTA1 VAMP3 UTS2 prd <- predict(fit, .x$mean.expr)
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 also encountered a similar issue

rogue.res <- rogue(expr, labels = meta$leiden_0.8, samples = meta$Treatment, platform = "UMI", span = 0.9) @Dana11T

Incrementally increasing the span parameter solved it for me