Skip to content

Commit f604ac2

Browse files
committed
don't test specific examples
1 parent 4bf86c1 commit f604ac2

File tree

6 files changed

+22
-11
lines changed

6 files changed

+22
-11
lines changed

R/main.R

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
#' multi-class classifier, where only cells that are "Pure" for a single model are assigned a label, cells that are "Pure" for
4747
#' more than one gating model are labeled as "Multi", all others cells are annotated as NA.
4848
#' @examples
49+
#' \donttest{
4950
#' ### Test using a small toy set
5051
#' data(query.seurat)
5152
#' # Define basic gating model for B cells
5253
#' my_scGate_model <- gating_model(name = "Bcell", signature = c("MS4A1"))
5354
#' query.seurat <- scGate(query.seurat, model = my_scGate_model, reduction="pca")
5455
#' table(query.seurat$is.pure)
55-
#' \donttest{
5656
#' ### Test with larger datasets
5757
#' library(Seurat)
5858
#' testing.datasets <- get_testing_data(version = 'hsa.latest')
@@ -168,9 +168,9 @@ scGate <- function(data,
168168
keep.ranks=keep.ranks,
169169
add.sign=additional.signatures)
170170

171-
172-
preds <- BiocParallel::bplapply(
173-
X = names(model),
171+
preds <- my.lapply(
172+
X = names(model),
173+
ncores = ncores,
174174
BPPARAM = BPPARAM,
175175
FUN = function(m) {
176176
col.id <- paste0(output.col.name, "_", m)
@@ -370,9 +370,6 @@ load_scGate_model <- function(model_file, master.table = "master_table.tsv"){
370370
#' scGate.model.db <- get_scGateDB()
371371
#' # To see a specific model, browse the list of models:
372372
#' scGate.model.db$human$generic$Myeloid
373-
#' # Apply scGate with this model
374-
#' data(query.seurat)
375-
#' query <- scGate(query.seurat, model=scGate.model.db$human$generic$Myeloid, reduction="pca")
376373
#' @seealso \code{\link{scGate}} \code{\link{load_scGate_model}}
377374
#' @importFrom dplyr %>%
378375
#' @importFrom utils download.file unzip read.table
@@ -651,6 +648,7 @@ test_my_model <- function(model, testing.version = 'hsa.latest',
651648
#' @param impure.col Color code for impure category
652649
#' @return UMAP plots with 'Pure'/'Impure' labels for each level of the scGate model
653650
#' @examples
651+
#' \donttest{
654652
#' scGate.model.db <- get_scGateDB()
655653
#' model <- scGate.model.db$human$generic$Myeloid
656654
#' # Apply scGate with this model
@@ -660,6 +658,7 @@ test_my_model <- function(model, testing.version = 'hsa.latest',
660658
#' library(patchwork)
661659
#' pll <- plot_levels(query.seurat)
662660
#' wrap_plots(pll)
661+
#' }
663662
#' @importFrom Seurat DimPlot
664663
#' @export
665664

@@ -688,6 +687,7 @@ plot_levels <- function(obj, pure.col = "green" ,impure.col = "gray"){
688687
#' @return Returns a density plot of UCell scores for the signatures in the scGate model,
689688
#' for each level of the model
690689
#' @examples
690+
#' \donttest{
691691
#' scGate.model.db <- get_scGateDB()
692692
#' model <- scGate.model.db$human$generic$Tcell
693693
#' # Apply scGate with this model
@@ -696,6 +696,7 @@ plot_levels <- function(obj, pure.col = "green" ,impure.col = "gray"){
696696
#' reduction="pca", save.levels=TRUE)
697697
#' # View UCell score distribution
698698
#' plot_UCell_scores(query.seurat, model)
699+
#' }
699700
#' @return Either a plot combined by patchwork (combine=T) or a list of plots (combine=F)
700701
#' @importFrom reshape2 melt
701702
#' @importFrom ggridges geom_density_ridges

R/utils.R

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,3 +368,12 @@ use_master_table <- function(df.model, master.table, name = "name",descript = "s
368368
# df.model[descript] <- output.sign
369369
return(df.model)
370370
}
371+
372+
#Serial or parallel lapply
373+
my.lapply <- function(X=NULL, FUN, ncores=1, BPPARAM) {
374+
if (ncores>1) {
375+
BiocParallel::bplapply(X=X, FUN=FUN, BPPARAM = BPPARAM)
376+
} else {
377+
lapply(X=X, FUN=FUN)
378+
}
379+
}

man/get_scGateDB.Rd

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/plot_UCell_scores.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/plot_levels.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/scGate.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)