Skip to content

Commit

Permalink
fixes for Bioc 3.19 release
Browse files Browse the repository at this point in the history
  • Loading branch information
CATALYST-project committed Mar 27, 2024
1 parent 98fffcb commit bca4eb0
Show file tree
Hide file tree
Showing 24 changed files with 47 additions and 35 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: CATALYST
Type: Package
Title: Cytometry dATa anALYSis Tools
Version: 1.26.0
Version: 1.26.1
Depends: R (>= 4.2), SingleCellExperiment
Authors@R: c(
person("Helena L.", "Crowell",
Expand Down Expand Up @@ -44,7 +44,7 @@ Suggests:
URL: https://github.com/HelenaLC/CATALYST
BugReports: https://github.com/HelenaLC/CATALYST/issues
VignetteBuilder: knitr
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
License: GPL (>=2)
Encoding: UTF-8
LazyData: true
10 changes: 10 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
changes in version 1.26.1

+ fixed typoes in man pages and vignette
+ fixed unit test failures due to 'ggplot2'-updates etc.
+ omit usage of ':::' operator throughout the package

changes in version 1.26.0

+ Bioc 3.18 release

changes in version 1.25.1

+ fixed unit tests for differential plotting
Expand Down
4 changes: 2 additions & 2 deletions R/clrDR.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#' of cells in a given sample/cluster (for \code{by = "sample/cluster_id"}).
#' @param point_pal,arrow_pal character string of colors to use
#' for points and PC loading arrows. Arguments default to
#' \code{CATALYST:::.cluster_cols} for clusters,
#' \code{.cluster_cols} for clusters (defined internally),
#' and \code{brewer.pal}'s \code{"Set3"} for samples.
#' @inheritParams runDR
#' @inheritParams pbMDS
Expand All @@ -43,7 +43,7 @@
#' \describe{
#' \item{The centered log-ratio (CLR)}{
#' Let \code{k} be one of \eqn{S} samples, \code{k} one of \eqn{K} clusters,
#' and \code{p(s,k)} be the proprtion of cells from \code{s} in \eqn{k}.
#' and \code{p(s,k)} be the proportion of cells from \code{s} in \eqn{k}.
#' The centered log-ratio (CLR) is defined as
#' \deqn{clr(sk) = log p(s,k) - \sum p(s,k) / K}
#' and analogous for clusters replacing \code{s} by \code{k} and \code{K} by
Expand Down
13 changes: 8 additions & 5 deletions R/pbMDS.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,13 @@ pbMDS <- function(x,
# get number of legend columns to use
ncol <- ifelse(!is.null(color_by) && nlevels(df[[color_by]]) > 10, 2, 1)

ggplot(df, aes_string("x", "y",
col = color_by, shape = shape_by)) +
geom_point(alpha = 0.8, aes_string(size = size_by)) +
ggplot(df, aes(.data$x, .data$y,
col = if (!is.null(color_by)) .data[[color_by]],
shape = if (!is.null(shape_by)) .data[[shape_by]])) +
geom_point(alpha = 0.8,
aes(size = if (!is.null(size_by)) .data[[size_by]])) +
(if (!is.null(label_by)) geom_label_repel(
aes_string(label = label_by), show.legend = FALSE)) +
aes(label = .data[[label_by]]), show.legend = FALSE)) +
(if (!is.null(pal)) scale_color_manual(values = pal)) +
scale_shape_manual(values = .get_shapes(x, shape_by)) +
guides(
Expand All @@ -134,7 +136,8 @@ pbMDS <- function(x,
size = guide_legend(order = 3)) +
labs(
x = paste("MDS dim.", dims[1]),
y = paste("MDS dim.", dims[2])) +
y = paste("MDS dim.", dims[2]),
col=color_by, shape=shape_by, size=size_by) +
coord_equal() + theme_linedraw() + theme(
panel.grid.minor = element_blank(),
legend.key.height = unit(0.8, "lines"))
Expand Down
2 changes: 1 addition & 1 deletion R/plotAbundances.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ plotAbundances <- function(x, k = "meta20",
linkage = c(
"average", "ward.D", "single", "complete",
"mcquitty", "median", "centroid", "ward.D2"),
k_pal = CATALYST:::.cluster_cols) {
k_pal = .cluster_cols) {

# check validity of input arguments
by <- match.arg(by)
Expand Down
5 changes: 2 additions & 3 deletions R/plotCodes.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
#' @importFrom S4Vectors metadata
#' @export

plotCodes <- function(x, k = "meta20",
k_pal = CATALYST:::.cluster_cols) {
plotCodes <- function(x, k = "meta20", k_pal = .cluster_cols) {

# check validity of input arguments
.check_sce(x, TRUE)
Expand Down Expand Up @@ -92,7 +91,7 @@ plotCodes <- function(x, k = "meta20",
)

# arrange plots side-by-side
lgd <- get_legend(ps[[2]])
suppressWarnings(lgd <- get_legend(ps[[2]]))
ps <- lapply(ps, "+", theme(legend.position = "none"))
plot_grid(
lgd, ncol = 1, rel_heights = c(1, 5),
Expand Down
3 changes: 1 addition & 2 deletions R/plotDR.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@
plotDR <- function(x, dr = NULL,
color_by = "condition", facet_by = NULL, ncol = NULL,
assay = "exprs", scale = TRUE, q = 0.01, dims = c(1, 2),
k_pal = CATALYST:::.cluster_cols,
a_pal = hcl.colors(10, "Viridis")) {
k_pal = .cluster_cols, a_pal = hcl.colors(10, "Viridis")) {

# check validity of input arguments
stopifnot(
Expand Down
2 changes: 1 addition & 1 deletion R/plotExprHeatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ plotExprHeatmap <- function(x, features = NULL,
row_dend = TRUE, col_dend = TRUE,
bars = FALSE, perc = FALSE, bin_anno = FALSE,
hm_pal = rev(brewer.pal(11, "RdYlBu")),
k_pal = CATALYST:::.cluster_cols, m_pal = k_pal,
k_pal = .cluster_cols, m_pal = k_pal,
distance = c(
"euclidean", "maximum", "manhattan",
"canberra", "binary", "minkowski"),
Expand Down
2 changes: 1 addition & 1 deletion R/plotFreqHeatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ plotFreqHeatmap <- function(x,
row_dend = TRUE, col_dend = TRUE,
bars = TRUE, perc = FALSE,
hm_pal = rev(brewer.pal(11, "RdBu")),
k_pal = CATALYST:::.cluster_cols, m_pal = k_pal) {
k_pal = .cluster_cols, m_pal = k_pal) {

# check validity of input arguments
args <- as.list(environment())
Expand Down
2 changes: 1 addition & 1 deletion R/plotMahal.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ plotMahal <- function(x, which, assay = "exprs", n = 1e3) {
legend.key.width = unit(4, "line"),
legend.text = element_text(size = 8),
legend.key = element_blank())
lgd <- get_legend(foo)
suppressWarnings(lgd <- get_legend(foo))
first <- FALSE
}
}
Expand Down
2 changes: 1 addition & 1 deletion R/plotMultiHeatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ plotMultiHeatmap <- function(x,
hm1_pal = rev(brewer.pal(11, "RdYlBu")),
hm2_pal = if (isTRUE(hm2 == "abundances"))
rev(brewer.pal(11, "PuOr")) else hm1_pal,
k_pal = CATALYST:::.cluster_cols, m_pal = k_pal,
k_pal = .cluster_cols, m_pal = k_pal,
distance = c(
"euclidean", "maximum", "manhattan",
"canberra", "binary", "minkowski"),
Expand Down
2 changes: 1 addition & 1 deletion R/plotScatter.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
plotScatter <- function(x, chs, color_by = NULL, facet_by = NULL,
bins = 100, assay = "exprs",
label = c("target", "channel", "both"),
zeros = FALSE, k_pal = CATALYST:::.cluster_cols) {
zeros = FALSE, k_pal = .cluster_cols) {
# check validity of input arguments
label <- match.arg(label)
args <- as.list(environment())
Expand Down
2 changes: 1 addition & 1 deletion man/clrDR.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plotAbundances.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plotCodes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plotDR.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plotExprHeatmap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plotFreqHeatmap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plotMultiHeatmap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plotScatter.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tests/testthat/test_plotDiffHeatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test_that("plotDiffHeatmap() - DA", {
y <- p@matrix
expect_gte(min(y), 0)
expect_lte(max(y), 1)
expect_true(all(colSums(y) == 1))
expect_equivalent(colSums(y), rep(1, ncol(y)))
expect_equal(dim(y), c(nlevels(kids), nlevels(x$sample_id)))
expect_identical(rownames(y), levels(kids))
expect_identical(colnames(y), levels(x$sample_id))
Expand Down Expand Up @@ -78,6 +78,7 @@ test_that("plotDiffHeatmap() - DS; cluster filtering", {
expect_true(!any(ks %in% hm_ks))
}
})

test_that("plotDiffHeatmap() - DS; marker filtering", {
for (ms in lapply(c(1, 3, 5), sample, x = state_markers(x))) {
n <- sample(nlevels(kids)-5, 1)
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test_plotMultiHeatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test_that("plotMultiHeatmap() - hm2 = 'abundances'", {
p <- plotMultiHeatmap(x, hm2 = "abundances", k = k, normalize = FALSE)
y <- p@ht_list$frequency@matrix
expect_is(p, "HeatmapList")
expect_true(all(colSums(y) == 1))
expect_equivalent(colSums(y), rep(1, ncol(y)))
expect_equal(c(y), c(prop.table(table(kids, x$sample_id), 2)))
})

Expand All @@ -40,7 +40,7 @@ test_that("plotMultiHeatmap() - hm2 = 'state'", {
summarize_at(state_markers(x), median) %>%
do(.[, state_markers(x)]) %>%
do.call(what = "cbind")
expect_identical(c(y), c(ms))
expect_equal(c(y), c(ms))
})

test_that("plotMultiHeatmap() - hm2 = specific state markers", {
Expand All @@ -54,8 +54,8 @@ test_that("plotMultiHeatmap() - hm2 = specific state markers", {
replace(., is.na(.), 0) %>% {( lapply(ms, function(m)
acast(., cluster_id~sample_id, value.var = m)) )}
for (i in seq_along(ms)) {
expect_identical(p@ht_list[[i+1]]@column_title, ms[i])
expect_identical(p@ht_list[[i+1]]@matrix, meds[[i]])
expect_equal(p@ht_list[[i+1]]@column_title, ms[i])
expect_equal(p@ht_list[[i+1]]@matrix, meds[[i]])
}
})

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_plotScatter.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ test_that("plotScatter() - color_by", {
expect_is(p$scales$scales[[1]], "ScaleContinuous")
p <- plotScatter(x, chs, color_by = "bc_id")
expect_is(p, "ggplot")
expect_is(p$guides$colour, "guide")
expect_is(p$guides$guides[[1]], "GuideLegend")
})
2 changes: 1 addition & 1 deletion vignettes/differential.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Let K = `xdim` x `ydim` be the number of `r BiocStyle::Biocpkg("FlowSOM")` clust
- `rowData`:
- `cluster_id`: cluster ID as inferred by `r BiocStyle::Biocpkg("FlowSOM")`. One of 1, ..., K.
- `colData`:
- `marker_class`: factor `"type"` or `"state"`. Specifyies whether a marker has been used for clustering or not, respectively.
- `marker_class`: factor `"type"` or `"state"`. Specifies whether a marker has been used for clustering or not, respectively.
- `metadata`:
- `SOM_codes`: a table with dimensions K x (# type markers). Contains the SOM codes.
- `cluster_codes`: a table with dimensions K x (`maxK` + 1). Contains the cluster codes for all metaclusterings.
Expand Down

0 comments on commit bca4eb0

Please sign in to comment.