tests/testthat/test_ZicoSeq.R

library(testthat)
library(ZicoSeq)
library(GUniFrac)
context('Just test ZicoSeq function')
test_that('Checking ZicoSeq Results',{
  data("throat.otu.tab")
  data("throat.meta")
  set.seed(123)
  comm <- t(throat.otu.tab)
  meta.dat <- throat.meta
  zico.obj <- ZicoSeq(meta.dat = meta.dat, comm = comm, grp.name = 'SmokingStatus', adj.name = 'Sex',
                      # Filtering criterion
                      prev.filter = 0.1, abund.filter = 10,  min.prop = 0,
                      # Winsorization to replace outliers
                      is.winsor = TRUE, winsor.qt = 0.97,
                      # Posterior sampling
                      is.prior = TRUE, prior.dist = c('BetaMix'), post.method = c('sample'), post.sample.no = 25,
                      # Link functions
                      link.func = list(function (x) x^0.25, function (x) x^0.5, function (x) x^0.75), stats.combine.func = max,
                      # Permutation
                      perm.no = 99,  strata = NULL,
                      # Multiple stage normalization
                      stage.no = 6, topK = NULL, stage.fdr = 0.75, stage.max.pct = 0.50,
                      # Tree-based FDR control and family-wise error rate control
                      is.fwer = FALSE, is.tree.fdr = FALSE, tree = NULL,
                      verbose = TRUE, return.comm = FALSE, return.perm.F = FALSE)
  output <- which(zico.obj$p.adj.fdr <= 0.1)
  expect(output,c(`3227` = 7L, `5496` = 65L, `2300` = 92L, `2831` = 96L, `2434` = 99L,
                       `2893` = 101L, `1280` = 106L, `4363` = 115L, `1490` = 126L, `411` = 127L,
                       `4703` = 131L, `3954` = 150L, `3538` = 176L))
})
chloelulu/ZicoSeq documentation built on Nov. 4, 2019, 8:50 a.m.