From ffb9e9a753bf042619eb34922cdd0ae95b68b2b6 Mon Sep 17 00:00:00 2001 From: Luke Zappia <lazappi@users.noreply.github.com> Date: Tue, 30 Jan 2018 15:40:06 +1100 Subject: [PATCH] Move scater to imports --- DESCRIPTION | 2 +- R/BASiCS-estimate.R | 3 +++ R/lun-estimate.R | 3 +++ R/lun2-estimate.R | 3 +++ R/mfa-estimate.R | 3 +++ R/pheno-estimate.R | 3 +++ R/scDD-estimate.R | 3 +++ R/simple-estimate.R | 3 +++ R/splat-estimate.R | 3 +++ R/zinb-estimate.R | 3 +++ man/BASiCSEstimate.Rd | 3 +++ man/lun2Estimate.Rd | 3 +++ man/lunEstimate.Rd | 3 +++ man/mfaEstimate.Rd | 3 +++ man/phenoEstimate.Rd | 3 +++ man/scDDEstimate.Rd | 3 +++ man/simpleEstimate.Rd | 3 +++ man/splatEstimate.Rd | 3 +++ man/zinbEstimate.Rd | 3 +++ vignettes/splatter.Rmd | 17 +++++++++-------- 20 files changed, 64 insertions(+), 9 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 858939e..0a1aa0a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,7 +21,6 @@ License: GPL-3 + file LICENSE LazyData: TRUE Depends: R (>= 3.4), - scater (>= 1.7.4), SingleCellExperiment Imports: akima, @@ -35,6 +34,7 @@ Imports: matrixStats, methods, scales, + scater (>= 1.7.4), stats, SummarizedExperiment, utils diff --git a/R/BASiCS-estimate.R b/R/BASiCS-estimate.R index e29e6a0..71c318a 100644 --- a/R/BASiCS-estimate.R +++ b/R/BASiCS-estimate.R @@ -31,7 +31,10 @@ #' #' @examples #' \dontrun{ +#' # Load example data +#' library(scater) #' data("sc_example_counts") +#' #' spike.info <- data.frame(Name = rownames(sc_example_counts)[1:10], #' Input = rnorm(10, 500, 200), #' stringsAsFactors = FALSE) diff --git a/R/lun-estimate.R b/R/lun-estimate.R index 3191a5d..298c84b 100644 --- a/R/lun-estimate.R +++ b/R/lun-estimate.R @@ -14,7 +14,10 @@ #' @return LunParams object containing the estimated parameters. #' #' @examples +#' # Load example data +#' library(scater) #' data("sc_example_counts") +#' #' params <- lunEstimate(sc_example_counts) #' params #' @export diff --git a/R/lun2-estimate.R b/R/lun2-estimate.R index df51b84..f82bf8a 100644 --- a/R/lun2-estimate.R +++ b/R/lun2-estimate.R @@ -20,8 +20,11 @@ #' #' @examples #' \dontrun{ +#' # Load example data +#' library(scater) #' data("sc_example_counts") #' data("sc_example_cell_info") +#' #' plates <- factor(sc_example_cell_info$Mutation_Status) #' params <- lun2Estimate(sc_example_counts, plates, min.size = 20) #' params diff --git a/R/mfa-estimate.R b/R/mfa-estimate.R index f3abf2f..62aa212 100644 --- a/R/mfa-estimate.R +++ b/R/mfa-estimate.R @@ -15,7 +15,10 @@ #' @return MFAParams object containing the estimated parameters. #' #' @examples +#' # Load example data +#' library(scater) #' data("sc_example_counts") +#' #' params <- mfaEstimate(sc_example_counts) #' params #' @export diff --git a/R/pheno-estimate.R b/R/pheno-estimate.R index 61cf4fc..cccf02f 100644 --- a/R/pheno-estimate.R +++ b/R/pheno-estimate.R @@ -15,7 +15,10 @@ #' @return PhenoParams object containing the estimated parameters. #' #' @examples +#' # Load example data +#' library(scater) #' data("sc_example_counts") +#' #' params <- phenoEstimate(sc_example_counts) #' params #' @export diff --git a/R/scDD-estimate.R b/R/scDD-estimate.R index 9c21367..cb5b2b3 100644 --- a/R/scDD-estimate.R +++ b/R/scDD-estimate.R @@ -25,7 +25,10 @@ #' #' @examples #' \dontrun{ +#' # Load example data +#' library(scater) #' data("sc_example_counts") +#' #' conditions <- sample(1:2, ncol(sc_example_counts), replace = TRUE) #' params <- scDDEstimate(sc_example_counts, conditions) #' params diff --git a/R/simple-estimate.R b/R/simple-estimate.R index 3a50a41..1f9e6cc 100644 --- a/R/simple-estimate.R +++ b/R/simple-estimate.R @@ -16,7 +16,10 @@ #' @return SimpleParams object containing the estimated parameters. #' #' @examples +#' # Load example data +#' library(scater) #' data("sc_example_counts") +#' #' params <- simpleEstimate(sc_example_counts) #' params #' @export diff --git a/R/splat-estimate.R b/R/splat-estimate.R index ead3c49..b1c20ff 100644 --- a/R/splat-estimate.R +++ b/R/splat-estimate.R @@ -16,7 +16,10 @@ #' @return SplatParams object containing the estimated parameters. #' #' @examples +#' # Load example data +#' library(scater) #' data("sc_example_counts") +#' #' params <- splatEstimate(sc_example_counts) #' params #' @export diff --git a/R/zinb-estimate.R b/R/zinb-estimate.R index 2a14443..8af73ab 100644 --- a/R/zinb-estimate.R +++ b/R/zinb-estimate.R @@ -29,7 +29,10 @@ #' #' @examples #' \dontrun{ +#' # Load example data +#' library(scater) #' data("sc_example_counts") +#' #' params <- zinbEstimate(sc_example_counts) #' params #' } diff --git a/man/BASiCSEstimate.Rd b/man/BASiCSEstimate.Rd index 0fabfeb..3be3475 100644 --- a/man/BASiCSEstimate.Rd +++ b/man/BASiCSEstimate.Rd @@ -61,7 +61,10 @@ information is provided there must be at least two batches. See } \examples{ \dontrun{ +# Load example data +library(scater) data("sc_example_counts") + spike.info <- data.frame(Name = rownames(sc_example_counts)[1:10], Input = rnorm(10, 500, 200), stringsAsFactors = FALSE) diff --git a/man/lun2Estimate.Rd b/man/lun2Estimate.Rd index d0e240e..b4b1af2 100644 --- a/man/lun2Estimate.Rd +++ b/man/lun2Estimate.Rd @@ -44,8 +44,11 @@ See \code{\link{Lun2Params}} for more details on the parameters. } \examples{ \dontrun{ +# Load example data +library(scater) data("sc_example_counts") data("sc_example_cell_info") + plates <- factor(sc_example_cell_info$Mutation_Status) params <- lun2Estimate(sc_example_counts, plates, min.size = 20) params diff --git a/man/lunEstimate.Rd b/man/lunEstimate.Rd index 82f5e67..63bd4f6 100644 --- a/man/lunEstimate.Rd +++ b/man/lunEstimate.Rd @@ -30,7 +30,10 @@ input data. No other parameters are estimated. See \code{\link{LunParams}} for more details on the parameters. } \examples{ +# Load example data +library(scater) data("sc_example_counts") + params <- lunEstimate(sc_example_counts) params } diff --git a/man/mfaEstimate.Rd b/man/mfaEstimate.Rd index 002cd04..ac81d6a 100644 --- a/man/mfaEstimate.Rd +++ b/man/mfaEstimate.Rd @@ -31,7 +31,10 @@ input data. The dropout lambda parameter is estimate using details on the parameters. } \examples{ +# Load example data +library(scater) data("sc_example_counts") + params <- mfaEstimate(sc_example_counts) params } diff --git a/man/phenoEstimate.Rd b/man/phenoEstimate.Rd index 5b69823..1c102ba 100644 --- a/man/phenoEstimate.Rd +++ b/man/phenoEstimate.Rd @@ -32,7 +32,10 @@ input data. The total number of genes is evenly divided into the four types. See \code{\link{PhenoParams}} for more details on the parameters. } \examples{ +# Load example data +library(scater) data("sc_example_counts") + params <- phenoEstimate(sc_example_counts) params } diff --git a/man/scDDEstimate.Rd b/man/scDDEstimate.Rd index 2651834..3b7d9ca 100644 --- a/man/scDDEstimate.Rd +++ b/man/scDDEstimate.Rd @@ -53,7 +53,10 @@ simulate. The output is then converted to a SCDDParams object. See } \examples{ \dontrun{ +# Load example data +library(scater) data("sc_example_counts") + conditions <- sample(1:2, ncol(sc_example_counts), replace = TRUE) params <- scDDEstimate(sc_example_counts, conditions) params diff --git a/man/simpleEstimate.Rd b/man/simpleEstimate.Rd index 159c879..441accf 100644 --- a/man/simpleEstimate.Rd +++ b/man/simpleEstimate.Rd @@ -33,7 +33,10 @@ to the library size normalised mean expression level using details on the parameters. } \examples{ +# Load example data +library(scater) data("sc_example_counts") + params <- simpleEstimate(sc_example_counts) params } diff --git a/man/splatEstimate.Rd b/man/splatEstimate.Rd index b14d519..736f41b 100644 --- a/man/splatEstimate.Rd +++ b/man/splatEstimate.Rd @@ -28,7 +28,10 @@ dataset. See the individual estimation functions for more details on how this is done. } \examples{ +# Load example data +library(scater) data("sc_example_counts") + params <- splatEstimate(sc_example_counts) params } diff --git a/man/zinbEstimate.Rd b/man/zinbEstimate.Rd index 7d819e3..13c7cc1 100644 --- a/man/zinbEstimate.Rd +++ b/man/zinbEstimate.Rd @@ -62,7 +62,10 @@ the fitted model and inserts it into a \code{\link{ZINBParams}} object. See } \examples{ \dontrun{ +# Load example data +library(scater) data("sc_example_counts") + params <- zinbEstimate(sc_example_counts) params } diff --git a/vignettes/splatter.Rmd b/vignettes/splatter.Rmd index ae895ee..deae574 100644 --- a/vignettes/splatter.Rmd +++ b/vignettes/splatter.Rmd @@ -36,7 +36,7 @@ biocLite("splatter") To install the most recent development version from Github use: ```{r install-github, eval = FALSE} -biocLite("Oshlack/splatter", dependencies = TRUE, +biocLite("Oshlack/splatter", dependencies = TRUE, build_vignettes = TRUE) ``` @@ -51,6 +51,7 @@ Splatter. Here is an example using the example dataset in the `scater` package: library(splatter) # Load example data +library(scater) data("sc_example_counts") # Estimate parameters from example data params <- splatEstimate(sc_example_counts) @@ -160,7 +161,7 @@ As well as telling us what type of object we have ("A `Params` object of class some extra information. We can see which parameters can be estimated by the `splatEstimate` function (those in parentheses), which can't be estimated (those in brackets) and which have been changed from their default values (those -in ALL CAPS). +in ALL CAPS). ## Getting and setting @@ -330,7 +331,7 @@ So far we have only simulated a single population of cells but often we are interested in investigating a mixed population of cells and looking to see what cell types are present or what differences there are between them. Splatter is able to simulate these situations by changing the `method` argument Here we are -going to simulate two groups, by specifying the `group.prob` parameter and +going to simulate two groups, by specifying the `group.prob` parameter and setting the `method` parameter to `"groups"`: (**NOTE:** We have also set the `verbose` argument to `FALSE` to stop Splatter @@ -354,7 +355,7 @@ The other situation that is often of interest is a differentiation process where one cell type is changing into another. Splatter approximates this process by simulating a series of steps between two groups and randomly assigning each cell to a step. We can create this kind of simulation using the `"paths"` -method. +method. ```{r paths} sim.paths <- splatSimulate(method = "paths", verbose = FALSE) @@ -362,7 +363,7 @@ 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 +Here the colours represent the "step" of each cell or how far along the differentiation path it is. We can see that the cells with dark colours are more similar to the originating cell type and the light coloured cells are closer to the final, differentiated, cell type. By setting additional parameters it is @@ -462,9 +463,9 @@ tpm(sim)[1:5, 1:5] The default method used by `addGeneLengths` to simulate lengths is to generate values from a log-normal distribution which are then rounded to give an integer -length. The parameters for this distribution are based on human protein coding -genes but can be adjusted if needed (for example for other species). -Alternatively lengths can be sampled from a provided vector (see +length. The parameters for this distribution are based on human protein coding +genes but can be adjusted if needed (for example for other species). +Alternatively lengths can be sampled from a provided vector (see `?addGeneLengths` for details and an example). # Comparing simulations and real data -- GitLab