Skip to content

Commit

Permalink
fix altExp convert
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewwbutler committed Jun 7, 2021
1 parent dfa68df commit 8482f75
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions R/objects.R
Original file line number Diff line number Diff line change
Expand Up @@ -1187,12 +1187,14 @@ as.SingleCellExperiment.Seurat <- function(x, assay = NULL, ...) {
# create one single cell experiment
sce <- as(object = experiments[[1]], Class = "SingleCellExperiment")
orig.exp.name <- names(x = experiments[1])
sce <- SingleCellExperiment::SingleCellExperiment(sce, altExps = experiments)
sce <- SingleCellExperiment::swapAltExp(
x = sce,
name = orig.exp.name,
saved = NULL
)
if (length(x = experiments) > 1) {
sce <- SingleCellExperiment::SingleCellExperiment(sce, altExps = experiments)
sce <- SingleCellExperiment::swapAltExp(
x = sce,
name = orig.exp.name,
saved = NULL
)
}
metadata <- x[[]]
metadata$ident <- Idents(object = x)
SummarizedExperiment::colData(x = sce) <- S4Vectors::DataFrame(metadata)
Expand Down

0 comments on commit 8482f75

Please sign in to comment.