From 46741af554baae055978f228d5459c773cb5eed9 Mon Sep 17 00:00:00 2001
From: Luke Zappia <lazappi@users.noreply.github.com>
Date: Wed, 3 Jan 2018 16:35:51 +1100
Subject: [PATCH] Fix vignette error

---
 DESCRIPTION            |  4 ++--
 NEWS.md                |  8 ++++++++
 R/compare.R            |  4 ++--
 vignettes/splatter.Rmd | 15 +++++++++++----
 4 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 1a129b4..466ea86 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
 Package: splatter
 Type: Package
 Title: Simple Simulation of Single-cell RNA Sequencing Data
-Version: 1.2.1
-Date: 2017-11-23
+Version: 1.3.1
+Date: 2018-01-03
 Author: Luke Zappia
 Authors@R:
     c(person("Luke", "Zappia", role = c("aut", "cre"),
diff --git a/NEWS.md b/NEWS.md
index d80a6c6..dde2f7a 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,11 @@
+## Version 1.3.1 (2018-01-03)
+
+* Fix error in vignette caused by changes in scater
+
+## Version 1.3.0 (2018-01-03)
+
+* Bioconductor 3.7 devel 
+
 ## Version 1.2.1 (2017-11-23)
 
 * Fix zinbwave installation error
diff --git a/R/compare.R b/R/compare.R
index 6739fb9..fb1f270 100644
--- a/R/compare.R
+++ b/R/compare.R
@@ -75,7 +75,7 @@ compareSCEs <- function(sces, point.size = 0.1, point.alpha = 0.1,
         rowData(sce)$Dataset <- name
         colData(sce)$Dataset <- name
         sce <- scater::calculateQCMetrics(sce)
-        cpm(sce) <- scater::calculateCPM(sce, use.size.factors = FALSE)
+        cpm(sce) <- scater::calculateCPM(sce, use_size_factors = FALSE)
         sce <- addFeatureStats(sce, "counts")
         sce <- addFeatureStats(sce, "cpm")
         sce <- addFeatureStats(sce, "cpm", log = TRUE)
@@ -301,7 +301,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
         rowData(sce)$Dataset <- name
         colData(sce)$Dataset <- name
         sce <- scater::calculateQCMetrics(sce)
-        cpm(sce) <- scater::calculateCPM(sce, use.size.factors = FALSE)
+        cpm(sce) <- scater::calculateCPM(sce, use_size_factors = FALSE)
         sce <- addFeatureStats(sce, "counts")
         sce <- addFeatureStats(sce, "cpm", log = TRUE)
         colData(sce)$PctZero <- 100 * (1 - colData(sce)$total_features /
diff --git a/vignettes/splatter.Rmd b/vignettes/splatter.Rmd
index e72e866..ae895ee 100644
--- a/vignettes/splatter.Rmd
+++ b/vignettes/splatter.Rmd
@@ -278,7 +278,10 @@ get immediate access to other analysis packages, such as the plotting functions
 in `scater`. For example we can make a PCA plot:
 
 ```{r pca}
-plotPCA(sim, exprs_values = "counts")
+# Use scater to calculate logcounts
+sim <- normalise(sim)
+# Plot PCA
+plotPCA(sim)
 ```
 
 (**NOTE:** Your values and plots may look different as the simulation is random
@@ -336,7 +339,8 @@ printing progress messages.)
 ```{r groups}
 sim.groups <- splatSimulate(group.prob = c(0.5, 0.5), method = "groups",
                             verbose = FALSE)
-plotPCA(sim.groups, colour_by = "Group", exprs_values = "counts")
+sim.groups <- normalise(sim.groups)
+plotPCA(sim.groups, colour_by = "Group")
 ```
 
 As we have set both the group probabilites to 0.5 we should get approximately
@@ -354,7 +358,8 @@ method.
 
 ```{r paths}
 sim.paths <- splatSimulate(method = "paths", verbose = FALSE)
-plotPCA(sim.paths, colour_by = "Step", exprs_values = "counts")
+sim.paths <- normalise(sim.paths)
+plotPCA(sim.paths, colour_by = "Step")
 ```
 
 Here the colours represent the "step" of each cell or how far along the 
@@ -373,7 +378,8 @@ cells are in each batch:
 
 ```{r batches}
 sim.batches <- splatSimulate(batchCells = c(50, 50), verbose = FALSE)
-plotPCA(sim.batches, colour_by = "Batch", exprs_values = "counts")
+sim.batches <- normalise(sim.batches)
+plotPCA(sim.batches, colour_by = "Batch")
 ```
 
 This looks at lot like when we simulated groups and that is because the process
@@ -386,6 +392,7 @@ that we aren't interested in (batch) and the wanted variation we are looking for
 ```{r batch-groups}
 sim.groups <- splatSimulate(batchCells = c(50, 50), group.prob = c(0.5, 0.5),
                             method = "groups", verbose = FALSE)
+sim.groups <- normalise(sim.groups)
 plotPCA(sim.groups, shape_by = "Batch", colour_by = "Group",
         exprs_values = "counts")
 ```
-- 
GitLab