Skip to content

Commit

Permalink
added fun=match.arg(fun) to roast_multi_cor
Browse files Browse the repository at this point in the history
  • Loading branch information
jdreyf committed Apr 27, 2024
1 parent 65bd0d6 commit ca75791
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ezlimma
Type: Package
Title: Streamlines and extends limma package
Version: 0.2.5.9010
Version: 0.2.5.9011
Authors@R: c(person("Jonathan", "Dreyfuss", role = c("aut", "cre"), email = "[email protected]"),
person("Hui", "Pan", role = "aut"),
person("Grace", "Daher", role = "ctb"))
Expand Down
3 changes: 2 additions & 1 deletion R/roast_multi_cor.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ roast_multi_cor <- function(object, G, pheno.tab, feat.tab, name=NA, covariates=
min.nfeats=3, max.nfeats=1000, alternative=c("two.sided", "less", "greater"),
nrot=999, check.names=TRUE, pwy.nchar=199, seed=0){

fun <- match.arg(fun)
stopifnot(!is.null(dim(object)), !is.null(rownames(object)), !is.null(colnames(object)), ncol(object) > 1,
!is.null(colnames(pheno.tab)), nrow(pheno.tab) == ncol(object), limma::isNumeric(pheno.tab), colSums(!is.na(pheno.tab)) > 2,
length(weights)!=1 || is.na(weights), length(weights)<=1 ||
(is.numeric(weights) && all(weights>=0) && !all(is.na(weights))),
length(weights)<=1 || all(dim(weights)==dim(object)) ||
length(weights)==nrow(object) || length(weights)==ncol(object),
is.null(gene.weights) || length(gene.weights)==nrow(object),
is.na(name) || rownames(object) %in% rownames(feat.tab))
is.na(name) || all(rownames(object) %in% rownames(feat.tab)))
if (!is.null(covariates)) stopifnot(limma::isNumeric(covariates), !is.na(covariates))
if (check.names) stopifnot(rownames(pheno.tab)==colnames(object))

Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test-roast_multi_cor.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
des1 <- cbind(Int=1, design[, 1, drop=FALSE])
des2 <- cbind(Int=1, design[, 1, drop=FALSE], covar=1:6)

test_that("one phenotypes", {
test_that("one phenotype", {
# covar
pheno.tab <- design[, 1, drop=FALSE]
rc.des1 <- roast_cor(M, G=G, feat.tab=eztt, fun="fry", design = des1, prefix = "First3Arrays")
Expand Down Expand Up @@ -31,7 +31,8 @@ test_that("one phenotypes", {
test_that("multiple pheno", {
# NA
mph <- data.frame(design, pheno2=pheno2)
expect_message(rmc.multi <- roast_multi_cor(object=M, G=G, feat.tab=eztt, pheno.tab=mph))
# expect_message(rmc.multi <- roast_multi_cor(object=M, G=G, feat.tab=eztt, pheno.tab=mph, name = "mph")) # to test writing to file
expect_message(rmc.multi <- roast_multi_cor(object=M, G=G, feat.tab=eztt, pheno.tab=mph, name = "mph"))
rc.des1 <- roast_cor(M, G=G, feat.tab=eztt, fun="fry", design = des1, prefix = "First3Arrays")
expect_equal(rmc.multi[, 1:6], rc.des1)
expect_message(rc.pheno2 <- roast_cor(object=M, G=G, feat.tab=eztt, pheno=pheno2, prefix = "pheno2"))
Expand Down

0 comments on commit ca75791

Please sign in to comment.