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 YOL029C biol… mole… YOL029C G0.1 G -0.18 foo
#> 3 YOL029C biol… mole… YOL029C G0.15 G 0.27 foo
#> 4 YOL029C biol… mole… YOL029C G0.2 G 0.18 foo
#> 5 YOL029C biol… mole… YOL029C G0.25 G 0.03 foo
#> 6 YOL029C biol… mole… YOL029C G0.3 G -0.04 foo
#> 7 YOL029C biol… mole… YOL029C N0.05 N 0.26 foo
#> 8 YOL029C biol… mole… YOL029C N0.1 N 0.15 foo
#> 9 YOL029C biol… mole… YOL029C N0.15 N 0.04 foo
#> 10 YOL029C biol… mole… YOL029C N0.2 N -0.07 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"