Skip to content

Commit

Permalink
Merge e2f7428 into 8a9dedf
Browse files Browse the repository at this point in the history
  • Loading branch information
stemangiola authored May 10, 2024
2 parents 8a9dedf + e2f7428 commit 8c092db
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: tidySingleCellExperiment
Title: Brings SingleCellExperiment to the Tidyverse
Version: 1.13.3
Version: 1.15.1
Authors@R: c(person("Stefano", "Mangiola",
comment=c(ORCID="0000-0001-7474-836X"),
email="[email protected]",
Expand Down Expand Up @@ -68,6 +68,6 @@ biocViews:
AssayDomain, Infrastructure, RNASeq, DifferentialExpression, SingleCell,
GeneExpression, Normalization, Clustering, QualityControl, Sequencing
Encoding: UTF-8
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
URL: https://github.com/stemangiola/tidySingleCellExperiment
BugReports: https://github.com/stemangiola/tidySingleCellExperiment/issues
36 changes: 24 additions & 12 deletions R/methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -204,20 +204,32 @@ setMethod("aggregate_cells", "SingleCellExperiment", function(.data,
~ .x |> mutate(.aggregated_cells = .y)
)


do.call(rbind, list_assays) |>

left_join(
.data |>
colData() |>
as_tibble() |>
subset(!!.sample) |>
unite("my_id_to_split_by___", !!.sample, remove=FALSE, sep = "___"),
by= join_by(".sample" == "my_id_to_split_by___")
) |>
aggregated_sce =
do.call(rbind, list_assays) |>

as_SummarizedExperiment(
.sample=.sample,
.transcript=.feature,
.abundance=!!as.symbol(names(.data@assays)))
.abundance=!!as.symbol(names(.data@assays))
)

new_col_data =
.data |>
colData() |>
as_tibble() |>
subset(!!.sample) |>
unite("my_id_to_split_by___", !!.sample, remove=FALSE, sep = "___")

new_col_data = new_col_data |> DataFrame(row.names = new_col_data$my_id_to_split_by___) |> _[,-1]

colData(aggregated_sce) =
colData(aggregated_sce) |>
cbind(
new_col_data[match(rownames(colData(aggregated_sce)), rownames(new_col_data)),]
)

rowData(aggregated_sce) = rowData(.data)

aggregated_sce

})
3 changes: 3 additions & 0 deletions man/ggplot.Rd

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

0 comments on commit 8c092db

Please sign in to comment.