Skip to content

Commit

Permalink
Merge pull request #165 from gdrplatform/hotfix_annotation
Browse files Browse the repository at this point in the history
hotfix: annotation
  • Loading branch information
bczech authored Oct 30, 2024
2 parents 0938189 + 691eb06 commit 0215f0f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 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.3.14
Date: 2024-10-24
Version: 1.3.15
Date: 2024-10-30
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.3.15 - 2024-10-30
* hot fix for annotation colnames of cell lines

## gDRcore 1.3.14 - 2024-10-24
* split and refactor annotation functions

Expand Down
4 changes: 2 additions & 2 deletions R/add_annotation.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ annotate_dt_with_cell_line <- function(
cellline <- gDRutils::get_env_identifiers("cellline")
add_clid <- gDRutils::get_header("add_clid")

checkmate::assert_names(names(cell_line_annotation), must.include = c(cellline, unlist(add_clid)))

# Remove existing annotations if any
existing_cols <- intersect(unlist(add_clid), names(data))
if (length(existing_cols) > 0) {
data[, (existing_cols) := NULL]
}

colnames(cell_line_annotation) <- c(cellline, unlist(add_clid))
data <- cell_line_annotation[data, on = cellline]
(data)
}
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-add_annotation.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ test_that("annotate_dt_with_cell_line works correctly", {
subtype = c("Subtype 1", "Subtype 2")
)
result <- annotate_dt_with_cell_line(data, cell_line_annotation, fill = "unknown")
expect_true(all(c(24, 48) %in% result$ReferenceDivisionTime))
expect_true("data.table" %in% class(result))
expect_equal(ncol(result), ncol(data) + ncol(cell_line_annotation) - 1)
expect_equal(result$CellLineName, c("Cell Line 1", "Cell Line 2", NA))
Expand Down

0 comments on commit 0215f0f

Please sign in to comment.