Skip to content

Commit

Permalink
ODC177 add error for empty gatingTemplates in constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
djhammill committed Nov 5, 2024
1 parent 3cdf015 commit 323430e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions R/AllClasses.R
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,16 @@ setGeneric("gatingTemplate", function(x, ...) standardGeneric("gatingTemplate"))
#' @rdname gatingTemplate-class
setMethod("gatingTemplate", signature(x = "character"), function(x, name = "default", strict = TRUE, strip_extra_quotes=FALSE,...) {
dt <- fread(x, ...)
# empty gatingTemplate error
if(nrow(dt) == 0) {
stop(
paste0(
"Cannot create gatingTemplate from ",
x,
" as it contains no gating entries."
)
)
}
dt <- .preprocess_csv(dt, strict = strict)

#append the isMultiPops column based on pop name
Expand All @@ -387,6 +397,14 @@ setMethod(
strict = TRUE,
strip_extra_quotes = FALSE,
...) {
if(nrow(x) == 0) {
stop(
paste0(
"Cannot create gatingTemplate from this data.table as it ",
"contains no gating entries."
)
)
}
dt <- .preprocess_csv(x, strict = strict)
#append the isMultiPops column based on pop name
dt[, isMultiPops := FALSE]
Expand Down

0 comments on commit 323430e

Please sign in to comment.