waldronlab / MultiAssayExperiment

Bioconductor package for management of multi-assay data
https://waldronlab.io/MultiAssayExperiment/
69 stars 32 forks source link

extend `longFormat` with to include rowData #284

Closed lgatto closed 3 years ago

lgatto commented 3 years ago

There is currently a PR in QFeatures that extends longFormat to support the addition of rowData. The variable below, feat2 is a subclass of MultiAssayExperiment.

> feat2
An instance of class QFeatures containing 3 assays:
 [1] assay1: SummarizedExperiment with 10 rows and 4 columns 
 [2] assay2: SummarizedExperiment with 4 rows and 4 columns 
 [3] assay3: SummarizedExperiment with 7 rows and 4 columns 

Default behaviour:

> longFormat(feat2)
DataFrame with 84 rows and 5 columns
          assay     primary     rowname     colname     value
    <character> <character> <character> <character> <numeric>
1        assay1          S1           a          S1         1
2        assay1          S1           b          S1         2
3        assay1          S1           c          S1         3
4        assay1          S1           d          S1         4
5        assay1          S1           e          S1         5
...         ...         ...         ...         ...       ...
80       assay3         S12           j         S12        24
81       assay3         S12           k         S12        25
82       assay3         S12           l         S12        26
83       assay3         S12           m         S12        27
84       assay3         S12           n         S12        28

Including some colData:

> longFormat(feat2, colDataCols = "X")
DataFrame with 84 rows and 6 columns
          assay     primary     rowname     colname     value         X
    <character> <character> <character> <character> <numeric> <integer>
1        assay1          S1           a          S1         1         1
2        assay1          S1           b          S1         2         1
3        assay1          S1           c          S1         3         1
4        assay1          S1           d          S1         4         1
5        assay1          S1           e          S1         5         1
...         ...         ...         ...         ...       ...       ...
80       assay3         S12           j         S12        24        12
81       assay3         S12           k         S12        25        12
82       assay3         S12           l         S12        26        12
83       assay3         S12           m         S12        27        12
84       assay3         S12           n         S12        28        12

Including some rowData:

> longFormat(feat2, colDataCols = "X", rowDataCols = "Prot")
DataFrame with 84 rows and 7 columns
          assay     primary     rowname     colname     value         X
    <character> <character> <character> <character> <numeric> <integer>
1        assay1          S1           a          S1         1         1
2        assay1          S1           b          S1         2         1
3        assay1          S1           c          S1         3         1
4        assay1          S1           d          S1         4         1
5        assay1          S1           e          S1         5         1
...         ...         ...         ...         ...       ...       ...
80       assay3         S12           j         S12        24        12
81       assay3         S12           k         S12        25        12
82       assay3         S12           l         S12        26        12
83       assay3         S12           m         S12        27        12
84       assay3         S12           n         S12        28        12
           Prot
    <character>
1            Pa
2            Pb
3            Pc
4            Pd
5            Pe
...         ...
80           Pj
81           Pk
82           Pl
83           Pm
84           Pn

Is this of interest, and would you consider a PR to MultiAssayExperiment?

cc @cvanderaa

LiNk-NY commented 3 years ago

Hi Laurent, @lgatto These manipulation functions support MultiAssayExperiment-level structures such as colData(). rowData support would require a rowData interface for MultiAssayExperiment which currently does not exist. The assumption in the PR requires that all experiments support rowData which makes it less flexible for MultiAssayExperiment. Future iterations of MultiAssayExperiment may support a rowData slot but for the time being, support in a derivative that enforces those assumption works best. Thanks!

lgatto commented 3 years ago

Indeed, makes sense, thank you.