From 065574a9b9936bc125fe92b24309e7176a40d6b3 Mon Sep 17 00:00:00 2001
From: Luke Zappia <lazappi@users.noreply.github.com>
Date: Mon, 30 Apr 2018 11:23:39 +1000
Subject: [PATCH] Set seed in sparseDCEstimate tests and bump ver

These would sometimes error due to sampling of example dataset
---
 DESCRIPTION                            |  4 ++--
 NEWS.md                                |  6 +++++-
 R/sparseDC-estimate.R                  |  1 +
 docs/articles/index.html               |  2 +-
 docs/articles/splatter.html            |  2 +-
 docs/news/index.html                   | 11 +++++++++--
 docs/reference/addGeneLengths.html     | 16 ++++++++--------
 docs/reference/index.html              |  2 +-
 docs/reference/lunEstimate.html        |  2 +-
 docs/reference/mfaEstimate.html        |  2 +-
 docs/reference/phenoEstimate.html      |  2 +-
 docs/reference/setParam.html           |  2 +-
 docs/reference/setParams.html          |  6 +++---
 docs/reference/simpleEstimate.html     |  2 +-
 docs/reference/sparseDCEstimate.html   |  3 ++-
 docs/reference/splatEstimate.html      |  2 +-
 docs/reference/summariseDiff.html      | 24 ++++++++++++------------
 man/sparseDCEstimate.Rd                |  1 +
 tests/testthat/test-sparseDCEstimate.R |  2 +-
 19 files changed, 53 insertions(+), 39 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index f67bea7..0a61b2b 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
 Package: splatter
 Type: Package
 Title: Simple Simulation of Single-cell RNA Sequencing Data
-Version: 1.3.5
-Date: 2018-04-25
+Version: 1.3.6
+Date: 2018-04-30
 Author: Luke Zappia
 Authors@R:
     c(person("Luke", "Zappia", role = c("aut", "cre"),
diff --git a/NEWS.md b/NEWS.md
index 7f7748b..0ef8719 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,4 +1,8 @@
-## Version 1.3.4 (2018-04-25)
+## Version 1.3.6 (2018-04-30)
+
+* Set seed in sparseDCEstimate tests
+
+## Version 1.3.5 (2018-04-25)
 
 * Replace dropout.present with dropout.type in SplatParams
     * Allows users to set dropout by experiment, batch, group or cell
diff --git a/R/sparseDC-estimate.R b/R/sparseDC-estimate.R
index 1439bcf..0c0f793 100644
--- a/R/sparseDC-estimate.R
+++ b/R/sparseDC-estimate.R
@@ -28,6 +28,7 @@
 #' library(scater)
 #' data("sc_example_counts")
 #'
+#' set.seed(1)
 #' conditions <- sample(1:2, ncol(sc_example_counts), replace = TRUE)
 #'
 #' params <- sparseDCEstimate(sc_example_counts[1:500, ], conditions,
diff --git a/docs/articles/index.html b/docs/articles/index.html
index 088ab52..b16f949 100644
--- a/docs/articles/index.html
+++ b/docs/articles/index.html
@@ -96,7 +96,7 @@
       </header>
 
       <div class="page-header">
-  <h1>Articles <small>version&nbsp;1.3.5</small></h1>
+  <h1>Articles <small>version&nbsp;1.3.6</small></h1>
 </div>
 
 <div class="row">
diff --git a/docs/articles/splatter.html b/docs/articles/splatter.html
index 7602e93..0887fa9 100644
--- a/docs/articles/splatter.html
+++ b/docs/articles/splatter.html
@@ -76,7 +76,7 @@
       <h1>Introduction to Splatter</h1>
                         <h4 class="author">Luke Zappia</h4>
             
-            <h4 class="date">2018-04-25</h4>
+            <h4 class="date">2018-04-30</h4>
           </div>
 
     
diff --git a/docs/news/index.html b/docs/news/index.html
index b7ebc7e..642f9d0 100644
--- a/docs/news/index.html
+++ b/docs/news/index.html
@@ -104,7 +104,13 @@
 
     <div class="contents">
     <div class="section level2">
-<h2>Version 1.3.4 (2018-04-25)</h2>
+<h2>Version 1.3.6 (2018-04-30)</h2>
+<ul>
+<li>Set seed in sparseDCEstimate tests</li>
+</ul>
+</div>
+    <div class="section level2">
+<h2>Version 1.3.5 (2018-04-25)</h2>
 <ul>
 <li>Replace dropout.present with dropout.type in SplatParams
 <ul>
@@ -498,7 +504,8 @@
     <div id="tocnav">
       <h2>Contents</h2>
       <ul class="nav nav-pills nav-stacked">
-        <li><a href="#NA">1.3.4</a></li>
+        <li><a href="#NA">1.3.6</a></li>
+        <li><a href="#NA">1.3.5</a></li>
         <li><a href="#NA">1.3.4</a></li>
         <li><a href="#NA">1.3.3</a></li>
         <li><a href="#NA">1.3.2</a></li>
diff --git a/docs/reference/addGeneLengths.html b/docs/reference/addGeneLengths.html
index b436347..f87091d 100644
--- a/docs/reference/addGeneLengths.html
+++ b/docs/reference/addGeneLengths.html
@@ -154,14 +154,14 @@ vector.</p>
     <pre class="examples"><div class='input'><span class='co'># Default generate method</span>
 <span class='no'>sce</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='simpleSimulate.html'>simpleSimulate</a></span>()</div><div class='output co'>#&gt; <span class='message'>Simulating means...</span></div><div class='output co'>#&gt; <span class='message'>Simulating counts...</span></div><div class='output co'>#&gt; <span class='message'>Creating final dataset...</span></div><div class='input'><span class='no'>sce</span> <span class='kw'>&lt;-</span> <span class='fu'>addGeneLengths</span>(<span class='no'>sce</span>)
 <span class='fu'>head</span>(<span class='fu'>rowData</span>(<span class='no'>sce</span>))</div><div class='output co'>#&gt; DataFrame with 6 rows and 3 columns
-#&gt;       Gene          GeneMean    Length
-#&gt;   &lt;factor&gt;         &lt;numeric&gt; &lt;numeric&gt;
-#&gt; 1    Gene1  3.19721697566766       428
-#&gt; 2    Gene2 0.316692135258865      2948
-#&gt; 3    Gene3  2.90867080625693      1507
-#&gt; 4    Gene4   7.5357203351493      6034
-#&gt; 5    Gene5  5.92953185619191      1713
-#&gt; 6    Gene6  3.78237895789214      2926</div><div class='input'># Sample method (human coding genes)
+#&gt;       Gene            GeneMean    Length
+#&gt;   &lt;factor&gt;           &lt;numeric&gt; &lt;numeric&gt;
+#&gt; 1    Gene1   0.734025020368755      8478
+#&gt; 2    Gene2    1.72488562332675      4683
+#&gt; 3    Gene3   0.602236437812367      3861
+#&gt; 4    Gene4   0.279058870872173      1711
+#&gt; 5    Gene5 0.00808100968671002      3209
+#&gt; 6    Gene6    4.60422371602675      1349</div><div class='input'># Sample method (human coding genes)
 </div><span class='co'># NOT RUN {</span>
 <span class='fu'>library</span>(<span class='no'>TxDb.Hsapiens.UCSC.hg19.knownGene</span>)
 <span class='fu'>library</span>(<span class='no'>GenomicFeatures</span>)
diff --git a/docs/reference/index.html b/docs/reference/index.html
index 37647c5..f0a5f14 100644
--- a/docs/reference/index.html
+++ b/docs/reference/index.html
@@ -100,7 +100,7 @@
     <div class="page-header">
       <h1>
         Reference
-        <small>version&nbsp;1.3.5</small>
+        <small>version&nbsp;1.3.6</small>
       </h1>
     </div>
 
diff --git a/docs/reference/lunEstimate.html b/docs/reference/lunEstimate.html
index 7978288..9e3f6bb 100644
--- a/docs/reference/lunEstimate.html
+++ b/docs/reference/lunEstimate.html
@@ -149,7 +149,7 @@ for more details on the parameters.</p>
 #&gt; 
 #&gt; Global: 
 #&gt; (GENES)  (CELLS)   [Seed] 
-#&gt;    2000       40    33804 
+#&gt;    2000       40   239255 
 #&gt; 
 #&gt; 9 additional parameters 
 #&gt; 
diff --git a/docs/reference/mfaEstimate.html b/docs/reference/mfaEstimate.html
index df646e1..806172e 100644
--- a/docs/reference/mfaEstimate.html
+++ b/docs/reference/mfaEstimate.html
@@ -150,7 +150,7 @@ details on the parameters.</p>
 #&gt; 
 #&gt; Global: 
 #&gt; (GENES)  (CELLS)   [Seed] 
-#&gt;    2000       40    33804 
+#&gt;    2000       40   239255 
 #&gt; 
 #&gt; 4 additional parameters 
 #&gt; 
diff --git a/docs/reference/phenoEstimate.html b/docs/reference/phenoEstimate.html
index b19c096..c426f24 100644
--- a/docs/reference/phenoEstimate.html
+++ b/docs/reference/phenoEstimate.html
@@ -151,7 +151,7 @@ See <code><a href='PhenoParams.html'>PhenoParams</a></code> for more details on
 #&gt; 
 #&gt; Global: 
 #&gt; (GENES)  (CELLS)   [Seed] 
-#&gt;    2000       40    33804 
+#&gt;    2000       40   239255 
 #&gt; 
 #&gt; 4 additional parameters 
 #&gt; 
diff --git a/docs/reference/setParam.html b/docs/reference/setParam.html
index 7b675e5..c744aff 100644
--- a/docs/reference/setParam.html
+++ b/docs/reference/setParam.html
@@ -160,7 +160,7 @@
 #&gt; 
 #&gt; Global: 
 #&gt; (GENES)  (Cells)   [Seed] 
-#&gt;     100      100    33804 
+#&gt;     100      100   239255 
 #&gt; 
 #&gt; 3 additional parameters 
 #&gt; 
diff --git a/docs/reference/setParams.html b/docs/reference/setParams.html
index 24447c4..b1dd65f 100644
--- a/docs/reference/setParams.html
+++ b/docs/reference/setParams.html
@@ -146,7 +146,7 @@ them manually), see examples.</p>
 #&gt; 
 #&gt; Global: 
 #&gt; (Genes)  (Cells)   [Seed] 
-#&gt;   10000      100    33804 
+#&gt;   10000      100   239255 
 #&gt; 
 #&gt; 3 additional parameters 
 #&gt; 
@@ -164,7 +164,7 @@ them manually), see examples.</p>
 #&gt; 
 #&gt; Global: 
 #&gt; (GENES)  (CELLS)   [Seed] 
-#&gt;    1000       50    33804 
+#&gt;    1000       50   239255 
 #&gt; 
 #&gt; 3 additional parameters 
 #&gt; 
@@ -182,7 +182,7 @@ them manually), see examples.</p>
 #&gt; 
 #&gt; Global: 
 #&gt; (GENES)  (CELLS)   [Seed] 
-#&gt;    1000       50    33804 
+#&gt;    1000       50   239255 
 #&gt; 
 #&gt; 3 additional parameters 
 #&gt; 
diff --git a/docs/reference/simpleEstimate.html b/docs/reference/simpleEstimate.html
index 548b300..cde8acc 100644
--- a/docs/reference/simpleEstimate.html
+++ b/docs/reference/simpleEstimate.html
@@ -152,7 +152,7 @@ details on the parameters.</p>
 #&gt; 
 #&gt; Global: 
 #&gt; (GENES)  (CELLS)   [Seed] 
-#&gt;    2000       40    33804 
+#&gt;    2000       40   239255 
 #&gt; 
 #&gt; 3 additional parameters 
 #&gt; 
diff --git a/docs/reference/sparseDCEstimate.html b/docs/reference/sparseDCEstimate.html
index 3ab9bb0..cb9edf3 100644
--- a/docs/reference/sparseDCEstimate.html
+++ b/docs/reference/sparseDCEstimate.html
@@ -164,6 +164,7 @@ input data. The counts are preprocessed using
 <span class='fu'>library</span>(<span class='no'>scater</span>)
 <span class='fu'>data</span>(<span class='st'>"sc_example_counts"</span>)
 
+<span class='fu'>set.seed</span>(<span class='fl'>1</span>)
 <span class='no'>conditions</span> <span class='kw'>&lt;-</span> <span class='fu'>sample</span>(<span class='fl'>1</span>:<span class='fl'>2</span>, <span class='fu'>ncol</span>(<span class='no'>sc_example_counts</span>), <span class='kw'>replace</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)
 
 <span class='no'>params</span> <span class='kw'>&lt;-</span> <span class='fu'>sparseDCEstimate</span>(<span class='no'>sc_example_counts</span>[<span class='fl'>1</span>:<span class='fl'>500</span>, ], <span class='no'>conditions</span>,
@@ -173,7 +174,7 @@ input data. The counts are preprocessed using
 #&gt; 
 #&gt; Global: 
 #&gt; (GENES)  (CELLS)   [Seed] 
-#&gt;     500       20    33804 
+#&gt;     500       20   239255 
 #&gt; 
 #&gt; 7 additional parameters 
 #&gt; 
diff --git a/docs/reference/splatEstimate.html b/docs/reference/splatEstimate.html
index 4699daf..ea70708 100644
--- a/docs/reference/splatEstimate.html
+++ b/docs/reference/splatEstimate.html
@@ -151,7 +151,7 @@ containing count data to estimate parameters from.</p></td>
 #&gt; 
 #&gt; Global: 
 #&gt; (GENES)  (CELLS)   [Seed] 
-#&gt;    2000       40    33804 
+#&gt;    2000       40   239255 
 #&gt; 
 #&gt; 28 additional parameters 
 #&gt; 
diff --git a/docs/reference/summariseDiff.html b/docs/reference/summariseDiff.html
index a1d0f60..35b7468 100644
--- a/docs/reference/summariseDiff.html
+++ b/docs/reference/summariseDiff.html
@@ -128,19 +128,19 @@ Error (RMSE) for the various properties and ranks them.</p>
 #&gt; <span class='message'>Old names are currently maintained for back-compatibility, but may be removed in future releases.</span></div><div class='output co'>#&gt; <span class='message'>Note that the names of some metrics have changed, see 'Renamed metrics' in ?calculateQCMetrics.</span>
 #&gt; <span class='message'>Old names are currently maintained for back-compatibility, but may be removed in future releases.</span></div><div class='input'><span class='no'>summary</span> <span class='kw'>&lt;-</span> <span class='fu'>summariseDiff</span>(<span class='no'>difference</span>)
 <span class='fu'>head</span>(<span class='no'>summary</span>)</div><div class='output co'>#&gt;   Dataset Statistic          MAD MADScaled MADRank          MAE MAEScaled
-#&gt; 1   Splat      Mean     2.578921       NaN       1     2.526951       NaN
-#&gt; 2   Splat  Variance    11.923672       NaN       1    10.771444       NaN
-#&gt; 3   Splat ZerosGene    35.000000       NaN       1    41.210000       NaN
-#&gt; 4   Splat   MeanVar    11.687919       NaN       1    12.429719       NaN
-#&gt; 5   Splat MeanZeros    45.000000       NaN       1    42.440000       NaN
-#&gt; 6   Splat   LibSize 53750.500000       NaN       1 57352.550000       NaN
+#&gt; 1   Splat      Mean     2.747262       NaN       1     2.687708       NaN
+#&gt; 2   Splat  Variance    12.048614       NaN       1    10.964929       NaN
+#&gt; 3   Splat ZerosGene    40.000000       NaN       1    44.560000       NaN
+#&gt; 4   Splat   MeanVar    11.536097       NaN       1    12.817781       NaN
+#&gt; 5   Splat MeanZeros    45.000000       NaN       1    44.735000       NaN
+#&gt; 6   Splat   LibSize 60309.000000       NaN       1 62775.150000       NaN
 #&gt;   MAERank         RMSE RMSEScaled RMSERank
-#&gt; 1       1     3.056807        NaN        1
-#&gt; 2       1    13.346501        NaN        1
-#&gt; 3       1    45.518677        NaN        1
-#&gt; 4       1    15.389141        NaN        1
-#&gt; 5       1    51.924946        NaN        1
-#&gt; 6       1 58750.990661        NaN        1</div></pre>
+#&gt; 1       1     3.224377        NaN        1
+#&gt; 2       1    13.890753        NaN        1
+#&gt; 3       1    48.064020        NaN        1
+#&gt; 4       1    15.970356        NaN        1
+#&gt; 5       1    54.010879        NaN        1
+#&gt; 6       1 63881.558662        NaN        1</div></pre>
   </div>
   <div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
     <h2>Contents</h2>
diff --git a/man/sparseDCEstimate.Rd b/man/sparseDCEstimate.Rd
index 274d074..4d19581 100644
--- a/man/sparseDCEstimate.Rd
+++ b/man/sparseDCEstimate.Rd
@@ -50,6 +50,7 @@ See \code{\link{SparseDCParams}} for more details on the parameters.
 library(scater)
 data("sc_example_counts")
 
+set.seed(1)
 conditions <- sample(1:2, ncol(sc_example_counts), replace = TRUE)
 
 params <- sparseDCEstimate(sc_example_counts[1:500, ], conditions,
diff --git a/tests/testthat/test-sparseDCEstimate.R b/tests/testthat/test-sparseDCEstimate.R
index a34ac48..3bdc50b 100644
--- a/tests/testthat/test-sparseDCEstimate.R
+++ b/tests/testthat/test-sparseDCEstimate.R
@@ -4,8 +4,8 @@ library(scater)
 data("sc_example_counts")
 
 test_that("sparseDCEstimate works", {
+    set.seed(1)
     conditions <- sample(1:2, ncol(sc_example_counts), replace = TRUE)
-
     params <- sparseDCEstimate(sc_example_counts, conditions,
                                nclusters = 3)
     expect_true(validObject(params))
-- 
GitLab