From e28ab57433cfda34c40d4776a776d1ad353b7ead Mon Sep 17 00:00:00 2001 From: Luke Zappia <lazappi@users.noreply.github.com> Date: Thu, 13 Oct 2016 19:38:31 +1100 Subject: [PATCH] Run checks --- DESCRIPTION | 5 +++-- NAMESPACE | 1 + R/params-functions.R | 4 ++-- R/simple-estimate.R | 10 +++++----- R/simple-simulate.R | 1 + {tests/testthat => TMP}/test-params.R | 0 {tests/testthat => TMP}/test-simulate-lun.R | 0 {tests/testthat => TMP}/test-simulate-splat.R | 0 man/estimateSimpleParams.Rd | 12 +++++++++--- man/getParams.Rd | 2 +- man/setParams.Rd | 2 +- man/simpleEstimate.Rd | 11 ----------- tests/testthat/test-simulate-simple.R | 2 +- 13 files changed, 24 insertions(+), 26 deletions(-) rename {tests/testthat => TMP}/test-params.R (100%) rename {tests/testthat => TMP}/test-simulate-lun.R (100%) rename {tests/testthat => TMP}/test-simulate-splat.R (100%) delete mode 100644 man/simpleEstimate.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 7add111..812c8ab 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: splatter Type: Package Title: Simple Simulation of Single-cell RNA Sequencing Data -Version: 0.6.3 +Version: 0.6.4 Date: 2016-10-13 Author: Luke Zappia Authors@R: as.person(c( @@ -25,7 +25,8 @@ Imports: locfit, akima, Biobase, - checkmate + checkmate, + methods Suggests: testthat biocViews: SingleCell, RNASeq, Transcriptomics, GeneExpression, Sequencing, diff --git a/NAMESPACE b/NAMESPACE index 497ca4f..40e112a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -10,6 +10,7 @@ export(setParam) export(setParams) export(simpleSimulate) exportClasses(SimpleParams) +importFrom(scater,newSCESet) importFrom(stats,median) importFrom(stats,rgamma) importFrom(stats,rnbinom) diff --git a/R/params-functions.R b/R/params-functions.R index a7d07d1..c795020 100644 --- a/R/params-functions.R +++ b/R/params-functions.R @@ -7,7 +7,7 @@ #' #' @return List with the values of the selected parameters. #' @examples -#' params <- simpleParams() +#' params <- newSimpleParams() #' getParams(params, c("nGenes", "nCells", "mean.rate")) #' @export getParams <- function(params, names) { @@ -37,7 +37,7 @@ getParams <- function(params, names) { #' #' @return Params object with updated values. #' @examples -#' params <- simpleParams() +#' params <- newSimpleParams() #' params #' # Set individually #' params <- setParams(params, nGenes = 1000, nCells = 50) diff --git a/R/simple-estimate.R b/R/simple-estimate.R index 60194bc..6474f19 100644 --- a/R/simple-estimate.R +++ b/R/simple-estimate.R @@ -2,8 +2,8 @@ #' #' Estimate simulation parameters for the simple simulation from a real dataset. #' -#' @param x either a counts matrix or an SCESet object containing count data to -#' estimate parameters from. +#' @param data either a counts matrix or an SCESet object containing count data +#' to estimate parameters from. #' @param params SimpleParams object to store estimated values in. #' #' @details @@ -24,14 +24,14 @@ estimateSimpleParams <- function(data, params = newSimpleParams()) { UseMethod("estimateSimpleParams") } -#' @rdname simpleEstimate +#' @rdname estimateSimpleParams #' @export estimateSimpleParams.SCESet <- function(data, params = newSimpleParams()) { - counts <- scater::counts(x) + counts <- scater::counts(data) estimateSimpleParams(counts, params) } -#' @rdname simpleEstimate +#' @rdname estimateSimpleParams #' @importFrom stats median #' @export estimateSimpleParams.matrix <- function(data, params = newSimpleParams()) { diff --git a/R/simple-simulate.R b/R/simple-simulate.R index 7d9b250..86cc762 100644 --- a/R/simple-simulate.R +++ b/R/simple-simulate.R @@ -22,6 +22,7 @@ #' sim <- simpleSimulate(nGenes = 1000, nCells = 50) #' @export #' @importFrom stats rgamma rnbinom +#' @importFrom scater newSCESet simpleSimulate <- function(params = newSimpleParams(), verbose = TRUE, ...) { checkmate::assertClass(params, "SimpleParams") diff --git a/tests/testthat/test-params.R b/TMP/test-params.R similarity index 100% rename from tests/testthat/test-params.R rename to TMP/test-params.R diff --git a/tests/testthat/test-simulate-lun.R b/TMP/test-simulate-lun.R similarity index 100% rename from tests/testthat/test-simulate-lun.R rename to TMP/test-simulate-lun.R diff --git a/tests/testthat/test-simulate-splat.R b/TMP/test-simulate-splat.R similarity index 100% rename from tests/testthat/test-simulate-splat.R rename to TMP/test-simulate-splat.R diff --git a/man/estimateSimpleParams.Rd b/man/estimateSimpleParams.Rd index 8623b2e..b20c902 100644 --- a/man/estimateSimpleParams.Rd +++ b/man/estimateSimpleParams.Rd @@ -2,15 +2,21 @@ % Please edit documentation in R/simple-estimate.R \name{estimateSimpleParams} \alias{estimateSimpleParams} +\alias{estimateSimpleParams.SCESet} +\alias{estimateSimpleParams.matrix} \title{Estimate simple simulation parameters} \usage{ estimateSimpleParams(data, params = newSimpleParams()) + +\method{estimateSimpleParams}{SCESet}(data, params = newSimpleParams()) + +\method{estimateSimpleParams}{matrix}(data, params = newSimpleParams()) } \arguments{ -\item{params}{SimpleParams object to store estimated values in.} +\item{data}{either a counts matrix or an SCESet object containing count data +to estimate parameters from.} -\item{x}{either a counts matrix or an SCESet object containing count data to -estimate parameters from.} +\item{params}{SimpleParams object to store estimated values in.} } \value{ SimpleParams object containing the estimated parameters. diff --git a/man/getParams.Rd b/man/getParams.Rd index b891230..e9a81af 100644 --- a/man/getParams.Rd +++ b/man/getParams.Rd @@ -18,7 +18,7 @@ List with the values of the selected parameters. Get multiple parameter values from a Params object. } \examples{ -params <- simpleParams() +params <- newSimpleParams() getParams(params, c("nGenes", "nCells", "mean.rate")) } diff --git a/man/setParams.Rd b/man/setParams.Rd index a49e57b..a3843db 100644 --- a/man/setParams.Rd +++ b/man/setParams.Rd @@ -29,7 +29,7 @@ collecting parameter values in some way) or individually (useful when setting them manually), see examples. } \examples{ -params <- simpleParams() +params <- newSimpleParams() params # Set individually params <- setParams(params, nGenes = 1000, nCells = 50) diff --git a/man/simpleEstimate.Rd b/man/simpleEstimate.Rd deleted file mode 100644 index d58acfd..0000000 --- a/man/simpleEstimate.Rd +++ /dev/null @@ -1,11 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/simple-estimate.R -\name{estimateSimpleParams.SCESet} -\alias{estimateSimpleParams.SCESet} -\alias{estimateSimpleParams.matrix} -\usage{ -\method{estimateSimpleParams}{SCESet}(data, params = newSimpleParams()) - -\method{estimateSimpleParams}{matrix}(data, params = newSimpleParams()) -} - diff --git a/tests/testthat/test-simulate-simple.R b/tests/testthat/test-simulate-simple.R index 832c34d..81d98d0 100644 --- a/tests/testthat/test-simulate-simple.R +++ b/tests/testthat/test-simulate-simple.R @@ -1,5 +1,5 @@ context("simple simulation") test_that("simple simulation output is valid", { - expect_true(validObject(simSimple())) + expect_true(validObject(simpleSimulate())) }) -- GitLab