Running ‘testthat.R’ [611s/553s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # Work-around for bug (https://github.com/hadley/testthat/issues/144)
  > Sys.setenv("R_TESTS" = "")
  > 
  > # library 
  > library(testthat)
  > library(HTSSIP)
  > 
  > # test check
  > test_check('HTSSIP')
  Sparsity threshold: 0.25 
  Density window: 1.71-1.75 
  1. Error: DESeq2_l2fc runs with default params (@test-DESeq2_l2fc.R#2) ---------
  assignment of an object of class "NULL" is not valid for slot 'NAMES' in an object of class "DESeqDataSet"; is(value, "characterORNULL") is not TRUE
  1: DESeq2_l2fc(physeq_S2D2_l[[1]], sparsity_threshold = 0.25, density_min = 1.71, density_max = 1.75, 
         design = ~Substrate) at testthat/test-DESeq2_l2fc.R:2
  2: phyloseq::phyloseq_to_deseq2(physeq, design)
  3: DESeq2::DESeqDataSetFromMatrix(countData, colData, design, ...)
  4: DESeqDataSet(se, design = design, ignoreRank)
  5: new("DESeqDataSet", se, design = design)
  6: initialize(value, ...)
  7: initialize(value, ...)
  8: `as<-`(`*tmp*`, Classi, value = obj)
  9: asMethod(object, Class, value)
  10: `slot<-`(`*tmp*`, what, value = NULL)
  11: checkSlotAssignment(object, name, value)
  12: stop(gettextf("assignment of an object of class %s is not valid for slot %s in an object of class %s; is(value, \"%s\") is not TRUE", 
         dQuote(valueClass), sQuote(name), dQuote(cl), slotClass), domain = NA)
  
  Sparsity threshold: 0.25 
  Density window: 1.71-1.75 
  2. Error: DESeq2_l2fc runs with sparsity_apply=heavy (@test-DESeq2_l2fc.R#15) --
  assignment of an object of class "NULL" is not valid for slot 'NAMES' in an object of class "DESeqDataSet"; is(value, "characterORNULL") is not TRUE
  1: DESeq2_l2fc(physeq_S2D2_l[[1]], sparsity_threshold = 0.25, density_min = 1.71, density_max = 1.75, 
         design = ~Substrate, sparsity_apply = "heavy") at testthat/test-DESeq2_l2fc.R:15
  2: phyloseq::phyloseq_to_deseq2(physeq, design)
  3: DESeq2::DESeqDataSetFromMatrix(countData, colData, design, ...)
  4: DESeqDataSet(se, design = design, ignoreRank)
  5: new("DESeqDataSet", se, design = design)
  6: initialize(value, ...)
  7: initialize(value, ...)
  8: `as<-`(`*tmp*`, Classi, value = obj)
  9: asMethod(object, Class, value)
  10: `slot<-`(`*tmp*`, what, value = slot(value, what))
  11: checkSlotAssignment(object, name, value)
  12: stop(gettextf("assignment of an object of class %s is not valid for slot %s in an object of class %s; is(value, \"%s\") is not TRUE", 
         dQuote(valueClass), sQuote(name), dQuote(cl), slotClass), domain = NA)
  
  Sparsity threshold: 0 
  Density window: 1.7-1.75 
  3. Error: HRSIP runs with default (@test-HRSIP.R#3) ----------------------------
  assignment of an object of class "NULL" is not valid for slot 'NAMES' in an object of class "DESeqDataSet"; is(value, "characterORNULL") is not TRUE
  1: HRSIP(physeq_S2D2_l[[1]], sparsity_threshold = c(0, 0.15, 0.3), design = ~Substrate) at testthat/test-HRSIP.R:3
  2: plyr::mdply(m, DESeq2_l2fc, physeq = physeq, design = design, l2fc_threshold = l2fc_threshold, 
         sparsity_apply = sparsity_apply, .parallel = parallel)
  3: adply(.data = .data, .margins = 1, .fun = f, ..., .expand = .expand, .progress = .progress, 
         .inform = .inform, .parallel = .parallel, .paropts = .paropts)
  4: ldply(.data = pieces, .fun = .fun, ..., .progress = .progress, .inform = .inform, 
         .parallel = .parallel, .paropts = .paropts, .id = .id)
  5: llply(.data = .data, .fun = .fun, ..., .progress = .progress, .inform = .inform, 
         .parallel = .parallel, .paropts = .paropts)
  6: loop_apply(n, do.ply)
  7: (function (i) 
     {
         piece <- pieces[[i]]
         if (.inform) {
             res <- try(.fun(piece, ...))
             if (inherits(res, "try-error")) {
                 piece <- paste(utils::capture.output(print(piece)), collapse = "\n")
                 stop("with piece ", i, ": \n", piece, call. = FALSE)
             }
         }
         else {
             res <- .fun(piece, ...)
         }
         progress$step()
         res
     })(1L)
  8: .fun(piece, ...)
  9: do.call(flat, c(args, list(...)))
  10: (function (physeq, density_min, density_max, design, l2fc_threshold = 0.25, sparsity_threshold = 0.25, 
         sparsity_apply = "all") 
     {
         l2fc_threshold = as.numeric(l2fc_threshold)
         stopifnot(l2fc_threshold >= 0 & l2fc_threshold <= 1)
         sparsity_apply = tolower(sparsity_apply)
         stopifnot(sparsity_apply %in% c("all", "heavy"))
         physeq.md = phyloseq::sample_data(physeq)
         stopifnot(!is.null(physeq.md$Buoyant_density))
         cat("Sparsity threshold:", sparsity_threshold, "\n")
         cat("Density window:", paste(c(density_min, density_max), collapse = "-"), "\n")
         prn = function(x) sum(x > 0) > sparsity_threshold * length(x)
         if (sparsity_apply == "all") {
             physeq = phyloseq::filter_taxa(physeq, prn, TRUE)
         }
         physeq = phyloseq::prune_samples((physeq.md$Buoyant_density >= density_min) & 
             (physeq.md$Buoyant_density <= density_max), physeq)
         physeq = phyloseq::filter_taxa(physeq, function(x) sum(x > 0) > 0 * length(x), 
             TRUE)
         if (sparsity_apply == "heavy") {
             physeq = phyloseq::filter_taxa(physeq, prn, TRUE)
         }
         dds = phyloseq::phyloseq_to_deseq2(physeq, design)
         dds = DESeq2::DESeq(dds, quiet = TRUE, fitType = "local")
         theta = l2fc_threshold
         res = DESeq2::results(dds, independentFiltering = FALSE)
         res$OTU = rownames(res)
         beta = res$log2FoldChange
         betaSE = res$lfcSE
         p = stats::pnorm(beta, theta, betaSE, lower.tail = FALSE)
         res$p = p
         d = data.frame(res[, c("OTU", "log2FoldChange", "p")])
         d$padj = stats::p.adjust(p, method = "BH")
         TT = phyloseq::tax_table(physeq)
         if (!is.null(TT)) {
             TT = as.data.frame(as.matrix(TT))
             TT$OTU = rownames(TT)
             d = dplyr::left_join(d, TT, c("OTU"))
         }
         d$density_min = density_min
         d$density_max = density_max
         d$sparsity_threshold = sparsity_threshold
         d$sparsity_apply = sparsity_apply
         d$l2fc_threshold = l2fc_threshold
         return(d)
     })(density_min = 1.7, density_max = 1.75, sparsity_threshold = 0, physeq = <S4 object of class structure("phyloseq", package = "phyloseq")>, 
         design = ~Substrate, l2fc_threshold = 0.25, sparsity_apply = "all")
  11: phyloseq::phyloseq_to_deseq2(physeq, design)
  12: DESeq2::DESeqDataSetFromMatrix(countData, colData, design, ...)
  13: DESeqDataSet(se, design = design, ignoreRank)
  14: new("DESeqDataSet", se, design = design)
  15: initialize(value, ...)
  16: initialize(value, ...)
  17: `as<-`(`*tmp*`, Classi, value = obj)
  18: asMethod(object, Class, value)
  19: `slot<-`(`*tmp*`, what, value = slot(value, what))
  20: checkSlotAssignment(object, name, value)
  21: stop(gettextf("assignment of an object of class %s is not valid for slot %s in an object of class %s; is(value, \"%s\") is not TRUE", 
         dQuote(valueClass), sQuote(name), dQuote(cl), slotClass), domain = NA)
  
  testthat results ================================================================
  OK: 82 SKIPPED: 15 FAILED: 3
  1. Error: DESeq2_l2fc runs with default params (@test-DESeq2_l2fc.R#2) 
  2. Error: DESeq2_l2fc runs with sparsity_apply=heavy (@test-DESeq2_l2fc.R#15) 
  3. Error: HRSIP runs with default (@test-HRSIP.R#3) 
  
  Error: testthat unit tests failed
  Execution halted