Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove scales v1.3.0 dependency. #397

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Imports:
Rgraphviz,
data.table,
dplyr,
scales(>= 1.3.0),
scales,
matrixStats,
RProtoBufLib,
flowCore(>= 2.1.1),
Expand Down
4 changes: 2 additions & 2 deletions R/GatingSet_Methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
10 changes: 9 additions & 1 deletion R/parse_transformer.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
}