This function recreates a `tidy_omic` object from the "data" and "design" attributes of this object.

reform_tidy_omic(tidy_data, tomic_design)

Arguments

tidy_data

A tibble containing measurements along with sample metadata. This table can be obtained as the "data" attribute from a romic "tidy_omic" object.

tomic_design

a list with named attributes describing feature, sample, and measurement variables.

Details

This is handy for passing data and metadata through approaches like parsnip which expect data to be formatted as a data.frame

Examples

tidy_data <- romic::brauer_2008_tidy$data
reform_tidy_omic(tidy_data, romic::brauer_2008_tidy$design)
#> $data
#> # A tibble: 18,000 × 8
#>    name    BP             MF    systematic_name sample nutrient    DR expression
#>    <chr>   <chr>          <chr> <chr>           <chr>  <chr>    <dbl>      <dbl>
#>  1 YOL029C biological pr… mole… YOL029C         G0.05  G         0.05      -0.22
#>  2 SCW11   cytokinesis, … gluc… YGL028C         G0.05  G         0.05      -0.67
#>  3 YHR036W biological pr… mole… YHR036W         G0.05  G         0.05      -0.91
#>  4 BGL2    cell wall org… gluc… YGR282C         G0.05  G         0.05      -0.08
#>  5 ACT1    cell wall org… stru… YFL039C         G0.05  G         0.05      -0.04
#>  6 FKH1    pseudohyphal … tran… YIL131C         G0.05  G         0.05      -0.57
#>  7 HOC1    cell wall man… tran… YJR075W         G0.05  G         0.05      -0.42
#>  8 CSN12   adaptation to… mole… YJR084W         G0.05  G         0.05      -0.49
#>  9 YAL046C biological pr… mole… YAL046C         G0.05  G         0.05       0.05
#> 10 SLG1    cell wall org… tran… YOR008C         G0.05  G         0.05      -0.06
#> # ℹ 17,990 more rows
#> 
#> $design
#> $design$features
#> # A tibble: 4 × 2
#>   variable        type               
#>   <chr>           <chr>              
#> 1 name            feature_primary_key
#> 2 systematic_name character          
#> 3 BP              character          
#> 4 MF              character          
#> 
#> $design$samples
#> # A tibble: 3 × 2
#>   variable type              
#>   <chr>    <chr>             
#> 1 sample   sample_primary_key
#> 2 nutrient character         
#> 3 DR       numeric           
#> 
#> $design$measurements
#> # A tibble: 3 × 2
#>   variable   type               
#>   <chr>      <chr>              
#> 1 name       feature_primary_key
#> 2 sample     sample_primary_key 
#> 3 expression numeric            
#> 
#> $design$feature_pk
#> [1] "name"
#> 
#> $design$sample_pk
#> [1] "sample"
#> 
#> 
#> attr(,"class")
#> [1] "tidy_omic" "tomic"     "general"