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 YOL029C biological pr… mole… YOL029C         G0.1   G         0.1       -0.18
#>  3 YOL029C biological pr… mole… YOL029C         G0.15  G         0.15       0.27
#>  4 YOL029C biological pr… mole… YOL029C         G0.2   G         0.2        0.18
#>  5 YOL029C biological pr… mole… YOL029C         G0.25  G         0.25       0.03
#>  6 YOL029C biological pr… mole… YOL029C         G0.3   G         0.3       -0.04
#>  7 YOL029C biological pr… mole… YOL029C         N0.05  N         0.05       0.26
#>  8 YOL029C biological pr… mole… YOL029C         N0.1   N         0.1        0.15
#>  9 YOL029C biological pr… mole… YOL029C         N0.15  N         0.15       0.04
#> 10 YOL029C biological pr… mole… YOL029C         N0.2   N         0.2       -0.07
#> # ℹ 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"