Skip to content
Snippets Groups Projects
Commit 73e8e8d8 authored by Luke Zappia's avatar Luke Zappia
Browse files

Add suggested package checks to examples

parent 0ce11e5d
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,9 @@
#' Code: \url{https://github.com/catavallejos/BASiCS}
#'
#' @examples
#' sim <- BASiCSSimulate()
#' if (requireNamespace("BASiCS", quietly = TRUE)) {
#' sim <- BASiCSSimulate()
#' }
#' @export
BASiCSSimulate <- function(params = newBASiCSParams(), verbose = TRUE, ...) {
......
......@@ -16,11 +16,13 @@
#'
#' @examples
#' # Load example data
#' library(scater)
#' data("sc_example_counts")
#' if (requireNamespace("mfa", quietly = TRUE)) {
#' library(scater)
#' data("sc_example_counts")
#'
#' params <- mfaEstimate(sc_example_counts)
#' params
#' params <- mfaEstimate(sc_example_counts)
#' params
#' }
#' @export
mfaEstimate <- function(counts, params = newMFAParams()) {
UseMethod("mfaEstimate")
......
......@@ -27,7 +27,9 @@
#' Code: \url{https://github.com/kieranrcampbell/mfa}
#'
#' @examples
#' sim <- mfaSimulate()
#' if (requireNamespace("mfa", quietly = TRUE)) {
#' sim <- mfaSimulate()
#' }
#' @export
mfaSimulate <- function(params = newMFAParams(), verbose = TRUE, ...) {
......
......@@ -15,12 +15,14 @@
#' @return PhenoParams object containing the estimated parameters.
#'
#' @examples
#' # Load example data
#' library(scater)
#' data("sc_example_counts")
#' if (requireNamespace("phenopath", quietly = TRUE)) {
#' # Load example data
#' library(scater)
#' data("sc_example_counts")
#'
#' params <- phenoEstimate(sc_example_counts)
#' params
#' params <- phenoEstimate(sc_example_counts)
#' params
#' }
#' @export
phenoEstimate <- function(counts, params = newPhenoParams()) {
UseMethod("phenoEstimate")
......
......@@ -29,8 +29,9 @@
#' Code: \url{https://github.com/kieranrcampbell/phenopath}
#'
#' @examples
#' sim <- phenoSimulate()
#'
#' if (requireNamespace("phenopath", quietly = TRUE)) {
#' sim <- phenoSimulate()
#' }
#' @export
#' @importFrom SingleCellExperiment SingleCellExperiment
phenoSimulate <- function(params = newPhenoParams(), verbose = TRUE, ...) {
......
......@@ -24,16 +24,18 @@
#' @return SparseParams object containing the estimated parameters.
#'
#' @examples
#' # Load example data
#' library(scater)
#' data("sc_example_counts")
#' if (requireNamespace("SparseDC", quietly = TRUE)) {
#' # Load example data
#' library(scater)
#' data("sc_example_counts")
#'
#' set.seed(1)
#' conditions <- sample(1:2, ncol(sc_example_counts), replace = TRUE)
#' set.seed(1)
#' conditions <- sample(1:2, ncol(sc_example_counts), replace = TRUE)
#'
#' params <- sparseDCEstimate(sc_example_counts[1:500, ], conditions,
#' nclusters = 3)
#' params
#' params <- sparseDCEstimate(sc_example_counts[1:500, ], conditions,
#' nclusters = 3)
#' params
#' }
#' @export
sparseDCEstimate <- function(counts, conditions, nclusters, norm = TRUE,
params = newSparseDCParams()) {
......
......@@ -31,8 +31,9 @@
#' Paper: \url{10.1093/nar/gkx1113}
#'
#' @examples
#' sim <- sparseDCSimulate()
#'
#' if (requireNamespace("SparseDC", quietly = TRUE)) {
#' sim <- sparseDCSimulate()
#' }
#' @export
#' @importFrom SingleCellExperiment SingleCellExperiment
sparseDCSimulate <- function(params = newSparseDCParams(),
......
......@@ -30,7 +30,9 @@
#' Code: \url{https://github.com/drisso/zinbwave}
#'
#' @examples
#' sim <- zinbSimulate()
#' if (requireNamespace("zinbwave", quietly = TRUE)) {
#' sim <- zinbSimulate()
#' }
#'
#' @export
#' @importFrom SingleCellExperiment SingleCellExperiment
......
......@@ -28,7 +28,9 @@ See \code{\link[BASiCS]{BASiCS_Sim}} for more details of how the simulation
works.
}
\examples{
sim <- BASiCSSimulate()
if (requireNamespace("BASiCS", quietly = TRUE)) {
sim <- BASiCSSimulate()
}
}
\references{
Vallejos CA, Marioni JC, Richardson S. BASiCS: Bayesian Analysis of
......
......@@ -33,9 +33,11 @@ details on the parameters.
}
\examples{
# Load example data
library(scater)
data("sc_example_counts")
if (requireNamespace("mfa", quietly = TRUE)) {
library(scater)
data("sc_example_counts")
params <- mfaEstimate(sc_example_counts)
params
params <- mfaEstimate(sc_example_counts)
params
}
}
......@@ -29,7 +29,9 @@ output from log-expression to counts and returns a
how the simulation works.
}
\examples{
sim <- mfaSimulate()
if (requireNamespace("mfa", quietly = TRUE)) {
sim <- mfaSimulate()
}
}
\references{
Campbell KR, Yau C. Probabilistic modeling of bifurcations in single-cell
......
......@@ -32,10 +32,12 @@ 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")
if (requireNamespace("phenopath", quietly = TRUE)) {
# Load example data
library(scater)
data("sc_example_counts")
params <- phenoEstimate(sc_example_counts)
params
params <- phenoEstimate(sc_example_counts)
params
}
}
......@@ -31,8 +31,9 @@ See \code{\link[phenopath]{simulate_phenopath}} and the PhenoPath paper for
more details about how the simulation works.
}
\examples{
sim <- phenoSimulate()
if (requireNamespace("phenopath", quietly = TRUE)) {
sim <- phenoSimulate()
}
}
\references{
Campbell K, Yau C. Uncovering genomic trajectories with heterogeneous genetic
......
......@@ -46,14 +46,16 @@ input data. The counts are preprocessed using
See \code{\link{SparseDCParams}} for more details on the parameters.
}
\examples{
# Load example data
library(scater)
data("sc_example_counts")
if (requireNamespace("SparseDC", quietly = TRUE)) {
# Load example data
library(scater)
data("sc_example_counts")
set.seed(1)
conditions <- sample(1:2, ncol(sc_example_counts), replace = TRUE)
set.seed(1)
conditions <- sample(1:2, ncol(sc_example_counts), replace = TRUE)
params <- sparseDCEstimate(sc_example_counts[1:500, ], conditions,
nclusters = 3)
params
params <- sparseDCEstimate(sc_example_counts[1:500, ], conditions,
nclusters = 3)
params
}
}
......@@ -31,8 +31,9 @@ See \code{\link[SparseDC]{sim_data}} and the SparseDC paper for
more details about how the simulation works.
}
\examples{
sim <- sparseDCSimulate()
if (requireNamespace("SparseDC", quietly = TRUE)) {
sim <- sparseDCSimulate()
}
}
\references{
Campbell K, Yau C. Uncovering genomic trajectories with heterogeneous genetic
......
......@@ -28,7 +28,9 @@ See \code{\link[zinbwave]{zinbSim}} and the ZINB-WaVE paper for
more details about how the simulation works.
}
\examples{
sim <- zinbSimulate()
if (requireNamespace("zinbwave", quietly = TRUE)) {
sim <- zinbSimulate()
}
}
\references{
......
......@@ -2,5 +2,5 @@ context("BASiCS simulation")
test_that("BASiCS simulation output is valid", {
skip_if_not_installed("BASiCS")
expect_true(validObject(sparseDCSimulate()))
expect_true(validObject(BASiCSSimulate()))
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment