Skip to content

Commit

Permalink
Merge pull request #112 from stemangiola/ECCB2024
Browse files Browse the repository at this point in the history
fixes to aggregate and as_SE
  • Loading branch information
stemangiola authored Sep 17, 2024
2 parents 38b69e5 + b340b74 commit 4cef707
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion 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.15.4
Version: 1.15.5
Authors@R: c(person("Stefano", "Mangiola",
comment=c(ORCID="0000-0001-7474-836X"),
email="[email protected]",
Expand Down
4 changes: 2 additions & 2 deletions R/methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ setMethod("aggregate_cells", "SingleCellExperiment", function(.data,
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]
new_col_data = new_col_data |> DataFrame(row.names = new_col_data$my_id_to_split_by___) |> _[,-1,drop=FALSE]

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

rowData(aggregated_sce) = rowData(.data)
Expand Down
2 changes: 1 addition & 1 deletion R/tidybulk_utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ as_SummarizedExperiment <- function(.data,
tidyr::nest(`data`=-`assay`) %>%
mutate(`data`=`data` %>% map(
~ .x %>%
spread(!!sample__$symbol, .a) %>%
pivot_wider(names_from = !!sample__$symbol, values_from = .a) %>%

# arrange sample
select(!!feature__$symbol, any_of(rownames(colData))) |>
Expand Down

0 comments on commit 4cef707

Please sign in to comment.