gene_associate: Apply gene expressions to reaction table

Description Usage Arguments Value Warning See Also Examples

View source: R/gene_associate.R

Description

A convenience function that uses gene_eval and a custom function to apply new upper and lower bounds.

Usage

1
2
3
4
5
6
gene_associate(
  reaction_table,
  gene_table,
  expression_flux_function = function(x) {     (1 + log(x)/stats::sd(x)^2)^sign(x - 1)
    }
)

Arguments

reaction_table

A data frame describing the metabolic model.

gene_table

A data frame showing gene presence

expression_flux_function

a function to convert from gene set expression to flux

Value

the reaction_table, with a new column, present, and altered upper and lower bounds

Warning

This function relies on gene_eval, which uses eval to evaluate gene expression sets. This gives flexibility, but means that malicious code in the gene_sets argument could get evaluated. gene_sets is evaluated in a restricted environment, but there might be a way around this, so you might want to check for anything suspicious in this argument manually. For more information, read the code.

See Also

gene_eval

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(iJO1366)
library(dplyr)

gene_table = tibble(name = iJO1366$geneAssociation %>%
stringr::str_split('and|or|\\s|\\(|\\)') %>%
  purrr::flatten_chr() %>%
  unique,
presence = 1) %>%
  filter(name != '', !is.na(name))

gene_associate(reaction_table = iJO1366 %>%
                 mutate(geneAssociation = geneAssociation %>%
                          stringr::str_replace_all('and', '&') %>%
                          stringr::str_replace_all('or', '|')
                 ),
               gene_table = gene_table
)

fbar documentation built on Sept. 2, 2020, 5:08 p.m.