Skip to content

Commit

Permalink
Add anndata v0.10.2 environment
Browse files Browse the repository at this point in the history
  • Loading branch information
lazappi committed Oct 16, 2023
1 parent 617f7f5 commit 253179e
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 5 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: zellkonverter
Title: Conversion Between scRNA-seq Objects
Version: 1.11.3
Date: 2023-10-02
Version: 1.11.4
Date: 2023-10-16
Authors@R:
c(person(given = "Luke",
family = "Zappia",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

* Bioconductor 3.18, October 2023

## zellkonverter 1.11.4 (2023-10-16)

* Add environment for **anndata** v0.10.2

## zellkonverter 1.11.3 (2023-10-2)

* Add environment for **anndata** v0.9.2
Expand Down
14 changes: 13 additions & 1 deletion R/basilisk.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ NULL
#' version strings.
#'
#' @export
.AnnDataVersions <- c("0.9.2", "0.8.0", "0.7.6")
.AnnDataVersions <- c("0.10.2", "0.9.2", "0.8.0", "0.7.6")

#' @rdname AnnData-Environment
#'
Expand Down Expand Up @@ -114,6 +114,17 @@ AnnDataDependencies <- function(version = .AnnDataVersions) {
"pandas==2.1.1",
"python==3.11.5",
"scipy==1.11.3"
),
"0.10.2" = c(
"anndata==0.10.2",
"h5py==3.10.0",
"hdf5==1.14.2",
"natsort==8.4.0",
"numpy==1.26.0",
"packaging==23.2",
"pandas==2.1.1",
"python==3.11.5",
"scipy==1.11.3"
)
)
}
Expand Down Expand Up @@ -143,3 +154,4 @@ zellkonverterAnnDataEnv <- function(version = .AnnDataVersions) {
anndata_env_0.7.6 <- zellkonverterAnnDataEnv(version = "0.7.6")
anndata_env_0.8.0 <- zellkonverterAnnDataEnv(version = "0.8.0")
anndata_env_0.9.2 <- zellkonverterAnnDataEnv(version = "0.9.2")
anndata_env_0.9.2 <- zellkonverterAnnDataEnv(version = "0.10.2")
4 changes: 2 additions & 2 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
\subsection{Major changes}{
\itemize{
\item{
Add an environment for \bold{anndata} v0.9.2. This is now the default
envrionment for the Python reader/writer.
Add environments for \bold{anndata} v0.9.2 and v0.10.2. Version 0.10.20 is
now the default envrionment for the Python reader/writer.
}
}}
\subsection{Minor changes}{
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/test-read.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ test_that("Reading H5AD works", {
expect_identical(colnames(colData(sce)), "cell_type")
})

test_that("Reading H5AD works with version 0.9.2", {
sce <- readH5AD(file, version = "0.9.2")
expect_s4_class(sce, "SingleCellExperiment")

expect_identical(assayNames(sce), "X")
expect_identical(colnames(colData(sce)), "cell_type")
})

test_that("Reading H5AD works with version 0.8.0", {
sce <- readH5AD(file, version = "0.8.0")
expect_s4_class(sce, "SingleCellExperiment")
Expand Down
31 changes: 31 additions & 0 deletions tests/testthat/test-write.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,37 @@ test_that("writeH5AD works as expected", {
expect_identical(col_data, colData(sce))
})

test_that("writeH5AD works as expected with version 0.9.2", {
temp <- tempfile(fileext = ".h5ad")
writeH5AD(sce, temp, version = "0.9.2")
expect_true(file.exists(temp))

# Reading it back out again. Hopefully we didn't lose anything important.
out <- readH5AD(temp, version = "0.9.2")

expect_identical(dimnames(out), dimnames(sce))
expect_equal(assay(out), assay(sce))
expect_identical(reducedDims(out), reducedDims(sce))

# Need to coerce the factors back to strings.
row_data <- rowData(out)
for (i in seq_len(ncol(row_data))) {
if (is.factor(row_data[[i]])) {
row_data[[i]] <- as.character(row_data[[i]])
}
}
expect_identical(row_data, rowData(sce))

col_data <- colData(out)
for (i in seq_len(ncol(col_data))) {
if (is.factor(col_data[[i]])) {
col_data[[i]] <- as.character(col_data[[i]])
}
}
names(col_data) <- names(colData(sce))
expect_identical(col_data, colData(sce))
})

test_that("writeH5AD works as expected with version 0.8.0", {
temp <- tempfile(fileext = ".h5ad")
writeH5AD(sce, temp, version = "0.8.0")
Expand Down

0 comments on commit 253179e

Please sign in to comment.