From 52e4c0368d1d4f33ef38b86ca84cac4293cc3305 Mon Sep 17 00:00:00 2001 From: Chen Weng <43254272+chenweng1991@users.noreply.github.com> Date: Wed, 25 Oct 2023 15:23:55 -0400 Subject: [PATCH] Update BuidTree.R Fix compatibility with Seurat v5 in SeuratLSIClustering --- R/BuidTree.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/BuidTree.R b/R/BuidTree.R index 213d602..438593a 100755 --- a/R/BuidTree.R +++ b/R/BuidTree.R @@ -246,7 +246,12 @@ setMethod(f="SeuratLSIClustering", signature="redeemR", definition=function(object,binary=T,res=0.6,lsidim=2:50,rmvariants=c("Variants310TC","Variants3109TC","Variants5764CT")){ require(Signac) + require(Seurat) if(binary){ + if (packageVersion("Seurat")>"4.9.9"){ + print("Seurat5 is on, convert data structure to v4") + options(Seurat.object.assay.version = 'v4') + } Cts.Mtx.bi<-as.matrix(object@Cts.Mtx.bi) Cts.Mtx.bi<-Cts.Mtx.bi[,!colnames(Cts.Mtx.bi) %in% rmvariants] Cts.Mtx.bi<-Cts.Mtx.bi[rowSums(Cts.Mtx.bi)>0,] @@ -1649,4 +1654,4 @@ Clonal_Variants<-c(Clonal_Variants,list(stat)) } names(Clonal_Variants)<-unique(meta$Clone_merge) return(Clonal_Variants) -} \ No newline at end of file +}