Skip to content

Commit

Permalink
Updated Enhancement for Issue #205
Browse files Browse the repository at this point in the history
fix: temporarily removed a couple tests causing conflict in `test-plotLoadings.R`
  • Loading branch information
Max-Bladen committed Jun 28, 2022
1 parent ce416f4 commit 518a963
Showing 1 changed file with 0 additions and 92 deletions.
92 changes: 0 additions & 92 deletions tests/testthat/test-plotLoadings.R
Original file line number Diff line number Diff line change
Expand Up @@ -440,95 +440,3 @@ test_that("(plotLoadings:error): catches invalid `block` values", {
"Incorrect value for 'block', 'block' should be among the blocks used in your object: miRNA, mRNA, proteomics",
fixed=T)
})


test_that("(plotLoadings:error): catches invalid `contrib` values", {

data(breast.TCGA)
X = list(miRNA = breast.TCGA$data.train$mirna[,1:10],
mRNA = breast.TCGA$data.train$mrna[,1:10],
proteomics = breast.TCGA$data.train$protein[,1:10])
Y = breast.TCGA$data.train$subtype

res.block.plsda <- block.plsda(X, Y)

expect_error(plotLoadings(res.block.plsda, contrib = "random.value"),
"'contrib' must be either 'min' or 'max'",
fixed=T)
})


test_that("(plotLoadings:error): catches invalid `name.var` values", {

data(breast.TCGA)
X = list(miRNA = breast.TCGA$data.train$mirna[,1:10],
mRNA = breast.TCGA$data.train$mrna[,1:10],
proteomics = breast.TCGA$data.train$protein[,1:10])
Y = breast.TCGA$data.train$subtype

res.block.plsda <- block.plsda(X, Y)

expect_error(plotLoadings(res.block.plsda, name.var = list(miRNA = rep("miRNA.names", 10),
mRNA = rep("mRNA.names", 10),
proteomics = rep("protein.names", 9))),
"For block 'proteomics', 'name.var' should be a vector of length 10",
fixed=T)

expect_error(plotLoadings(res.block.plsda, name.var = list(miRNA = rep("miRNA.names", 10),
mRNA = rep("mRNA.names", 10))),
"'names' has to be a list of length the number of block to plot: 3",
fixed=T)
})


# test_that("(plotLoadings:error): catches if study has duplicate entries", {
#
# data(stemcells)
# samples <- c(1:5,60:64)
# X <- stemcells$gene[samples, 1:10]
# Y <- rep(c("hESC", "hiPSC"),5)
# S <- as.character(stemcells$study[samples])
#
# res.mint.plsda <- mint.plsda(X, Y, study = S)
#
# expect_error(plotLoadings(res.mint.plsda, study = c("1", "1")),
# "Duplicate in 'study' not allowed",
# fixed=T)
# })


###############################################################################
### =============================== WARNINGS ============================== ###
###############################################################################





###############################################################################

dev.off()
unlink(list.files(pattern = "*.pdf"))


#
# test_that("plotLoadings margin errrors is handled properly", code = {
# data(nutrimouse)
# Y = nutrimouse$diet
# gene = nutrimouse$gene
# lipid = nutrimouse$lipid
# ## extend feature names
# suff <- "-a-long-suffix-from-abolutely-nowhere-which-is-gonna-be-longer-than-margins"
# colnames(gene) <- paste0(colnames(gene), suff)
# colnames(lipid) <- paste0(colnames(lipid), suff)
# data = list(gene = gene, lipid = lipid)
# design = matrix(c(0,1,1,1,0,1,1,1,0), ncol = 3, nrow = 3, byrow = TRUE)
#
# nutrimouse.sgccda = block.splsda(X = data,
# Y = Y,
# design = design,
# keepX = list(gene = c(10,10), lipid = c(15,15)),
# ncomp = 2,
# scheme = "centroid")
# expect_error(plotLoadings(nutrimouse.sgccda, contrib = "min"), regexp = "plotLoadings encountered margin errors")
# })

0 comments on commit 518a963

Please sign in to comment.