Skip to contents

Coerce a LongTable into a data.table.

Currently only supports coercing to data.table or data.frame

Coerce a data.table with the proper configuration attributes back to a LongTable

Arguments

from

A LongTableDataMapper to coerce.

Value

The data in object, as the child-class TreatmentResponseExperiment.

A data.table with the data from a LongTable.

data.table containing the data from the LongTable, with the `longTableDataMapper' attribute containg the metadata needed to reverse the coercing operation.

LongTable object configured with the longTableDataMapper

data.table with long format of data in from

data.frame with long format of data in from.

SummarizedExperiment with each assay as a BumpyMatrix

A TREDataMapper object.

Examples

data(clevelandSmall_cSet)
TRE <- as(treatmentResponse(clevelandSmall_cSet),
    "TreatmentResponseExperiment")
TRE
#> <TreatmentResponseExperiment> 
#>    dim:  9 10 
#>    assays(2): sensitivity profiles 
#>    rownames(9): radiation:1:1 radiation:1:2 ... radiation:8:1 radiation:10:1 
#>    rowData(3): treatment1id treatment1dose replicate_id 
#>    colnames(10): CHP-212 IMR-32 KP-N-S19s ... SK-N-SH SNU-245 SNU-869 
#>    colData(2): sampleid rn 
#>    metadata(1): experiment_metadata 

as(merckLongTable, 'data.table')
#>               combination_name      drug1id    drug2id drug1dose drug2dose
#>                         <char>       <char>     <char>     <num>     <num>
#>    1:        5-FU & Bortezomib         5-FU Bortezomib    0.3500   0.00045
#>    2:        5-FU & Bortezomib         5-FU Bortezomib    0.3500   0.00045
#>    3:        5-FU & Bortezomib         5-FU Bortezomib    0.3500   0.00045
#>    4:        5-FU & Bortezomib         5-FU Bortezomib    0.3500   0.00045
#>    5:        5-FU & Bortezomib         5-FU Bortezomib    0.3500   0.00045
#>   ---                                                                     
#> 3796: geldanamycin & Topotecan geldanamycin  Topotecan    0.0223   0.07750
#> 3797: geldanamycin & Topotecan geldanamycin  Topotecan    0.0223   0.07750
#> 3798: geldanamycin & Topotecan geldanamycin  Topotecan    0.0223   0.07750
#> 3799: geldanamycin & Topotecan geldanamycin  Topotecan    0.0223   0.07750
#> 3800: geldanamycin & Topotecan geldanamycin  Topotecan    0.0223   0.07750
#>       sampleid batchid viability1 viability2 viability3 viability4
#>         <char>   <int>      <num>      <num>      <num>      <num>
#>    1:    A2058       1      0.814      0.754      0.765      0.849
#>    2:    A2780       1      0.214      0.195      0.186      0.223
#>    3:     A375       1      1.064      1.080      1.082      1.009
#>    4:     A427       1      0.675      0.582      0.482      0.516
#>    5:    CAOV3       1      0.845      0.799      0.799      0.759
#>   ---                                                             
#> 3796:    A2058       1      0.090      0.043      0.112      0.103
#> 3797:    A2780       1      0.025      0.022      0.029      0.023
#> 3798:     A375       1      0.151      0.146      0.144      0.171
#> 3799:     A427       1      0.142      0.166      0.124      0.175
#> 3800:    CAOV3       1      0.091      0.084      0.134      0.119
#>       mu/muMax_published X/X0_published
#>                    <num>          <num>
#>    1:              0.880          0.847
#>    2:              0.384          0.426
#>    3:              1.033          1.047
#>    4:              0.676          0.638
#>    5:              0.708          0.667
#>   ---                                  
#> 3796:             -0.187          0.193
#> 3797:             -0.445          0.135
#> 3798:              0.090          0.283
#> 3799:             -0.012          0.246
#> 3800:             -1.935          0.017

dataTable <- as(merckLongTable, 'data.table')
print(attr(dataTable, 'longTableDataMapper')) # Method doesn't work without this
#> <LongTableDataMapper> 
#> rawdata: NA 
#> rowDataMap:
#>   rowIDs: drug1id, drug2id, drug1dose, drug2dose
#>   rowMeta: combination_name
#> colDataMap:
#>   colIDs: sampleid, batchid
#>   colMeta: 
#> assayMap:
#>   sensitivity:
#>     keys: drug1id, drug2id, drug1dose, drug2dose, sampleid, batchid
#>     values: viability1, viability2, viability3, viability4
#>   profiles:
#>     keys: drug1id, drug2id, drug1dose, drug2dose, sampleid, batchid
#>     values: mu/muMax_published, X/X0_published
#> metadataMap: NA
as(dataTable, 'LongTable')
#> 2024-03-25 15:58:10 Building assay index...
#> 2024-03-25 15:58:10 Joining rowData to assayIndex...
#> 2024-03-25 15:58:11 Joining colData to assayIndex...
#> 2024-03-25 15:58:12 Joining assays to assayIndex...
#> 2024-03-25 15:58:13 Setting assayIndex key...
#> 2024-03-25 15:58:13 Building LongTable...
#> 
#> <LongTable> 
#>    dim:  744 12 
#>    assays(2): sensitivity profiles 
#>    rownames(744): 5-FU:Bortezomib:0.35:0.00045 5-FU:Bortezomib:0.35:0.002 ... geldanamycin:Topotecan:0.0223:0.0223 geldanamycin:Topotecan:0.0223:0.0775 
#>    rowData(5): drug1id drug2id drug1dose drug2dose combination_name 
#>    colnames(12): A2058:1 A2058:3 A2780:1 ... CAOV3:1 CAOV3:2 CAOV3:3 
#>    colData(2): sampleid batchid 
#>    metadata(0): none 

SE <- molecularProfilesSlot(clevelandSmall_cSet)[[1]]
as(SE, 'data.table')
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Dropped S4 metadata during coercion to data.table!
#> Key: <.feature>
#>              .feature                                           .sample
#>                <char>                                            <char>
#>    1: ENSG00000000003       BUNDS_P_NCLE_RNA5_HG-U133_PLUS_2_B11_419860
#>    2: ENSG00000000003       BUNDS_P_NCLE_RNA5_HG-U133_PLUS_2_F07_419790
#>    3: ENSG00000000003       CASED_P_NCLE_RNA4_HG-U133_PLUS_2_G02_383638
#>    4: ENSG00000000003       CASED_P_NCLE_RNA4_HG-U133_PLUS_2_G03_383634
#>    5: ENSG00000000003 GILDS_P_NCLE_RNA11_REDO_HG-U133_PLUS_2_C05_587588
#>   ---                                                                  
#> 8996: ENSG00000068394 GILDS_P_NCLE_RNA11_REDO_HG-U133_PLUS_2_C05_587588
#> 8997: ENSG00000068394 GILDS_P_NCLE_RNA11_REDO_HG-U133_PLUS_2_G02_587654
#> 8998: ENSG00000068394       NIECE_P_NCLE_RNA3_HG-U133_PLUS_2_G10_296152
#> 8999: ENSG00000068394       SILOS_P_NCLE_RNA9_HG-U133_PLUS_2_A04_523474
#> 9000: ENSG00000068394       WATCH_P_NCLE_RNA8_HG-U133_PLUS_2_B04_474582
#>           exprs se.exprs                                        samplename
#>           <num>   <lgcl>                                            <char>
#>    1:  9.596987       NA       BUNDS_p_NCLE_RNA5_HG-U133_Plus_2_B11_419860
#>    2:  9.924551       NA       BUNDS_p_NCLE_RNA5_HG-U133_Plus_2_F07_419790
#>    3:  4.878338       NA       CASED_p_NCLE_RNA4_HG-U133_Plus_2_G02_383638
#>    4:  4.865308       NA       CASED_p_NCLE_RNA4_HG-U133_Plus_2_G03_383634
#>    5: 11.459240       NA GILDS_p_NCLE_RNA11_Redo_HG-U133_Plus_2_C05_587588
#>   ---                                                                     
#> 8996:  8.119580       NA GILDS_p_NCLE_RNA11_Redo_HG-U133_Plus_2_C05_587588
#> 8997:  8.683403       NA GILDS_p_NCLE_RNA11_Redo_HG-U133_Plus_2_G02_587654
#> 8998:  8.507980       NA       NIECE_p_NCLE_RNA3_HG-U133_Plus_2_G10_296152
#> 8999:  8.810289       NA       SILOS_p_NCLE_RNA9_HG-U133_Plus_2_A04_523474
#> 9000:  9.256034       NA       WATCH_p_NCLE_RNA8_HG-U133_Plus_2_B04_474582
#>                                                       filename       chiptype
#>                                                         <char>         <char>
#>    1:       BUNDS_p_NCLE_RNA5_HG-U133_Plus_2_B11_419860.CEL.gz HG-U133_Plus_2
#>    2:       BUNDS_p_NCLE_RNA5_HG-U133_Plus_2_F07_419790.CEL.gz HG-U133_Plus_2
#>    3:       CASED_p_NCLE_RNA4_HG-U133_Plus_2_G02_383638.CEL.gz HG-U133_Plus_2
#>    4:       CASED_p_NCLE_RNA4_HG-U133_Plus_2_G03_383634.CEL.gz HG-U133_Plus_2
#>    5: GILDS_p_NCLE_RNA11_Redo_HG-U133_Plus_2_C05_587588.CEL.gz HG-U133_Plus_2
#>   ---                                                                        
#> 8996: GILDS_p_NCLE_RNA11_Redo_HG-U133_Plus_2_C05_587588.CEL.gz HG-U133_Plus_2
#> 8997: GILDS_p_NCLE_RNA11_Redo_HG-U133_Plus_2_G02_587654.CEL.gz HG-U133_Plus_2
#> 8998:       NIECE_p_NCLE_RNA3_HG-U133_Plus_2_G10_296152.CEL.gz HG-U133_Plus_2
#> 8999:       SILOS_p_NCLE_RNA9_HG-U133_Plus_2_A04_523474.CEL.gz HG-U133_Plus_2
#> 9000:       WATCH_p_NCLE_RNA8_HG-U133_Plus_2_B04_474582.CEL.gz HG-U133_Plus_2
#>       hybridization.date hybridization.hour   file.day file.hour  batch
#>                   <char>             <char>     <char>    <char> <lgcl>
#>    1:           12/19/08           11:43:19 2009-01-07  13:06:03     NA
#>    2:           12/19/08           11:30:25 2009-01-07  13:05:45     NA
#>    3:           10/29/08           08:04:03 2008-11-04  14:19:49     NA
#>    4:           10/29/08           07:52:47 2008-11-04  14:19:49     NA
#>    5:         2010-05-21          17:07:46Z 2010-05-26  16:35:08     NA
#>   ---                                                                  
#> 8996:         2010-05-21          17:07:46Z 2010-05-26  16:35:08     NA
#> 8997:         2010-05-21          16:45:06Z 2010-05-26  16:35:21     NA
#> 8998:           07/15/08           12:54:10 2008-07-24  14:23:47     NA
#> 8999:         2009-12-08          20:44:59Z 2009-12-11  14:20:50     NA
#> 9000:         2009-08-14          17:15:45Z 2009-08-19  16:16:45     NA
#>        sampleid                 CCLE.name Cell.line.primary.name
#>          <char>                    <char>                 <char>
#>    1: KP-N-S19s KPNSI9S_AUTONOMIC_GANGLIA              KP-N-SI9s
#>    2:   SK-N-SH   SKNSH_AUTONOMIC_GANGLIA                SK-N-SH
#>    3:   SK-N-FI   SKNFI_AUTONOMIC_GANGLIA                SK-N-FI
#>    4:   SK-N-AS   SKNAS_AUTONOMIC_GANGLIA                SK-N-AS
#>    5:   SNU-245      SNU245_BILIARY_TRACT                SNU-245
#>   ---                                                           
#> 8996:   SNU-245      SNU245_BILIARY_TRACT                SNU-245
#> 8997:    IMR-32   IMR32_AUTONOMIC_GANGLIA                 IMR-32
#> 8998:   CHP-212  CHP212_AUTONOMIC_GANGLIA                CHP-212
#> 8999: MHH-NB-11 MHHNB11_AUTONOMIC_GANGLIA              MHH-NB-11
#> 9000:       NB1     NB1_AUTONOMIC_GANGLIA                   NB-1
#>       Cell.line.aliases Gender      Site.Primary     Histology Hist.Subtype1
#>                  <char> <char>            <char>        <char>        <char>
#>    1:         KP-N-S19s      M autonomic_ganglia neuroblastoma            NS
#>    2:              <NA>      F autonomic_ganglia neuroblastoma            NS
#>    3:           SK-N-F1      M autonomic_ganglia neuroblastoma            NS
#>    4:              <NA>      F autonomic_ganglia neuroblastoma            NS
#>    5:       NCI-SNU-245   <NA>     biliary_tract     carcinoma            NS
#>   ---                                                                       
#> 8996:       NCI-SNU-245   <NA>     biliary_tract     carcinoma            NS
#> 8997:              <NA>      M autonomic_ganglia neuroblastoma            NS
#> 8998:              <NA>   <NA> autonomic_ganglia neuroblastoma            NS
#> 8999:              <NA>      M autonomic_ganglia neuroblastoma            NS
#> 9000:              <NA>      M autonomic_ganglia neuroblastoma            NS
#>                                                                                       Notes
#>                                                                                      <char>
#>    1:                                                                                  <NA>
#>    2: Identical lines: SH-SY5Y is a subclone derived from SK-N-SH and is identical to LAN-5
#>    3:                                                                                  <NA>
#>    4:                                                                                  <NA>
#>    5:                                                                                  <NA>
#>   ---                                                                                      
#> 8996:                                                                                  <NA>
#> 8997:                                                                                  <NA>
#> 8998:                                                                                  <NA>
#> 8999:                                                                                  <NA>
#> 9000:                                                                                  <NA>
#>       Source                                 Expression.arrays
#>       <char>                                            <char>
#>    1:  HSRRB       BUNDS_p_NCLE_RNA5_HG-U133_Plus_2_B11_419860
#>    2:   ATCC       BUNDS_p_NCLE_RNA5_HG-U133_Plus_2_F07_419790
#>    3:   ATCC       CASED_p_NCLE_RNA4_HG-U133_Plus_2_G02_383638
#>    4:   ATCC       CASED_p_NCLE_RNA4_HG-U133_Plus_2_G03_383634
#>    5:   KCLB GILDS_p_NCLE_RNA11_Redo_HG-U133_Plus_2_C05_587588
#>   ---                                                         
#> 8996:   KCLB GILDS_p_NCLE_RNA11_Redo_HG-U133_Plus_2_C05_587588
#> 8997:   ATCC GILDS_p_NCLE_RNA11_Redo_HG-U133_Plus_2_G02_587654
#> 8998:   ATCC       NIECE_p_NCLE_RNA3_HG-U133_Plus_2_G10_296152
#> 8999:   DSMZ       SILOS_p_NCLE_RNA9_HG-U133_Plus_2_A04_523474
#> 9000:  HSRRB       WATCH_p_NCLE_RNA8_HG-U133_Plus_2_B04_474582
#>                                               SNP.arrays Oncomap
#>                                                   <char>  <char>
#>    1:  FIEFS_p_NCLE_DNA_Affy5_GenomeWideSNP_6_H05_410924     yes
#>    2:   BOWER_p_NCLE_DNAAffy8_GenomeWideSNP_6_B02_464602     yes
#>    3:  FIEFS_p_NCLE_DNA_Affy5_GenomeWideSNP_6_F10_410970     yes
#>    4:  FIEFS_p_NCLE_DNA_Affy5_GenomeWideSNP_6_C08_411042     yes
#>    5:  QUAFF_p_NCLE_DNAAffy12_GenomeWideSNP_6_C12_592634     yes
#>   ---                                                           
#> 8996:  QUAFF_p_NCLE_DNAAffy12_GenomeWideSNP_6_C12_592634     yes
#> 8997:   LOBBY_p_NCLE_DNAAffy6_GenomeWideSNP_6_C01_437320     yes
#> 8998: FASTS_p_NCLE_DNAAffy4_S_GenomeWideSNP_6_D02_335262     yes
#> 8999:  AWASH_p_NCLE_DNAAffy10_GenomeWideSNP_6_H08_542886     yes
#> 9000:  AWASH_p_NCLE_DNAAffy10_GenomeWideSNP_6_F10_542910     yes
#>       Hybrid.Capture.Sequencing batchid
#>                          <char>  <lgcl>
#>    1:                       yes      NA
#>    2:                       yes      NA
#>    3:                       yes      NA
#>    4:                       yes      NA
#>    5:                       yes      NA
#>   ---                                  
#> 8996:                       yes      NA
#> 8997:                       yes      NA
#> 8998:                       yes      NA
#> 8999:                       yes      NA
#> 9000:                       yes      NA
#>                                              rownames.x              Probe
#>                                                  <char>             <char>
#>    1:       BUNDS_P_NCLE_RNA5_HG-U133_PLUS_2_B11_419860 ENSG00000000003_at
#>    2:       BUNDS_P_NCLE_RNA5_HG-U133_PLUS_2_F07_419790 ENSG00000000003_at
#>    3:       CASED_P_NCLE_RNA4_HG-U133_PLUS_2_G02_383638 ENSG00000000003_at
#>    4:       CASED_P_NCLE_RNA4_HG-U133_PLUS_2_G03_383634 ENSG00000000003_at
#>    5: GILDS_P_NCLE_RNA11_REDO_HG-U133_PLUS_2_C05_587588 ENSG00000000003_at
#>   ---                                                                     
#> 8996: GILDS_P_NCLE_RNA11_REDO_HG-U133_PLUS_2_C05_587588 ENSG00000068394_at
#> 8997: GILDS_P_NCLE_RNA11_REDO_HG-U133_PLUS_2_G02_587654 ENSG00000068394_at
#> 8998:       NIECE_P_NCLE_RNA3_HG-U133_PLUS_2_G10_296152 ENSG00000068394_at
#> 8999:       SILOS_P_NCLE_RNA9_HG-U133_PLUS_2_A04_523474 ENSG00000068394_at
#> 9000:       WATCH_P_NCLE_RNA8_HG-U133_PLUS_2_B04_474582 ENSG00000068394_at
#>         EnsemblGeneId EntrezGeneId Symbol    GeneBioType   BEST      rownames.y
#>                <char>        <int> <char>         <char> <lgcl>          <char>
#>    1: ENSG00000000003         7105 TSPAN6 protein_coding   TRUE ENSG00000000003
#>    2: ENSG00000000003         7105 TSPAN6 protein_coding   TRUE ENSG00000000003
#>    3: ENSG00000000003         7105 TSPAN6 protein_coding   TRUE ENSG00000000003
#>    4: ENSG00000000003         7105 TSPAN6 protein_coding   TRUE ENSG00000000003
#>    5: ENSG00000000003         7105 TSPAN6 protein_coding   TRUE ENSG00000000003
#>   ---                                                                          
#> 8996: ENSG00000068394        27238  GPKOW protein_coding   TRUE ENSG00000068394
#> 8997: ENSG00000068394        27238  GPKOW protein_coding   TRUE ENSG00000068394
#> 8998: ENSG00000068394        27238  GPKOW protein_coding   TRUE ENSG00000068394
#> 8999: ENSG00000068394        27238  GPKOW protein_coding   TRUE ENSG00000068394
#> 9000: ENSG00000068394        27238  GPKOW protein_coding   TRUE ENSG00000068394
#>            rownames.1
#>                <char>
#>    1: ENSG00000000003
#>    2: ENSG00000000003
#>    3: ENSG00000000003
#>    4: ENSG00000000003
#>    5: ENSG00000000003
#>   ---                
#> 8996: ENSG00000068394
#> 8997: ENSG00000068394
#> 8998: ENSG00000068394
#> 8999: ENSG00000068394
#> 9000: ENSG00000068394

SE <- molecularProfilesSlot(clevelandSmall_cSet)[[1]]
as(SE, 'data.frame')
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Dropped S4 metadata during coercion to data.table!