Skip to content

Commit

Permalink
Merge pull request #168 from gdrplatform/GDR-2806
Browse files Browse the repository at this point in the history
fix: fix melt error after changed intersect behaviour
  • Loading branch information
marcin-kam authored Dec 18, 2024
2 parents 084282a + c5dba77 commit a08b10a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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", , "[email protected]", role = "aut",
comment = c(ORCID = "0000-0002-9908-3007")),
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
14 changes: 8 additions & 6 deletions R/add_annotation.R
Original file line number Diff line number Diff line change
Expand Up @@ -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]",
Expand All @@ -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"), ]
Expand Down

0 comments on commit a08b10a

Please sign in to comment.