Decompose a metabolite table into the metabolite stub itself and the compartment it is in

decompose_metabolites(
  met_table,
  compartment_regex = "(\\[[a-zA-Z0-9]+]$)|(_[a-zA-Z]$)"
)

Arguments

met_table

A metabolite table, with one column, met

compartment_regex

Regular expression to identify compartments in model

Value

a metabolite table with the columns chemical and compartment

Examples

data(ecoli_core) mod <- reactiontbl_to_expanded(ecoli_core) decompose_metabolites(mod$mets)
#> # A tibble: 72 x 2 #> chemical compartment #> <chr> <chr> #> 1 13dpg c #> 2 2pg c #> 3 3pg c #> 4 6pgc c #> 5 6pgl c #> 6 ac c #> 7 ac e #> 8 acald c #> 9 acald e #> 10 accoa c #> # … with 62 more rows
recompose_metabolites(decompose_metabolites(mod$mets))
#> # A tibble: 72 x 1 #> met #> <chr> #> 1 13dpg_c #> 2 2pg_c #> 3 3pg_c #> 4 6pgc_c #> 5 6pgl_c #> 6 ac_c #> 7 ac_e #> 8 acald_c #> 9 acald_e #> 10 accoa_c #> # … with 62 more rows