From dc5f798428698f751e7d3974b08d889401ab498a Mon Sep 17 00:00:00 2001 From: Max-Bladen Date: Tue, 8 Mar 2022 12:18:56 +1100 Subject: [PATCH 1/2] Fix for Issue #178 --- R/circosPlot.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/R/circosPlot.R b/R/circosPlot.R index 934cafef..e6a266f1 100644 --- a/R/circosPlot.R +++ b/R/circosPlot.R @@ -445,6 +445,13 @@ circosPlot.block.splsda <- .circosPlot #' @export circosPlot.block.spls <- function(object, ..., group = NULL, Y.name = 'Y') { + # when a block.spls object is supplied that uses the indY parameter, the name + # of the object$X component for this dataframe is its proper name + # for below checks, change it back to "Y" + if (is.null(object$X$Y)) { + names(object$X)[object$indY] <- "Y" + } + if (length(group) != nrow(object$X$Y)) stop("group must be a factor of length: nrow(object$X$Y) = ", nrow(object$X$Y), "\n") object$Y <- factor(group) From f66c36dff06e4983393ed4944d0c46ab0c1d6a42 Mon Sep 17 00:00:00 2001 From: Max-Bladen Date: Mon, 14 Mar 2022 09:19:36 +1100 Subject: [PATCH 2/2] Added test for indY case --- tests/testthat/test-circsPlot.R | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/testthat/test-circsPlot.R b/tests/testthat/test-circsPlot.R index 0cd0c15e..06a8f29e 100644 --- a/tests/testthat/test-circsPlot.R +++ b/tests/testthat/test-circsPlot.R @@ -42,3 +42,18 @@ test_that("circosPlot works with similar feature names in different blocks", cod expect_is(cp_res, "matrix") }) +test_that("circosPlot works when using the indY parameter", code = { + + data("breast.TCGA") + data = list(mrna = breast.TCGA$data.train$mrna, + mirna = breast.TCGA$data.train$mirna, + protein = breast.TCGA$data.train$protein) + + list.keepX = list(mrna = rep(20, 2), mirna = rep(10,2), protein = rep(10, 2)) + TCGA.block.spls = block.spls(X = data, indY = 3, + ncomp = 2, keepX = list.keepX, design = 'full') + cp_res <- circosPlot(TCGA.block.spls, cutoff = 0.7, group = breast.TCGA$data.train$subtype) + + expect_is(cp_res, "matrix") +}) +