Update a Tidy 'Omics data and schema to reflect newly added fields.
update_tidy_omic(tidy_omic, updated_tidy_data, new_variable_tables = c())an object of class tidy_omic produced by
create_tidy_omic
a tibble of data to use to update tidy_omic.
a named character vector of newly added variables
in updated_tidy_data (names) and the table {features, samples,
measurements} they apply to (values).
a tidy_omic object with an updated schema and/or data.
library(dplyr)
tidy_omic <- brauer_2008_tidy
updated_tidy_data <- tidy_omic$data %>%
mutate(new_sample_var = "foo") %>%
select(-DR)
new_variable_tables <- c("new_sample_var" = "samples")
update_tidy_omic(tidy_omic, updated_tidy_data, new_variable_tables)
#> $data
#> # A tibble: 18,000 × 8
#> name BP MF systematic_name sample nutrient expression new_sample_var
#> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <chr>
#> 1 YOL029C biol… mole… YOL029C G0.05 G -0.22 foo
#> 2 SCW11 cyto… gluc… YGL028C G0.05 G -0.67 foo
#> 3 YHR036W biol… mole… YHR036W G0.05 G -0.91 foo
#> 4 BGL2 cell… gluc… YGR282C G0.05 G -0.08 foo
#> 5 ACT1 cell… stru… YFL039C G0.05 G -0.04 foo
#> 6 FKH1 pseu… tran… YIL131C G0.05 G -0.57 foo
#> 7 HOC1 cell… tran… YJR075W G0.05 G -0.42 foo
#> 8 CSN12 adap… mole… YJR084W G0.05 G -0.49 foo
#> 9 YAL046C biol… mole… YAL046C G0.05 G 0.05 foo
#> 10 SLG1 cell… tran… YOR008C G0.05 G -0.06 foo
#> # ℹ 17,990 more rows
#>
#> $design
#> $design$features
#> # A tibble: 4 × 3
#> variable type table
#> <chr> <chr> <chr>
#> 1 name feature_primary_key features
#> 2 systematic_name character features
#> 3 BP character features
#> 4 MF character features
#>
#> $design$samples
#> # A tibble: 3 × 3
#> variable type table
#> <chr> <chr> <chr>
#> 1 sample sample_primary_key samples
#> 2 nutrient character samples
#> 3 new_sample_var character samples
#>
#> $design$measurements
#> # A tibble: 3 × 3
#> variable type table
#> <chr> <chr> <chr>
#> 1 name feature_primary_key measurements
#> 2 sample sample_primary_key measurements
#> 3 expression numeric measurements
#>
#> $design$feature_pk
#> [1] "name"
#>
#> $design$sample_pk
#> [1] "sample"
#>
#>
#> attr(,"class")
#> [1] "tidy_omic" "tomic" "general"