From 22c49d090e20f510dbe2e77e81d7253b6c9a757e Mon Sep 17 00:00:00 2001
From: Luke Zappia <lazappi@users.noreply.github.com>
Date: Tue, 1 Oct 2019 11:18:39 +1000
Subject: [PATCH] Minor Splotch changes

* Change default cells.design to end of path
* Add experimental warning
* Avoid resetting cells.design
---
 DESCRIPTION               |  7 ++++---
 NEWS.md                   |  6 ++++++
 R/AllClasses.R            |  4 ++--
 R/SplotchParams-methods.R | 18 ++++++++++++++++--
 4 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 9eaece6..4741a42 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
 Package: splatter
 Type: Package
 Title: Simple Simulation of Single-cell RNA Sequencing Data
-Version: 1.9.7.9015
-Date: 2019-09-26
+Version: 1.9.7.9016
+Date: 2019-10-01
 Author: Luke Zappia
 Authors@R:
     c(person("Luke", "Zappia", role = c("aut", "cre"),
@@ -42,7 +42,8 @@ Imports:
     SummarizedExperiment,
     utils,
     crayon,
-    S4Vectors
+    S4Vectors,
+    rlang
 Suggests:
     BiocStyle,
     covr,
diff --git a/NEWS.md b/NEWS.md
index 3cb698f..43dd6ea 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,9 @@
+### Version 1.9.7.9016 (2019-10-01)
+
+* Change the default SplotchParams cell design to place cells at end of path
+* Add one time warning for Splotch simulation
+* Avoid unnecessarily resetting cells.design in SplotchParams
+
 ### Version 1.9.7.9015 (2019-09-26)
 
 * Add doublets to SplotchSimulate
diff --git a/R/AllClasses.R b/R/AllClasses.R
index 11c05ca..d53646c 100644
--- a/R/AllClasses.R
+++ b/R/AllClasses.R
@@ -410,8 +410,8 @@ setClass("SplotchParams",
                                cells.design = data.frame(
                                    Path = 1,
                                    Probability = 1,
-                                   Alpha = 0,
-                                   Beta = 1
+                                   Alpha = 1,
+                                   Beta = 0
                                ),
                                doublet.prop = 0,
                                ambient.scale = 0.05,
diff --git a/R/SplotchParams-methods.R b/R/SplotchParams-methods.R
index c3a51cc..e8bc026 100644
--- a/R/SplotchParams-methods.R
+++ b/R/SplotchParams-methods.R
@@ -11,6 +11,11 @@ newSplotchParams <- function(...) {
         stop("The Splotch simulation requires the 'DropletUtils' package.")
     }
 
+    msg <- paste("The Splotch simulation is still experimental and may produce",
+                 "unreliable results. Please try it and report any issues to",
+                 "https://github.com/Oshlack/splatter/issues.")
+    rlang:::warn_deprecated(msg, id = "warn.splotch")
+
     params <- new("SplotchParams")
     params <- setParams(params, ...)
 
@@ -260,11 +265,11 @@ setMethod("setParam", "SplotchParams", function(object, name, value) {
     }
 
     if (name == "paths.design" &&
-        (nrow(value) != nrow(getParam(object, "paths.design")))) {
+        (nrow(value) != nrow(getParam(object, "cells.design")))) {
         warning("cells.design reset to match paths.design")
         cells.design <- data.frame(Path = value$Path,
                                    Probability = 1 / nrow(value),
-                                   Alpha = 0, Beta = 1)
+                                   Alpha = 1, Beta = 0)
         object <- setParamUnchecked(object, "cells.design", cells.design)
     }
 
@@ -280,6 +285,15 @@ setMethod("setParams", "SplotchParams", function(object, update = NULL, ...) {
 
     update <- c(update, list(...))
 
+    # If both cells.design and paths.design are given set cells.design first
+    # to avoid reset warning
+    if ("cells.design" %in% names(update) &&
+        "paths.design" %in% names(update)) {
+        object <- setParamUnchecked(object, "cells.design",
+                                    update$cells.design)
+        update$cells.design <- NULL
+    }
+
     update <- bringItemsForward(update, c("network.graph", "paths.design"))
 
     object <- callNextMethod(object, update)
-- 
GitLab