Skip to content

Commit

Permalink
Merge pull request #96 from gdrplatform/GDR-2829
Browse files Browse the repository at this point in the history
feat: add support for diferent run in public PRISM
  • Loading branch information
bczech authored Jan 22, 2025
2 parents eb06334 + b9266b5 commit 8da3f28
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 8 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: gDRimport
Type: Package
Title: Package for handling the import of dose-response data
Version: 1.5.4
Date: 2024-12-09
Version: 1.5.5
Date: 2025-01-11
Authors@R: c(
person("Arkadiusz", "Gladki", role=c("aut", "cre"), email="[email protected]",
comment = c(ORCID = "0000-0002-7059-6378")),
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## gDRimport 1.5.5 - 2025-01-11
* take into account run in public PRISM data

## gDRimport 1.5.4 - 2024-12-09
* support Duration in old private PRISM data format

Expand Down
4 changes: 3 additions & 1 deletion R/package.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ DICTIONARY <- list(
if (getRversion() >= "2.15.1") {
utils::globalVariables(
c(
"..with",
".N",
".SD",
"Dose",
"column_name",
"name",
"..with",
"new_name",
"value"
),
utils::packageName())
Expand Down
10 changes: 10 additions & 0 deletions R/prism_to_gdrDF.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ convert_LEVEL6_prism_to_gDR_input <- function(prism_data_path,
c("profile_id", "SampleID", "CompoundName", "GeneSymbolOfTargets"),
c("column_name", "column_name", "name", "moa"),
skip_absent = TRUE)

# take into account different runs
treatment[, new_name := if (.N > 1) paste0(name, "_run",
data.table::frank(column_name,
ties.method = "dense")) else as.character(name),
by = name]
treatment[, name := new_name]
treatment[, new_name := NULL]

checkmate::assert_names(names(cell_lines), must.include = c("row_name",
"ccle_name"))
Expand Down Expand Up @@ -177,6 +185,8 @@ convert_LEVEL6_prism_to_gDR_input <- function(prism_data_path,
full_data$value <- pmin(readout_min, 2 ^ full_data$value)
full_data <- full_data[!(is.na(name) | is.na(value))]



# data for conc = 0
untrt_tag <- gDRutils::get_env_identifiers("untreated_tag")[1]
dt_ctrl <- data.table::data.table(clid = unique(full_data$clid),
Expand Down
4 changes: 2 additions & 2 deletions inst/testdata/prism_collapsed_LOGFC.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
V1,COL_ID1
some_depmap_id,-0.0155766399108
V1,COL_ID1,COL_ID2
some_depmap_id,-0.0155766399108,-0.1
5 changes: 3 additions & 2 deletions inst/testdata/prism_treatment.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
column_name,broad_id,name,dose,screen_id,moa,target,disease.area,indication,smiles,phase
COL_ID1,some_drug_id,some_drug_name,2.325889319,MTS004,some_drug_moa,,,,,Phase X
column_name,broad_id,name,dose,screen_id,moa,target,disease.area,indication,smiles,phase,profile_id
COL_ID1,some_drug_id,some_drug_name,2.325889319,MTS004,some_drug_moa,,,,,Phase X,test1
COL_ID2,some_drug_id,some_drug_name,2.325889319,MTS004,some_drug_moa,,,,,Phase X,test2
5 changes: 4 additions & 1 deletion tests/testthat/test-prism_to_gdrDF.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ test_that("prism level6 data can be processed into gDR format ", {
cell_line_data_path,
treatment_data_path)
expect_is(df_prism$result, "data.table")
expect_equal(dim(df_prism$result), c(2, 8))
expect_equal(dim(df_prism$result), c(3, 8))
expect_true(all(gDRutils::get_env_identifiers(c("drug", "cellline"),
simplify = FALSE) %in% names(df_prism$result)))
expect_equal(df_prism[["result"]][[gDRutils::get_env_identifiers("drug")]],
c("some_drug_name_run1", "some_drug_name_run2", "vehicle"))

})

0 comments on commit 8da3f28

Please sign in to comment.