Skip to content

Commit

Permalink
Merge pull request #159 from gdrplatform/GDR-2649
Browse files Browse the repository at this point in the history
Gdr 2649
  • Loading branch information
bczech authored Aug 9, 2024
2 parents 9ffc15a + 94e6f1d commit 7c0295c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 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.8
Date: 2024-08-08
Version: 1.3.9
Date: 2024-08-09
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.9 - 2024-08-09
* fix issue with wrong mapping of Day0 data

## gDRcore 1.3.8 - 2024-08-08
* fix issue with mapping overrides untreated controls

Expand Down
4 changes: 4 additions & 0 deletions R/map_df.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ map_df <- function(trt_md,
c("concentration", "concentration2"),
simplify = FALSE
))

if (ref_type == "Day0") {
ref_md <- ref_md[get(duration_col) == 0, ]
}

conc <- cbind(array(0, nrow(ref_md)), # padding to avoid empty df;
ref_md[, intersect(names(ref_md), conc_cols), drop = FALSE])
Expand Down
14 changes: 13 additions & 1 deletion tests/testthat/test-map_df.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ test_that("map_df works as expected", {
Gnumber = c("Drug12345678", "Drug12345678", "Drug12345678", "Drug87654321", "Drug87654321", "Drug87654321"),
DrugName = c("DrugX", "DrugX", "DrugX", "DrugY", "DrugY", "DrugY"),
drug_moa = c("MOA1", "MOA1", "MOA1", "MOA2", "MOA2", "MOA2"),
Duration = c(0, 168, 168, 0, 168, 168),
Duration = c(0, 120, 120, 0, 120, 120),
E2 = c("0", "0", "0.0023", "0", "0", "0.0023"),
rn = c("3", "4", "5", "8", "9", "10")
)
Expand All @@ -67,6 +67,18 @@ test_that("map_df works as expected", {
override_untrt_controls = c(E2 = 0.0023))
expect_list(map_override_untrt_controls)
expect_length(map_override_untrt_controls, 4)
expect_equal(as.numeric(unlist(map_override_untrt_controls)), c(3, 3, 8, 8))


map_override_untrt_controls2 <- map_df(trt_dt,
ref_dt,
ref_cols = ref_cols,
ref_type = ref_type,
override_untrt_controls = NULL)

expect_list(map_override_untrt_controls2)
expect_length(map_override_untrt_controls2, 4)
expect_equal(as.numeric(unlist(map_override_untrt_controls2)), c(3, 3, 8, 8))
})


Expand Down

0 comments on commit 7c0295c

Please sign in to comment.