Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: CoGAPS
Version: 3.33.1
Version: 3.33.2
Date: 2025-03-11
Title: Coordinated Gene Activity in Pattern Sets
Author: Jeanette Johnson, Ashley Tsang, Jacob Mitchell, Thomas Sherman, Wai-shing Lee, Conor Kelton, Ondrej Maxian, Jacob Carey,
Expand Down
8 changes: 4 additions & 4 deletions R/DistributedCogaps.R
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ stitchTogether <- function(result, allParams, sets)
if (identical(sort(indices), sort(setIndices)))
{
reorder <- match(indices, setIndices)
Amean <- Amean[reorder,]
Asd <- Asd[reorder,]
Amean <- Amean[reorder,,drop=FALSE]
Asd <- Asd[reorder,,drop=FALSE]
}
}
}
Expand All @@ -269,8 +269,8 @@ stitchTogether <- function(result, allParams, sets)
if (identical(sort(indices), sort(setIndices)))
{
reorder <- match(indices, setIndices)
Pmean <- Pmean[reorder,]
Psd <- Psd[reorder,]
Pmean <- Pmean[reorder,,drop=FALSE]
Psd <- Psd[reorder,,drop=FALSE]
}
}
}
Expand Down
26 changes: 26 additions & 0 deletions tests/testthat/test_DistributedCogaps.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,30 @@ test_that("featureLoadings and sampleFactors are not all 0s in genome-wide", {
expect_true(sort((dim(featureLoadings)))[1] == params@nPatterns)
expect_true(sort((dim(sampleFactors)))[2] == ncol(GIST.matrix))
expect_true(sort((dim(featureLoadings)))[2] == nrow(GIST.matrix))
})

# One consensus pattern makes the stitched matrices one column wide. Without
# drop=FALSE the re-ordering in stitchTogether turned them into vectors, whose
# rownames are NULL, and the run died with "no gene names given".
test_that("a one-pattern distributed run keeps its dim names", {
data(GIST)
for (mode in c("genome-wide", "single-cell"))
{
params <- CogapsParams(seed=42,
nIterations = 100,
nPatterns = 1,
sparseOptimization = as.logical(0),
distributed = mode)
params <- setDistributedParams(params, nSets = 2)
cg <- CoGAPS(GIST.matrix, params=params)

expect_true(is.matrix(cg@featureLoadings))
expect_true(is.matrix(cg@sampleFactors))
expect_equal(ncol(cg@featureLoadings), 1L)
expect_equal(ncol(cg@sampleFactors), 1L)
expect_equal(nrow(cg@featureLoadings), nrow(GIST.matrix))
expect_equal(nrow(cg@sampleFactors), ncol(GIST.matrix))
expect_false(is.null(rownames(cg@featureLoadings)))
expect_false(is.null(rownames(cg@sampleFactors)))
}
})
Loading