Map treated conditions to their respective Day0, untreated, or single-agent references using condition metadata.
Usage
map_df(
trt_md,
ref_md,
override_untrt_controls = NULL,
ref_cols,
ref_type = c("Day0", "untrt_Endpoint")
)
Arguments
- trt_md
data.table of treated metadata.
- ref_md
data.table of untreated metadata.
- override_untrt_controls
named list indicating what treatment metadata fields should be used as a control. Defaults to
NULL
.- ref_cols
character vector of the names of reference columns to include. Likely obtained from
identify_keys()
.- ref_type
string of the reference type to map to. Should be one of
c("Day0", "untrt_Endpoint", "ref_Endpoint")
.
Examples
n <- 64
md_df <- data.table::data.table(
Gnumber = rep(c("vehicle", "untreated", paste0("G", seq(2))), each = 16),
DrugName = rep(c("vehicle", "untreated", paste0("GN", seq(2))), each = 16),
clid = paste0("C", rep_len(seq(4), n)),
CellLineName = paste0("N", rep_len(seq(4), n)),
replicates = rep_len(paste0("R", rep(seq(4), each = 4)), 64),
drug_moa = "inhibitor",
ReferenceDivisionTime = rep_len(c(120, 60), n),
Tissue = "Lung",
parental_identifier = "CL12345",
Duration = 160
)
md_df <- unique(md_df)
ref <- md_df$Gnumber %in% c("vehicle", "untreated")
ref_df <- md_df[ref, ]
trt_df <- md_df[!ref, ]
Keys <- identify_keys(trt_df)
ref_type <- "untrt_Endpoint"
map_df(
trt_df,
ref_df,
ref_cols = Keys[[ref_type]],
ref_type = ref_type
)
#> INFO [2024-11-15 20:27:28]
#> [[1]]
#> NULL
#>
#> [[2]]
#> NULL
#>
#> [[3]]
#> NULL
#>
#> [[4]]
#> NULL
#>
#> [[5]]
#> NULL
#>
#> [[6]]
#> NULL
#>
#> [[7]]
#> NULL
#>
#> [[8]]
#> NULL
#>
#> [[9]]
#> NULL
#>
#> [[10]]
#> NULL
#>
#> [[11]]
#> NULL
#>
#> [[12]]
#> NULL
#>
#> [[13]]
#> NULL
#>
#> [[14]]
#> NULL
#>
#> [[15]]
#> NULL
#>
#> [[16]]
#> NULL
#>
#> [[17]]
#> NULL
#>
#> [[18]]
#> NULL
#>
#> [[19]]
#> NULL
#>
#> [[20]]
#> NULL
#>
#> [[21]]
#> NULL
#>
#> [[22]]
#> NULL
#>
#> [[23]]
#> NULL
#>
#> [[24]]
#> NULL
#>
#> [[25]]
#> NULL
#>
#> [[26]]
#> NULL
#>
#> [[27]]
#> NULL
#>
#> [[28]]
#> NULL
#>
#> [[29]]
#> NULL
#>
#> [[30]]
#> NULL
#>
#> [[31]]
#> NULL
#>
#> [[32]]
#> NULL
#>