runFisherTests

runFisherTests(df, target, alternative = "two.sided")

Arguments

df

Binary feature columns and a binary target column

target

The above-mentioned binarized vector of AMR phenotypes

alternative

Type of Fisher test: "two.sided", "greater", or "less"

Value

A tibble with columns: gene, p_value

Examples

df <- tibble::tibble(
  genome_id = paste0("g", 1:10),
  genome_drug.resistant_phenotype = rep(c("Resistant", "Susceptible"), each = 5),
  gene_a = c(1, 1, 1, 1, 0, 0, 0, 0, 0, 0),
  gene_b = c(0, 0, 0, 1, 1, 1, 1, 1, 1, 0)
)
encoded <- encodePhenotype(df)
runFisherTests(encoded$df, encoded$target)
#> # A tibble: 2 × 3
#>   gene   p_value alternative
#>   <chr>    <dbl> <chr>      
#> 1 gene_a  0.0476 two.sided  
#> 2 gene_b  0.524  two.sided