diff --git a/DESCRIPTION b/DESCRIPTION index b12113a3..fa833ee8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,8 @@ Type: Package Package: gDRcore Title: Processing functions and interface to process and analyze drug dose-response data -Version: 1.5.2 -Date: 2024-11-15 +Version: 1.5.3 +Date: 2024-12-18 Authors@R: c( person("Bartosz", "Czech", , "bartosz.czech@contractors.roche.com", role = "aut", comment = c(ORCID = "0000-0002-9908-3007")), diff --git a/NEWS.md b/NEWS.md index 84d4e2c7..cea81d39 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +## gDRcore 1.5.3 - 2024-12-18 +* fix melt error after changed `intersect` behaviour + ## gDRcore 1.5.2 - 2024-11-15 * fix melt in annotation function to fix Bioc error diff --git a/R/add_annotation.R b/R/add_annotation.R index fd2ed9f5..ac36bd80 100644 --- a/R/add_annotation.R +++ b/R/add_annotation.R @@ -283,9 +283,11 @@ remove_drug_batch <- function(drug) { #' get_drug_annotation_from_dt(dt) get_drug_annotation_from_dt <- function(dt) { checkmate::assert_data_table(dt) - drug_cols <- intersect(gDRutils::get_env_identifiers() - [grep("drug", names(gDRutils::get_env_identifiers()))], - names(dt)) + + identifiers <- gDRutils::get_env_identifiers() + drug_ids <- identifiers[grep("drug", names(identifiers))] + drug_cols <- Filter(function(el) el %in% names(dt), drug_ids) + dt_drug <- dt[, unlist(drug_cols), with = FALSE] dt_long <- data.table::melt(dt_drug, measure.vars = patterns(gsub("[0-9]", @@ -294,9 +296,9 @@ get_drug_annotation_from_dt <- function(dt) { unlist(drug_cols[c("drug", "drug_name", "drug_moa")])))), - value.name = as.character(unlist(drug_cols[c("drug", - "drug_name", - "drug_moa")]))) + value.name = unlist(drug_cols[c("drug", + "drug_name", + "drug_moa")])) dt_long[, "variable" := NULL] unique_dt <- unique(dt_long) unique_dt[!unique_dt[[drug_cols[["drug"]]]] %in% gDRutils::get_env_identifiers("untreated_tag"), ]