Skip to content

Commit

Permalink
Add port method to splatEstDropout
Browse files Browse the repository at this point in the history
  • Loading branch information
lazappi committed Jan 28, 2022
1 parent 1f95b61 commit 1eec243
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
12 changes: 10 additions & 2 deletions R/splat-estimate.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1eec243

Please sign in to comment.