-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance: adds checks to `plotArrow()` to prevent single-omics and P-integrative methods to be visualised The file allows for testing of the `plotArrow()` function. Two included tests check for general functionality on DIABLO objects as well as inability to function on `(mint).(s)plsda` objects
- Loading branch information
1 parent
2213a71
commit e895692
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
test_that("plotArrow does not function on (mint).(s).plsda objects", code = { | ||
|
||
data("stemcells") | ||
|
||
X <- stemcells$gene | ||
Y <- stemcells$celltype | ||
S <- stemcells$study | ||
|
||
optimal.ncomp <- 4 | ||
optimal.keepX <- c(24, 45, 20, 30) | ||
|
||
splsda.stemcells <- splsda(X = X, Y = Y, | ||
ncomp = optimal.ncomp, | ||
keepX = optimal.keepX) | ||
expect_error(plotArrow(splsda.stemcells), "'plotArrow' not implemented for (s)PLSDA or MINT sPLSDA", fixed = TRUE) | ||
}) | ||
|
||
test_that("plotArrow functions on DIABLO objects", code = { | ||
|
||
data(breast.TCGA) | ||
|
||
X <- list(miRNA = breast.TCGA$data.train$mirna, | ||
mRNA = breast.TCGA$data.train$mrna, | ||
proteomics = breast.TCGA$data.train$protein) | ||
Y <- breast.TCGA$data.train$subtype | ||
|
||
optimal.ncomp <- 2 | ||
optimal.keepX <- list(miRNA = c(10, 5), | ||
mRNA = c(25,16), | ||
proteomics = c(8,5)) | ||
tcga.diablo <- block.splsda(X, Y, | ||
ncomp = optimal.ncomp, | ||
keepX = optimal.keepX) | ||
|
||
pA_res <- plotArrow(tcga.diablo) | ||
|
||
expect_is(pA_res, "ggplot") | ||
}) |