diff --git a/DESCRIPTION b/DESCRIPTION index 2bd09c45..f8bd73dd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -32,7 +32,7 @@ Imports: Rgraphviz, data.table, dplyr, - scales(>= 1.3.0), + scales, matrixStats, RProtoBufLib, flowCore(>= 2.1.1), diff --git a/R/GatingSet_Methods.R b/R/GatingSet_Methods.R index 8e80deef..4830a1e5 100644 --- a/R/GatingSet_Methods.R +++ b/R/GatingSet_Methods.R @@ -1099,12 +1099,12 @@ setMethod("transform", transformerList <- function (from, trans) { from <- unique(from) - if(is(trans, "transform"))trans <- list(trans) + if(valid_scales_transformer(trans))trans <- list(trans) if (!is.character(from)) stop("'from' must be character vectors.", call. = FALSE) if (!is.list(trans)) trans <- list(trans) - if (!all(sapply(trans, is, "transform"))) + if (!all(sapply(trans, valid_scales_transformer))) stop("'trans' must be a list of transformer objects (generated by scales::trans_new method)", call. = FALSE) trans <- rep(trans, length(from)) trans <- trans[1:length(from)] diff --git a/R/parse_transformer.R b/R/parse_transformer.R index dd7dc2b3..cfd07f2e 100644 --- a/R/parse_transformer.R +++ b/R/parse_transformer.R @@ -3,7 +3,7 @@ #' @return a list that represents the data structure that is ready to be passed to Rcpp API 'set_transformations' #' @noRd parse_transformer <- function(x){ - stopifnot(is(x, "transform")) + stopifnot(valid_scales_transformer(x)) transobj <- as.list(environment(x[["transform"]])) transobj[["type"]] <- x[["name"]] if(transobj[["type"]] == "flowJo_biexp") @@ -17,3 +17,11 @@ parse_transformer <- function(x){ return(transobj) } + +#' check whether transformers have correct scales class +#' @return logical +#' @noRd +valid_scales_transformer <- function(x) { + # scales < 1.3.0 = "trans" | scales >= 1.30 = "transform" + inherits(x, "trans") || inherits(x, "transform") +}