Convert a SummarizedExperiment assay to a long data.table
Source:R/convert_mae_se_assay_to_dt.R
convert_se_assay_to_dt.Rd
Convert an assay within a SummarizedExperiment object to a long data.table.
Usage
convert_se_assay_to_dt(
se,
assay_name,
include_metadata = TRUE,
retain_nested_rownames = FALSE,
wide_structure = FALSE
)
Arguments
- se
A SummarizedExperiment object holding raw and/or processed dose-response data in its assays.
- assay_name
String of name of the assay to transform within the
se
.- include_metadata
Boolean indicating whether or not to include
rowData(se)
andcolData(se)
in the returned data.table. Defaults toTRUE
.- retain_nested_rownames
Boolean indicating whether or not to retain the rownames nested within a
BumpyMatrix
assay. Defaults toFALSE
. If theassay_name
is not of theBumpyMatrix
class, this argument's value is ignored. IfTRUE
, the resulting column in the data.table will be named as"<assay_name>_rownames"
.- wide_structure
Boolean indicating whether or not to transform data.table into wide format.
wide_structure = TRUE
requiresretain_nested_rownames = TRUE
.
Details
NOTE: to extract information about 'Control' data, simply call the
function with the name of the assay holding data on controls.
To extract the reference data in to same format as 'Averaged' use convert_se_ref_assay_to_dt
.
Examples
mae <- get_synthetic_data("finalMAE_small")
se <- mae[[1]]
convert_se_assay_to_dt(se, "Metrics")
#> rId cId x_mean
#> <char> <char> <num>
#> 1: G00002_drug_002_moa_A_72 CL00011_cellline_BA_tissue_x_26 0.4466890
#> 2: G00002_drug_002_moa_A_72 CL00011_cellline_BA_tissue_x_26 0.4729298
#> 3: G00003_drug_003_moa_A_72 CL00011_cellline_BA_tissue_x_26 0.3939872
#> 4: G00003_drug_003_moa_A_72 CL00011_cellline_BA_tissue_x_26 0.3932199
#> 5: G00004_drug_004_moa_A_72 CL00011_cellline_BA_tissue_x_26 0.7989283
#> ---
#> 196: G00009_drug_009_moa_A_72 CL00020_cellline_KB_tissue_z_62 0.0774842
#> 197: G00010_drug_010_moa_A_72 CL00020_cellline_KB_tissue_z_62 0.5769999
#> 198: G00010_drug_010_moa_A_72 CL00020_cellline_KB_tissue_z_62 0.1991504
#> 199: G00011_drug_011_moa_B_72 CL00020_cellline_KB_tissue_z_62 0.4117805
#> 200: G00011_drug_011_moa_B_72 CL00020_cellline_KB_tissue_z_62 -0.1148134
#> x_AOC x_AOC_range xc50 x_max ec50 x_inf
#> <num> <num> <num> <num> <num> <num>
#> 1: 0.5533110 0.6277120 0.007253171 0.32793333 0.003795893 0.34682665
#> 2: 0.5270702 0.6048472 0.008956223 0.33660000 0.004512560 0.36516781
#> 3: 0.6060128 0.6954994 0.005655581 0.27413333 0.003962986 0.28319787
#> 4: 0.6067801 0.7027714 0.006591468 0.25136667 0.004714084 0.26639679
#> 5: 0.2010717 0.2385432 Inf 0.70636667 0.016546380 0.71001484
#> ---
#> 196: 0.9225158 1.0742560 0.026077313 -0.49686667 0.037516853 -0.52393526
#> 197: 0.4230001 0.4723104 0.150209032 0.07513333 0.137152296 0.09235428
#> 198: 0.8008496 0.8915995 0.096729600 -0.78626667 0.146270629 -0.74430401
#> 199: 0.5882195 0.6900581 0.027440547 0.08603333 0.024485958 0.09662172
#> 200: 1.1148134 1.3059605 0.016239553 -0.76026667 0.026434030 -0.73401896
#> x_0 h r2 p_value rss x_sd_avg
#> <num> <num> <num> <num> <num> <num>
#> 1: 1 1.827031 0.9924695 3.705769e-08 0.002778822 0.02424423
#> 2: 1 1.911901 0.9884406 1.660656e-07 0.004530345 0.03203268
#> 3: 1 2.349599 0.9958511 4.600131e-09 0.002182340 0.02195104
#> 4: 1 2.270093 0.9905292 8.267143e-08 0.005670066 0.03075240
#> 5: 1 3.159939 0.9918874 4.809026e-08 0.001162341 0.02315049
#> ---
#> 196: 1 1.970723 0.9955609 5.828304e-09 0.017400921 0.04602459
#> 197: 1 2.245643 0.9988156 5.718652e-11 0.001842420 0.03151223
#> 198: 1 2.204685 0.9985705 1.104466e-10 0.008161064 0.06333498
#> 199: 1 1.884916 0.9986615 8.773134e-11 0.001844621 0.03335063
#> 200: 1 1.854308 0.9987249 7.403286e-11 0.006484241 0.07007818
#> fit_type maxlog10Concentration N_conc normalization_type
#> <char> <num> <int> <char>
#> 1: DRC3pHillFitModelFixS0 1 9 RV
#> 2: DRC3pHillFitModelFixS0 1 9 GR
#> 3: DRC3pHillFitModelFixS0 1 9 RV
#> 4: DRC3pHillFitModelFixS0 1 9 GR
#> 5: DRC3pHillFitModelFixS0 1 9 RV
#> ---
#> 196: DRC3pHillFitModelFixS0 1 9 GR
#> 197: DRC3pHillFitModelFixS0 1 9 RV
#> 198: DRC3pHillFitModelFixS0 1 9 GR
#> 199: DRC3pHillFitModelFixS0 1 9 RV
#> 200: DRC3pHillFitModelFixS0 1 9 GR
#> fit_source Gnumber DrugName drug_moa Duration clid CellLineName
#> <char> <char> <char> <char> <num> <char> <char>
#> 1: gDR G00002 drug_002 moa_A 72 CL00011 cellline_BA
#> 2: gDR G00002 drug_002 moa_A 72 CL00011 cellline_BA
#> 3: gDR G00003 drug_003 moa_A 72 CL00011 cellline_BA
#> 4: gDR G00003 drug_003 moa_A 72 CL00011 cellline_BA
#> 5: gDR G00004 drug_004 moa_A 72 CL00011 cellline_BA
#> ---
#> 196: gDR G00009 drug_009 moa_A 72 CL00020 cellline_KB
#> 197: gDR G00010 drug_010 moa_A 72 CL00020 cellline_KB
#> 198: gDR G00010 drug_010 moa_A 72 CL00020 cellline_KB
#> 199: gDR G00011 drug_011 moa_B 72 CL00020 cellline_KB
#> 200: gDR G00011 drug_011 moa_B 72 CL00020 cellline_KB
#> Tissue ReferenceDivisionTime
#> <char> <num>
#> 1: tissue_x 26
#> 2: tissue_x 26
#> 3: tissue_x 26
#> 4: tissue_x 26
#> 5: tissue_x 26
#> ---
#> 196: tissue_z 62
#> 197: tissue_z 62
#> 198: tissue_z 62
#> 199: tissue_z 62
#> 200: tissue_z 62