diff --git a/DESCRIPTION b/DESCRIPTION index 80cbcbf..b8904be 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -4,7 +4,7 @@ Version: 2.6.0 Authors@R: person("Jakob", "Russel", email = "russel2620@gmail.com", role = c("aut", "cre")) Description: What the title says. Depends: R (>= 3.2.5) -Imports: foreach, doParallel, doSNOW, snow, MASS, pROC, ggplot2, cowplot, lme4, nlme, stats, methods, statmod, pscl, samr, minqa, nloptr, venneuler +Imports: foreach, doParallel, doSNOW, snow, MASS, pROC, ggplot2, cowplot, lme4, nlme, stats, methods, utils, statmod, pscl, samr, minqa, nloptr, venneuler License: GPL (>= 3) Encoding: UTF-8 LazyData: true diff --git a/R/DA.sam.R b/R/DA.sam.R index b350460..1063ea1 100644 --- a/R/DA.sam.R +++ b/R/DA.sam.R @@ -10,8 +10,6 @@ #' @export DA.sam <- function(data, predictor, paired = NULL, fdr.output = 0.05, allResults = FALSE, ...){ - library(samr, quietly = TRUE) - # Extract from phyloseq if(class(data) == "phyloseq"){ if(length(predictor) > 1 | length(paired) > 1) stop("When data is a phyloseq object predictor and paired should only contain the name of the variables in sample_data") @@ -29,21 +27,21 @@ DA.sam <- function(data, predictor, paired = NULL, fdr.output = 0.05, allResults if(is.numeric(predictor)){ # Quantitative - res <- SAMseq(count_table, predictor, resp.type = "Quantitative", genenames = rownames(count_table), fdr.output = fdr.output, ...) + res <- samr::SAMseq(count_table, predictor, resp.type = "Quantitative", genenames = rownames(count_table), fdr.output = fdr.output, ...) } else { # Categorical predictor <- as.numeric(as.factor(predictor)) if(length(levels(as.factor(predictor))) == 2){ if(is.null(paired)){ - res <- SAMseq(count_table, predictor, resp.type = "Two class unpaired", genenames = rownames(count_table), fdr.output = fdr.output) + res <- samr::SAMseq(count_table, predictor, resp.type = "Two class unpaired", genenames = rownames(count_table), fdr.output = fdr.output) } else { predictor[predictor == 2] <- -1 predictor <- as.numeric(as.factor(paired)) * predictor - res <- SAMseq(count_table, predictor, resp.type = "Two class paired", genenames = rownames(count_table), fdr.output = fdr.output, ...) + res <- samr::SAMseq(count_table, predictor, resp.type = "Two class paired", genenames = rownames(count_table), fdr.output = fdr.output, ...) } } else { - res <- SAMseq(count_table, predictor, resp.type = "Multiclass", genenames = rownames(count_table), fdr.output = fdr.output, ...) + res <- samr::SAMseq(count_table, predictor, resp.type = "Multiclass", genenames = rownames(count_table), fdr.output = fdr.output, ...) } } diff --git a/R/testDA.R b/R/testDA.R index 86571a3..ebea734 100644 --- a/R/testDA.R +++ b/R/testDA.R @@ -110,7 +110,7 @@ #' \item run.times - A dataframe with average run times of the different methods #' } #' -#' @import snow doSNOW foreach +#' @import snow doSNOW foreach utils #' @importFrom parallel detectCores #' @importFrom pROC roc #' @export diff --git a/R/zzz.R b/R/zzz.R new file mode 100644 index 0000000..889a244 --- /dev/null +++ b/R/zzz.R @@ -0,0 +1,6 @@ +# Fix samr options problem + +.onLoad <- function(libname, pkgname){ + options(error=utils::dump.frames) +} +