runFishers

runFishers(
  matrix_path,
  Q = 0.05,
  alternative = "two.sided",
  susceptible_label = "Susceptible",
  resistant_label = "Resistant"
)

Arguments

matrix_path

Path to the long sparse Parquet matrices

Q

FDR cutoff for Benjamini Hochberg correction (default = 0.05)

alternative

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

susceptible_label

"Susceptible" phenotype label in the data

resistant_label

"Resistant" phenotype label in the data

Value

The Fisher test results, BH correction, and feature frequencies

Examples

long <- tibble::tibble(
  genome_id = rep(paste0("g", 1:10), each = 2),
  feature_id = rep(c("gene_a", "gene_b"), 10),
  value = c(
    1, 0, 1, 0, 1, 1, 1, 1, 0, 1,
    0, 0, 0, 1, 0, 1, 0, 1, 0, 0
  ),
  genome_drug.resistant_phenotype = rep(
    rep(c("Resistant", "Susceptible"), each = 5),
    each = 2
  )
)
tmp <- tempfile(fileext = ".parquet")
arrow::write_parquet(long, tmp)
runFishers(tmp, Q = 0.05)
#> # A tibble: 2 × 8
#>   gene   p_value adj_p_value sig_after_bh alternative     Q
#>   <chr>    <dbl>       <dbl> <lgl>        <chr>       <dbl>
#> 1 gene_a  0.0476      0.0952 FALSE        two.sided    0.05
#> 2 gene_b  1           1      FALSE        two.sided    0.05
#> # ℹ 2 more variables: freq_susceptible_gene_pres <dbl>,
#> #   freq_resistant_gene_pres <dbl>