Skip to content

Commit bf36acf

Browse files
committed
Change default shape parameter in join_features() and join_transcripts() from "long" to "wide", resulting in a return type of SingleCellExperiment by default. Update documentation and tests accordingly.
1 parent fdef24e commit bf36acf

File tree

7 files changed

+21
-14
lines changed

7 files changed

+21
-14
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: tidySingleCellExperiment
33
Title: Brings SingleCellExperiment to the Tidyverse
4-
Version: 1.19.1
4+
Version: 1.19.2
55
Authors@R: c(person("Stefano", "Mangiola",
66
comment=c(ORCID="0000-0001-7474-836X"),
77

R/methods.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ setClass("tidySingleCellExperiment", contains="SingleCellExperiment")
4040
#' @importFrom stringr str_subset
4141
#' @export
4242
setMethod("join_features", "SingleCellExperiment", function(.data,
43-
features=NULL, all=FALSE, exclude_zeros=FALSE, shape="long", ...) {
43+
features=NULL, all=FALSE, exclude_zeros=FALSE, shape="wide", ...) {
4444
# CRAN Note
4545
.cell <- NULL
4646
.feature <- NULL

R/methods_DEPRECATED.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ join_transcripts <-
3535
transcripts=NULL,
3636
all=FALSE,
3737
exclude_zeros=FALSE,
38-
shape="long", ...)
38+
shape="wide", ...)
3939
{
4040
UseMethod("join_transcripts", .data)
4141
}
@@ -45,7 +45,7 @@ join_transcripts.default <-
4545
transcripts=NULL,
4646
all=FALSE,
4747
exclude_zeros=FALSE,
48-
shape="long", ...)
48+
shape="wide", ...)
4949
{
5050
print("tidySingleCellExperiment says:",
5151
" This function cannot be applied to this object")
@@ -56,7 +56,7 @@ join_transcripts.Seurat <-
5656
transcripts=NULL,
5757
all=FALSE,
5858
exclude_zeros=FALSE,
59-
shape="long", ...)
59+
shape="wide", ...)
6060
{
6161
deprecate_warn(
6262
"1.1.2", "join_transcripts()",

inst/NEWS.rd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@
1515
\item Use .cell for cell column name to avoid errors when cell column is defined by the user
1616
}}
1717

18+
\section{Changes in version 1.5.2, Bioconductor 3.22 Release}{
19+
\itemize{
20+
\item \strong{BREAKING CHANGE}: Changed default shape parameter in \code{join_features()} from "long" to "wide".
21+
This means that \code{join_features()} now returns a SingleCellExperiment object by default instead of a tibble.
22+
To get the old behavior, explicitly specify \code{shape="long"}.
23+
}}
24+

man/join_features.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/join_transcripts.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-methods.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ test_that("show()", {
1212

1313
test_that("join_features()", {
1414
gs <- sample(rownames(df), 3)
15+
# wide (default)
16+
fd <- join_features(df, gs, assay="counts")
17+
expect_s4_class(fd, "SingleCellExperiment")
18+
expect_null(fd$.feature)
19+
expect_identical(
20+
unname(t(as.matrix(as_tibble(fd)[, make.names(gs)]))),
21+
as.matrix(unname(counts(df)[gs, ])))
1522
# long
1623
fd <- join_features(df, gs, shape="long")
1724
expect_s3_class(fd, "tbl_df")
@@ -20,13 +27,6 @@ test_that("join_features()", {
2027
expect_identical(
2128
matrix(fd$.abundance_counts, nrow=length(gs)),
2229
as.matrix(unname(counts(df)[fd$.feature[seq_along(gs)], ])))
23-
# wide
24-
fd <- join_features(df, gs, shape="wide", assay="counts")
25-
expect_s4_class(fd, "SingleCellExperiment")
26-
expect_null(fd$.feature)
27-
expect_identical(
28-
unname(t(as.matrix(as_tibble(fd)[, make.names(gs)]))),
29-
as.matrix(unname(counts(df)[gs, ])))
3030
})
3131

3232
test_that("as_tibble()", {

0 commit comments

Comments
 (0)