tests/testthat/test-codon_diff.R

test_that("differential testing are correct", {
    x <- paste0(rep(c('TTT', 'TTC'), c(10, 20)))
    y <- paste0(rep(c('TTT', 'TTC'), c(20, 10)))

    cudiff <- codon_diff(x, y)
    cudiff <- cudiff[codon %in% c('TTT', 'TTC')]

    f <- fisher.test(rbind(c(10, 20), c(20, 10)))

    expect_true(all(cudiff$global_p == f$p.value))
    expect_true(all(cudiff$fam_p == f$p.value))
    expect_true(all(cudiff$subfam_p == f$p.value))

})

Try the cubar package in your browser

Any scripts or data that you put into this service are public.

cubar documentation built on April 3, 2025, 8:58 p.m.