Skip to content

Commit

Permalink
Merge pull request #25 from MartinLoza/SeuratV5_fix
Browse files Browse the repository at this point in the history
Seurat v5 fix
  • Loading branch information
MartinLoza authored Nov 5, 2023
2 parents d6998e6 + 11337b4 commit 05d0e38
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: Canek
Type: Package
Title: Batch Correction of Single Cell Transcriptome Data
Version: 0.2.3
Version: 0.2.4
Authors@R: c(
person("Martin", "Loza", email = "martin.loza.lopez@gmail.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-3342-2643")),
Expand All @@ -20,7 +20,8 @@ Imports:
fpc,
bluster,
igraph,
matrixStats
matrixStats,
utils
Suggests:
testthat (>= 2.1.0),
Seurat,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ importFrom(stats,dist)
importFrom(stats,kmeans)
importFrom(stats,quantile)
importFrom(stats,sd)
importFrom(utils,packageVersion)
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Canek 0.2.4

## Changes

- Update Canek for compatibility with Seurat v5 ([#20](https://github.com/MartinLoza/Canek/issues/20))

# Canek 0.2.3

## Changes
Expand Down
1 change: 1 addition & 0 deletions R/Canek-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# roxygen namespace tags. Modify with care!
## usethis namespace: start
#' @import numbers
#' @importFrom utils packageVersion
#' @importFrom stats dist kmeans sd quantile
#' @importFrom igraph cluster_louvain membership mst graph_from_adjacency_matrix as_edgelist
#' @importFrom bluster makeSNNGraph
Expand Down
5 changes: 4 additions & 1 deletion R/RunCanek.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ RunCanek.Seurat <- function(x, batches = NULL, slot = "data", assay = NULL, feat
}

counts <- lapply(obj, function(xx) {
Seurat::GetAssayData(xx, slot = slot, assay = assay)[features, ]
if (packageVersion("Seurat") >= "5.0.0")
Seurat::GetAssayData(xx, layer = slot, assay = assay)[features, ]
else
Seurat::GetAssayData(xx, slot = slot, assay = assay)[features, ]
})

counts <- Canek::CorrectBatches(counts, debug = debug, ...)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_RunCanek.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ y <- SingleCellExperiment::SingleCellExperiment(list(counts=m, logcounts=m))
y$batch <- b

# RunCanek.
x <- RunCanek(x, "batch")
x <- RunCanek(x, "batch", slot="counts")
y <- RunCanek(y, "batch")
z <- RunCanek(list(B1=m1, B2=m2), debug = TRUE)

Expand Down

0 comments on commit 05d0e38

Please sign in to comment.