| Title: | Package for handling the import of dose-response data |
|---|---|
| Description: | The package is a part of the gDR suite. It helps to prepare raw drug response data for downstream processing. It mainly contains helper functions for importing/loading/validating dose-response data provided in different file formats. |
| Authors: | Arkadiusz Gladki [aut, cre] (ORCID: <https://orcid.org/0000-0002-7059-6378>), Bartosz Czech [aut] (ORCID: <https://orcid.org/0000-0002-9908-3007>), Marc Hafner [aut] (ORCID: <https://orcid.org/0000-0003-1337-7598>), Sergiu Mocanu [aut], Dariusz Scigocki [aut], Allison Vuong [aut], Luca Gerosa [aut] (ORCID: <https://orcid.org/0000-0001-6805-9410>), Janina Smola [aut] (ORCID: <https://orcid.org/0009-0007-4347-7748>) |
| Maintainer: | Arkadiusz Gladki <[email protected]> |
| License: | Artistic-2.0 |
| Version: | 1.11.8 |
| Built: | 2026-10-09 09:22:46 UTC |
| Source: | https://github.com/bioc/gDRimport |
Check whether all metadata names are correct
check_metadata_names(col_df, df_name = "", df_type = NULL)check_metadata_names(col_df, df_name = "", df_type = NULL)
col_df |
a character with colnames of df |
df_name |
a name of data.table ("" by default) |
df_type |
a type of a data.table (NULL by default) |
a charvec with corrected colnames of df
td <- get_test_data() m_file <- manifest_path(td) m_data <- read_excel_to_dt(m_file) result <- check_metadata_names(col_df = colnames(m_data))td <- get_test_data() m_file <- manifest_path(td) m_data <- read_excel_to_dt(m_file) result <- check_metadata_names(col_df = colnames(m_data))
Load, convert and process the level 5 PRISM data into a gDR input
convert_LEVEL5_prism_to_gDR_input( prism_data_path, meta_data_path, readout_min = 1.03 )convert_LEVEL5_prism_to_gDR_input( prism_data_path, meta_data_path, readout_min = 1.03 )
prism_data_path |
path to PRISM LEVEL5 csv file with data |
meta_data_path |
path to metadata file describing all cancer models/cell lines which are referenced by a dataset contained within the DepMap portal |
readout_min |
minimum ReadoutValue |
data.table object with input data for gDR pipeline
prism_data <- system.file("testdata/prism_sa.csv", package = "gDRimport") prism_meta <- system.file("testdata/prism_model.csv", package = "gDRimport") convert_LEVEL5_prism_to_gDR_input(prism_data, prism_meta)prism_data <- system.file("testdata/prism_sa.csv", package = "gDRimport") prism_meta <- system.file("testdata/prism_model.csv", package = "gDRimport") convert_LEVEL5_prism_to_gDR_input(prism_data, prism_meta)
Load, convert and process the level 6 PRISM data into a gDR input
convert_LEVEL6_prism_to_gDR_input( prism_data_path, cell_line_data_path, treatment_data_path, meta_data_path, readout_min = 1.03 )convert_LEVEL6_prism_to_gDR_input( prism_data_path, cell_line_data_path, treatment_data_path, meta_data_path, readout_min = 1.03 )
prism_data_path |
path to PRISM LEVEL6 csv file with collapsed log fold change data |
cell_line_data_path |
path to cell line info data |
treatment_data_path |
path to collapsed treatment info data |
meta_data_path |
path to metadata file describing all cancer models/cell lines which are referenced by a dataset contained within the DepMap portal |
readout_min |
minimum ReadoutValue |
data.table object with input data for gDR pipeline
prism_data_path <- system.file("testdata/prism_collapsed_LOGFC.csv", package = "gDRimport") cell_line_data_path <- system.file("testdata/prism_cell_lines.csv", package = "gDRimport") treatment_data_path <- system.file("testdata/prism_treatment.csv", package = "gDRimport") prism_meta <- system.file("testdata/prism_model.csv", package = "gDRimport") convert_LEVEL6_prism_to_gDR_input(prism_data_path, cell_line_data_path, treatment_data_path, prism_meta)prism_data_path <- system.file("testdata/prism_collapsed_LOGFC.csv", package = "gDRimport") cell_line_data_path <- system.file("testdata/prism_cell_lines.csv", package = "gDRimport") treatment_data_path <- system.file("testdata/prism_treatment.csv", package = "gDRimport") prism_meta <- system.file("testdata/prism_model.csv", package = "gDRimport") convert_LEVEL6_prism_to_gDR_input(prism_data_path, cell_line_data_path, treatment_data_path, prism_meta)
This function converts a MultiAssayExperiment generated by gDR into a TreatmentResponseExperiment for use in the PharmacoGx package. The resulting PharmacoSet can be used for pharmacogenomic analysis of drug response.
convert_MAE_to_PSet(mae, pset_name)convert_MAE_to_PSet(mae, pset_name)
mae |
A MultiAssayExperiment object generated by gDR. |
pset_name |
A character string specifying the name of the resulting PharmacoSet object. |
A PharmacoSet object.
# Convert a MultiAssayExperiment object to a PharmacoSet object m <- 20 n <- 10 rnames <- LETTERS[1:m] cnames <- letters[1:n] ref_gr_value <- matrix(runif(m * n), nrow = m, ncol = n, dimnames = list(rnames, cnames)) se <- SummarizedExperiment::SummarizedExperiment(assays = list(RefGRvalue = ref_gr_value), rowData = S4Vectors::DataFrame(rnames), colData = S4Vectors::DataFrame(cnames)) mae <- MultiAssayExperiment::MultiAssayExperiment(experiments = list("single-agent" = se)) convert_MAE_to_PSet(mae, "my_pset")# Convert a MultiAssayExperiment object to a PharmacoSet object m <- 20 n <- 10 rnames <- LETTERS[1:m] cnames <- letters[1:n] ref_gr_value <- matrix(runif(m * n), nrow = m, ncol = n, dimnames = list(rnames, cnames)) se <- SummarizedExperiment::SummarizedExperiment(assays = list(RefGRvalue = ref_gr_value), rowData = S4Vectors::DataFrame(rnames), colData = S4Vectors::DataFrame(cnames)) mae <- MultiAssayExperiment::MultiAssayExperiment(experiments = list("single-agent" = se)) convert_MAE_to_PSet(mae, "my_pset")
Convert a PharmacoSet to a data.table that is prepare for input into gDR pipeline
convert_pset_to_df(pharmacoset, run_parallel = TRUE, workers = 2L)convert_pset_to_df(pharmacoset, run_parallel = TRUE, workers = 2L)
pharmacoset |
PharmacoSet object |
run_parallel |
logical, TRUE (default) if to run functions in Parallel, FALSE to run in serial |
workers |
integer, number of workers defaults to 2L if run_parallel is TRUE |
data.table of PharmacoSet's dose response data with column names aligned with gDR standard
Jermiah Joseph – collaboration with BHKLab
pset <- suppressMessages(getPSet( "Tavor_2020", psetDir = system.file("extdata/pset", package = "gDRimport"), use_local_PSets_list = TRUE )) dt <- convert_pset_to_df(pset) gDRutils::reset_env_identifiers()pset <- suppressMessages(getPSet( "Tavor_2020", psetDir = system.file("extdata/pset", package = "gDRimport"), use_local_PSets_list = TRUE )) dt <- convert_pset_to_df(pset) gDRutils::reset_env_identifiers()
Detect format of results data
detect_file_format(results_file)detect_file_format(results_file)
results_file |
path to results data |
string of the detected file format
td2 <- get_test_Tecan_data() detect_file_format(td2$r_files[1])td2 <- get_test_Tecan_data() detect_file_format(td2$r_files[1])
Fix typos using reference data Evaluate given list of ids and try to update them
fix_typos_with_reference( data, ref, method = c("exact", "grepl", "adist"), fix_underscores = FALSE )fix_typos_with_reference( data, ref, method = c("exact", "grepl", "adist"), fix_underscores = FALSE )
data |
list of charvec(s) or charvec with data |
ref |
charvec with reference data |
method |
charvec type of the method to be used 'exact' is used to find identical entries from 'ref' in the data (after corrections and uppercase'ing) 'grepl' is used to find entries from 'ref' that might be somehow pre- or post- fixed |
fix_underscores |
logical flag fix the issues with underscores in data identfiers? |
list or charvec with corrected data
Object class gdr_test_data is build by function get_test_data()
object class gdr_test_data with primary test data
manifest_pathcharacter, path to manifest file
result_pathcharacter, path(s) to results file
template_pathcharacter, path(s) to data.table with template data
ref_m_dfcharacter, data.table with manifest data
ref_r1_r2character, path to reference file with raw data for treated & untreated
ref_r1character, path to reference file with raw data for treated
ref_t1_t2character, path to reference template file with treated & untreated data
ref_t1character, path to reference template file with treated data
Get final results (as a data.table) from raw edited EnVision data.table
get_df_from_raw_edited_EnVision_df( df, barcode_idx, barcode_col, n_row, n_col, fname, sheet_name, headers )get_df_from_raw_edited_EnVision_df( df, barcode_idx, barcode_col, n_row, n_col, fname, sheet_name, headers )
df |
raw data.table |
barcode_idx |
numeric vector with barcode indices |
barcode_col |
column number for barcode data |
n_row |
number of rows |
n_col |
number of columns |
fname |
file name |
sheet_name |
name of the Excel sheet |
headers |
list with the headersa |
data.table derived from EnVision data
Get final results (as a data.table) from raw unedited EnVision data.table
get_df_from_raw_unedited_EnVision_df(df, n_row, n_col, barcode_col)get_df_from_raw_unedited_EnVision_df(df, n_row, n_col, barcode_col)
df |
raw data.table |
n_row |
number of rows |
n_col |
number of columns |
barcode_col |
column number for barcode data |
data.table derived from EnVision data
get exception data
get_exception_data(status_code = NULL)get_exception_data(status_code = NULL)
status_code |
A numeric value |
A data.table row with exception data or all exceptions
get_exception_data(1) get_exception_data()get_exception_data(1) get_exception_data()
Get names of the sheets expected in templates xlsx
get_expected_template_sheets(type = c("all", "core", "optional"))get_expected_template_sheets(type = c("all", "core", "optional"))
type |
charvec type of the sheets |
string with type of the sheets
get test D300 data
get_test_D300_data()get_test_D300_data()
list with with input data (manifest/template/result paths) and related reference data (qs2 file paths)
get_test_D300_data()get_test_D300_data()
get primary test data
get_test_data()get_test_data()
object class "gdr_test_data" with with input data (manifest/template/result paths) and related reference data (qs2 file paths)
get_test_data()get_test_data()
get test EnVision data
get_test_EnVision_data()get_test_EnVision_data()
list with with input data (manifest/template/result paths) and related reference data (.qs2 file paths)
get_test_EnVision_data()get_test_EnVision_data()
get test Tecan data
get_test_Tecan_data()get_test_Tecan_data()
list with with input data (manifest/template/result paths) and related reference data (qs2 file paths)
get_test_Tecan_data()get_test_Tecan_data()
get test tsv data
get_test_tsv_data()get_test_tsv_data()
list with with input data (manifest/template/result paths) and related reference data (.qs2 file paths)
get_test_tsv_data()get_test_tsv_data()
Get PharmacoSet
getPSet( pset_name, psetDir = getwd(), canonical = FALSE, timeout = 600, use_local_PSets_list = FALSE )getPSet( pset_name, psetDir = getwd(), canonical = FALSE, timeout = 600, use_local_PSets_list = FALSE )
pset_name |
string with the name of the PharmacoSet |
psetDir |
string with the temporary directory for the PharmacoSet |
canonical |
logical flag indicating if the PSet canonical |
timeout |
maximum number of seconds allowed for PSet download |
use_local_PSets_list |
logical flag if PSets list should be used from local. If FALSE PSets list will be taken from web. |
PharmacoSet object
suppressMessages(getPSet( "Tavor_2020", psetDir = system.file("extdata/pset", package = "gDRimport"), use_local_PSets_list = TRUE ))suppressMessages(getPSet( "Tavor_2020", psetDir = system.file("extdata/pset", package = "gDRimport"), use_local_PSets_list = TRUE ))
This functions takes a D300 file and generates corresponding template files
import_D300(D300_file, destination_path, metadata_file = NULL, day0 = FALSE)import_D300(D300_file, destination_path, metadata_file = NULL, day0 = FALSE)
D300_file |
character, file path to D300 file |
destination_path |
character, path to folder where template files will be generated |
metadata_file |
character, file path to file with mapping from D300 names to Gnumbers. Defaults to NULL. |
day0 |
logical, if TRUE, creates a template file for Day 0 data filled with vehicles in addition to the standard plates. Defaults to FALSE. |
For example, wells treated with 2 drugs in combination will result in 4 sheets per plate.
Sheet 1: Drug 1
Sheet 2: Conc of Drug 1
Sheet 3: Drug 2
Sheet 4: Conc of Drug 2
Create one Excel file per plate. Each sheet in each plate file describes the drugs and corrresponding concentrations of what was tested in each well.
td3 <- get_test_D300_data()[["f_96w"]] o_path <- file.path(tempdir(), "td3") dir.create(o_path) import_D300(td3$d300, o_path, td3$Gnum) list.files(o_path) unlink(o_path, recursive = TRUE)td3 <- get_test_D300_data()[["f_96w"]] o_path <- file.path(tempdir(), "td3") dir.create(o_path) import_D300(td3$d300, o_path, td3$Gnum) list.files(o_path) unlink(o_path, recursive = TRUE)
is_readable_v Check if all paths in vector are readable
is_readable_v(paths)is_readable_v(paths)
paths |
a character with path(s) |
NULL invisibly.
td2 <- get_test_Tecan_data() is_readable_v(td2$r_files)td2 <- get_test_Tecan_data() is_readable_v(td2$r_files)
This functions loads and checks the data file(s)
load_data( manifest_file, df_template_files, results_file, instrument = "EnVision" )load_data( manifest_file, df_template_files, results_file, instrument = "EnVision" )
manifest_file |
character, file path(s) to manifest(s) |
df_template_files |
data.table, with datapaths and names of results file(s) or character with file path of templates file(s) |
results_file |
data.table, with datapaths and names of results file(s) or character with file path of results file(s) |
instrument |
character |
a list with three data.tables for manifest/treatment and results
td <- get_test_data() l_tbl <- load_data(manifest_path(td), template_path(td), result_path(td))td <- get_test_data() l_tbl <- load_data(manifest_path(td), template_path(td), result_path(td))
Loads a long/tidy data.table from a delimited text file (CSV/TSV) and
checks that it contains the columns required by the gDR pipeline. This offers
an input path that does not rely on GeneDataScreeneR: the data can come from a
custom export or be provided directly by the user in tabular form, matching
the shape of the data_imported object used downstream.
load_long_table(long_table_file)load_long_table(long_table_file)
long_table_file |
character, path to a single CSV/TSV file with the long table. The field separator is detected automatically. |
Required columns follow the current gDR identifiers: Gnumber,
clid, Duration and Concentration. The readout column is
the fixed header ReadoutValue: there is no "readout" identifier
in gDRutils, so this name is not customisable via
get_env_identifiers(), matching how ReadoutValue is used across
the rest of gDRimport.
Combination data may add Gnumber_2 and Concentration_2.
Duration, Concentration and ReadoutValue must be numeric.
a data.table with the validated long table
path <- tempfile(fileext = ".csv") dt <- data.table::data.table(Gnumber = "G1", clid = "CL1", Duration = 72, Concentration = 1, ReadoutValue = 1000) data.table::fwrite(dt, path) load_long_table(path)path <- tempfile(fileext = ".csv") dt <- data.table::data.table(Gnumber = "G1", clid = "CL1", Duration = 72, Concentration = 1, ReadoutValue = 1000) data.table::fwrite(dt, path) load_long_table(path)
This functions loads and checks the manifest file(s)
load_manifest(manifest_file)load_manifest(manifest_file)
manifest_file |
character, file path(s) to manifest(s) |
list with manifest data.table and headers
td <- get_test_data() ml <- load_manifest(manifest_path(td))td <- get_test_data() ml <- load_manifest(manifest_path(td))
This functions loads and checks the results file(s)
load_results( df_results_files, instrument = "EnVision", headers = gDRutils::get_env_identifiers() )load_results( df_results_files, instrument = "EnVision", headers = gDRutils::get_env_identifiers() )
df_results_files |
data.table, with datapaths and names of results file(s) or character with file path of results file(s) |
instrument |
character |
headers |
list of headers identified in the manifest file |
data.table with results' data
td <- get_test_data() r_df <- load_results(result_path(td))td <- get_test_data() r_df <- load_results(result_path(td))
This functions loads and checks the results file(s)
load_results_EnVision(results_file, headers = gDRutils::get_env_identifiers())load_results_EnVision(results_file, headers = gDRutils::get_env_identifiers())
results_file |
character vector containing file path(s) to results file(s) |
headers |
list of headers identified in the manifest |
data.table with results data
This functions loads incucyte time-course cell count file
load_results_Incucyte(results_file, headers = gDRutils::get_env_identifiers())load_results_Incucyte(results_file, headers = gDRutils::get_env_identifiers())
results_file |
list of strings: file paths to result paths from individual plates |
headers |
list of headers identified in the manifest |
data.table derived from Incucyte data
This functions loads and checks the results file
load_results_Tecan(results_file, headers = gDRutils::get_env_identifiers())load_results_Tecan(results_file, headers = gDRutils::get_env_identifiers())
results_file |
string, file path to a result file |
headers |
list of headers identified in the manifest |
data.table derived from Tecan data
This functions loads and checks the results file(s)
load_results_tsv(results_file, headers)load_results_tsv(results_file, headers)
results_file |
character, file path(s) to template(s) |
headers |
list of headers identified in the manifest |
data.table with results data
This functions loads and checks the template file(s)
load_templates(df_template_files)load_templates(df_template_files)
df_template_files |
data.table, with datapaths and names of results file(s) or character with file path of templates file(s) |
data.table with templates data
td <- get_test_data() t_df <- load_templates(template_path(td))td <- get_test_data() t_df <- load_templates(template_path(td))
This functions loads and checks the template file(s)
load_templates_tsv(template_file, template_filename = NULL)load_templates_tsv(template_file, template_filename = NULL)
template_file |
character, file path(s) to template(s) |
template_filename |
character, file name(s) |
data.table with template data
This functions loads and checks the template file(s)
load_templates_xlsx(template_file, template_filename = NULL)load_templates_xlsx(template_file, template_filename = NULL)
template_file |
character, file path(s) to template(s) |
template_filename |
character, file name(s) |
data.table with templates data
This function parses a D300 *.tdd file (XML format) into a data.table
parse_D300_xml(D300_file)parse_D300_xml(D300_file)
D300_file |
string, file path to D300 .tdd file |
data.table representing input D300_file.
td3 <- get_test_D300_data() fs <- td3[["f_96w"]] dose_df <- parse_D300_xml(fs[["d300"]])td3 <- get_test_D300_data() fs <- td3[["f_96w"]] dose_df <- parse_D300_xml(fs[["d300"]])
Read excel file and transorm it into data.table object
read_excel_to_dt(path, ...)read_excel_to_dt(path, ...)
path |
path to excel file |
... |
other arguments that should be passed into |
data.table object with read excel file
datasets <- readxl::readxl_example("datasets.xlsx") read_excel_to_dt(datasets)datasets <- readxl::readxl_example("datasets.xlsx") read_excel_to_dt(datasets)
for each drug create a Gnumber and Concentration information for each well
save_drug_info_per_well(trt_info, trt_gnumber_conc, wb, idfs)save_drug_info_per_well(trt_info, trt_gnumber_conc, wb, idfs)
trt_info |
list with treatment info |
trt_gnumber_conc |
list with treatment data |
wb |
pointer to xlsx workbook |
idfs |
charvec with identifiers |
NULL invisibly.
Adjust environment variables to meet gDR standards
setEnvForPSet()setEnvForPSet()
NULL
setEnvForPSet() gDRutils::reset_env_identifiers()setEnvForPSet() gDRutils::reset_env_identifiers()
map values to a dictionary
standardize_record_values(x, dictionary = DICTIONARY)standardize_record_values(x, dictionary = DICTIONARY)
x |
a named array |
dictionary |
a named array |
a named array with updated names
standardize_record_values(c("Vehicle", "vehcle"))standardize_record_values(c("Vehicle", "vehcle"))