Skip to content

Commit

Permalink
unit test & docs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CATALYST-project committed Mar 27, 2024
1 parent 4602ea6 commit 462b121
Show file tree
Hide file tree
Showing 22 changed files with 47 additions and 40 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
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
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
changes in version 1.27.2

+ fixed typos 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.27.1

+ bug fix in 'plotDiffHeatmap': add 'drop=FALSE'
Expand Down
17 changes: 9 additions & 8 deletions R/assignPrelim.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,24 @@
#'
#' @return a \code{SingleCellExperiment} structured as follows:
#' \describe{
#' \item{assays}{
#' \item{\code{assays}}{
#' \itemize{
#' \item{\code{counts} - raw counts}
#' \item{\code{exprs} - arcsinh-transformed counts}
#' \item{\code{scaled} - population-wise scaled
#' expression using (95\%)-quantiles as boundaries}
#' \item \code{counts} - raw counts
#' \item \code{exprs} - arcsinh-transformed counts
#' \item \code{scaled} - population-wise scaled
#' expression using (95\%)-quantiles as boundaries
#' }
#' }
#' \item{\code{colData}}{
#' \itemize{
#' \item{bc_id}{numeric verctor of barcode assignments}
#' \item{delta}{separation between positive and negative barcode populations}
#' \item \code{bc_id} - numeric vector of barcode assignments
#' \item \code{delta} - separation between
#' positive and negative barcode populations
#' }
#' }
#' \item{\code{metadata}}{
#' \itemize{
#' \item{bc_key}{the input debarcoding scheme}
#' \item \code{bc_key} - the input debarcoding scheme
#' }
#' }
#' }
Expand Down
6 changes: 3 additions & 3 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 Expand Up @@ -178,7 +178,7 @@ clrDR <- function(x,
} else lines <- asp <- NULL

# make base plot
p <- ggplot(df, aes_string("x", "y", fill = point_col)) +
p <- ggplot(df, aes(.data$x, .data$y, fill = .data$point_col)) +
lines + guides(
fill = guide_legend(order = 1, ncol = ncol,
override.aes = list(alpha = 1, size = 4)),
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
2 changes: 1 addition & 1 deletion R/plotDR.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +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,
k_pal = .cluster_cols,
a_pal = hcl.colors(10, "Viridis")) {

# check validity of input arguments
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
17 changes: 9 additions & 8 deletions man/assignPrelim.Rd

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

4 changes: 2 additions & 2 deletions 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.

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")
})

0 comments on commit 462b121

Please sign in to comment.