diff --git a/DESCRIPTION b/DESCRIPTION index 4d497ca..14985cc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: splatter Type: Package Title: Simple Simulation of Single-cell RNA Sequencing Data -Version: 1.19.2 -Date: 2022-01-10 +Version: 1.19.3 +Date: 2022-01-28 Authors@R: c(person("Luke", "Zappia", role = c("aut", "cre"), email = "luke@lazappi.id.au", diff --git a/NEWS.md b/NEWS.md index be1a5ff..536cf30 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,10 @@ # DEVELOPMENT VERSION +## Version 1.19.3 (2022-01-28) + * Removed duplicated code in splatSimPathCellMeans() (Fixes #131) +* Add additional fallback method for fitting dropout in splatEstimate() + (Fixes #133) ## Version 1.19.2 (2022-01-10) diff --git a/R/splat-estimate.R b/R/splat-estimate.R index 6d69eae..44698e2 100644 --- a/R/splat-estimate.R +++ b/R/splat-estimate.R @@ -277,8 +277,16 @@ splatEstDropout <- function(norm.counts, params) { error = function(err) { warning("Fitting dropout using the Gauss-Newton method failed, ", "using the Golub-Pereyra algorithm instead") - nls(y ~ logistic(x, x0 = x0, k = k), data = df, - start = list(x0 = 0, k = -1), algorithm = "plinear") + tryCatch({ + nls(y ~ logistic(x, x0 = x0, k = k), data = df, + start = list(x0 = 0, k = -1), algorithm = "plinear") + }, + error = function(err) { + warning("Fitting dropout using the Golub-Pereyra method failed, ", + "using the nl2sol algorithm instead") + nls(y ~ logistic(x, x0 = x0, k = k), data = df, + start = list(x0 = 0, k = -1), algorithm = "port") + }) }) #exp.zeros <- dnbinom(0, mu = means, size = 1 / 0.1) * ncol(norm.counts)