Skip to content

Commit 9cb8898

Browse files
authored
Merge pull request #64 from william-hutchison/master
Use generic aggregate cells from ttservice
2 parents 2f0b31a + 42b9c22 commit 9cb8898

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
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.9.4
4+
Version: 1.9.5
55
Authors@R: c(person("Stefano", "Mangiola", email = "[email protected]",
66
role = c("aut", "cre")) )
77
Description: tidySingleCellExperiment is an adapter that abstracts the 'SingleCellExperiment' container

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ importFrom(tidyr,spread)
163163
importFrom(tidyr,unite)
164164
importFrom(tidyr,unnest)
165165
importFrom(tidyselect,eval_select)
166+
importFrom(ttservice,aggregate_cells)
166167
importFrom(ttservice,join_features)
167168
importFrom(utils,data)
168169
importFrom(utils,tail)

R/methods.R

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ tidy.SingleCellExperiment <- function(object) {
139139
#' @importFrom rlang enquo
140140
#' @importFrom tibble enframe
141141
#' @importFrom Matrix rowSums
142-
#'
142+
#' @importFrom ttservice aggregate_cells
143+
#'
143144
#' @name aggregate_cells
144145
#' @rdname aggregate_cells
145146
#'
@@ -157,7 +158,20 @@ tidy.SingleCellExperiment <- function(object) {
157158
#' aggregate_cells(c(groups, ident), assays = "counts")
158159
#'
159160
#' @export
160-
aggregate_cells <- function(.data, .sample = NULL, slot = "data", assays = NULL, aggregation_function = rowSums) {
161+
NULL
162+
163+
#' aggregate_cells
164+
#'
165+
#' @docType methods
166+
#' @rdname aggregate_cells
167+
#'
168+
#' @return An object containing the information for the specified features
169+
#'
170+
setMethod("aggregate_cells", "SingleCellExperiment", function(.data,
171+
.sample = NULL,
172+
slot = "data",
173+
assays = NULL,
174+
aggregation_function = Matrix::rowSums){
161175

162176
.sample = enquo(.sample)
163177

@@ -191,7 +205,7 @@ aggregate_cells <- function(.data, .sample = NULL, slot = "data", assays = NULL,
191205
left_join(.data %>% as_tibble() %>% subset(!!.sample), by = quo_names(.sample)) %>%
192206
unnest(data) %>%
193207

194-
drop_class("tidySingleCellExperiment_nested") |>
208+
drop_class("tidySingleCellExperiment_nested") %>%
195209

196210
as_SummarizedExperiment(.sample = !!.sample, .transcript = feature, .abundance = !!as.symbol(names(.data@assays)))
197-
}
211+
})

man/aggregate_cells.Rd

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)