Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Imports:
proxy,
methods,
rlang,
withr,
RoxygenNote: 7.2.3
Suggests:
SingleCellExperiment,
Expand Down
9 changes: 5 additions & 4 deletions R/supercell_2_Seurat.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,12 @@ supercell_2_Seurat <- function(SC.GE, SC, fields = c(),
if(length(SC.fields) > 0){
meta <- cbind(meta, SC.fields)
}
m.seurat <- Seurat::CreateSeuratObject(counts = SC.GE, meta.data = meta)

if(packageVersion("Seurat") >= 5){
m.seurat[["RNA"]] <- as(object = m.seurat[["RNA"]], Class = "Assay")
if(packageVersion("Seurat") >= "5.0.0"){
withr::local_options(list(Seurat.object.assay.version = "v3"))
}

m.seurat <- Seurat::CreateSeuratObject(counts = SC.GE, meta.data = meta)

if(!do.preproc) return(m.seurat)

Expand Down Expand Up @@ -173,7 +174,7 @@ supercell_2_Seurat <- function(SC.GE, SC, fields = c(),
warning("Super-cell graph was not found in SC object, no super-cell graph was added to Seurat object")
}

if(packageVersion("Seurat") >= 5 & output.assay.version == "v5"){
if(packageVersion("Seurat") >= "5.0.0" & output.assay.version == "v5"){
m.seurat[["RNA"]] <- as(object = m.seurat[["RNA"]], Class = "Assay5")
}
return(m.seurat)
Expand Down