From 36c3f0930457eac5677f64547ab0985410e96445 Mon Sep 17 00:00:00 2001 From: pormr <61189905+pormr@users.noreply.github.com> Date: Tue, 25 Feb 2025 07:06:57 +0000 Subject: [PATCH 1/5] Fix compatiblity issue for comparing versions --- R/supercell_2_Seurat.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/supercell_2_Seurat.R b/R/supercell_2_Seurat.R index 481c72d..4f9a792 100644 --- a/R/supercell_2_Seurat.R +++ b/R/supercell_2_Seurat.R @@ -94,7 +94,7 @@ supercell_2_Seurat <- function(SC.GE, SC, fields = c(), } m.seurat <- Seurat::CreateSeuratObject(counts = SC.GE, meta.data = meta) - if(packageVersion("Seurat") >= 5){ + if(packageVersion("Seurat") >= "5"){ m.seurat[["RNA"]] <- as(object = m.seurat[["RNA"]], Class = "Assay") } @@ -173,7 +173,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" & output.assay.version == "v5"){ m.seurat[["RNA"]] <- as(object = m.seurat[["RNA"]], Class = "Assay5") } return(m.seurat) From beb9826c4f2be057b5c09f9da8bcb58541b60fdd Mon Sep 17 00:00:00 2001 From: Yufei Chen <61189905+pormr@users.noreply.github.com> Date: Tue, 17 Mar 2026 15:55:12 +0000 Subject: [PATCH 2/5] Fix Seurat v5 compatibility by setting compatibility mode to v3 --- R/supercell_2_Seurat.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/R/supercell_2_Seurat.R b/R/supercell_2_Seurat.R index 4f9a792..c575eee 100644 --- a/R/supercell_2_Seurat.R +++ b/R/supercell_2_Seurat.R @@ -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) { + 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) From 76c2f7d8e2ed47d810abcc257bd304a0ccadbfe7 Mon Sep 17 00:00:00 2001 From: Yufei Chen <61189905+pormr@users.noreply.github.com> Date: Tue, 17 Mar 2026 15:59:34 +0000 Subject: [PATCH 3/5] Fix regression in previous commit that caused version check failure. --- R/supercell_2_Seurat.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/supercell_2_Seurat.R b/R/supercell_2_Seurat.R index c575eee..e55b3a5 100644 --- a/R/supercell_2_Seurat.R +++ b/R/supercell_2_Seurat.R @@ -93,7 +93,7 @@ supercell_2_Seurat <- function(SC.GE, SC, fields = c(), meta <- cbind(meta, SC.fields) } - if(packageVersion("Seurat") >= 5) { + if(packageVersion("Seurat") >= "5.0.0") { withr::local_options(list(Seurat.object.assay.version = "v3")) } From 94b775fd7511c1912b248c396734431e2402e6c6 Mon Sep 17 00:00:00 2001 From: Yufei Chen <61189905+pormr@users.noreply.github.com> Date: Wed, 18 Mar 2026 11:10:02 +0000 Subject: [PATCH 4/5] style: update formatting to match existing style --- R/supercell_2_Seurat.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/supercell_2_Seurat.R b/R/supercell_2_Seurat.R index e55b3a5..0fbfda7 100644 --- a/R/supercell_2_Seurat.R +++ b/R/supercell_2_Seurat.R @@ -93,7 +93,7 @@ supercell_2_Seurat <- function(SC.GE, SC, fields = c(), meta <- cbind(meta, SC.fields) } - if(packageVersion("Seurat") >= "5.0.0") { + if(packageVersion("Seurat") >= "5.0.0"){ withr::local_options(list(Seurat.object.assay.version = "v3")) } @@ -174,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) From 69ea74d71dba9ad74a235c48225204ab98b1fd11 Mon Sep 17 00:00:00 2001 From: Yufei Chen <61189905+pormr@users.noreply.github.com> Date: Wed, 18 Mar 2026 11:28:43 +0000 Subject: [PATCH 5/5] fix: update DESCRIPTION --- DESCRIPTION | 1 + 1 file changed, 1 insertion(+) diff --git a/DESCRIPTION b/DESCRIPTION index 1fbd481..5734ef4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -37,6 +37,7 @@ Imports: proxy, methods, rlang, + withr, RoxygenNote: 7.2.3 Suggests: SingleCellExperiment,