Skip to content

Commit 40e1612

Browse files
authored
Cherry-pick Bioc3.22 updates into devel (#411)
* Cherry-pick dd6b69c Update email for release 3.22 (#410) * Update email Robrecht * update news * Git cherry-pick: Fix linting issues (#412) * remove explicit returns * changed %>% into |> * bump version * Git cherry-pick: Fix tests (#413) * fix roundtrip test * fix dataset generator * update news * fix test
1 parent c071098 commit 40e1612

6 files changed

Lines changed: 22 additions & 15 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Package: anndataR
22
Title: AnnData interoperability in R
33
Version: 1.1.0
44
Authors@R: c(
5-
person("Robrecht", "Cannoodt", , "robrecht@data-intuitive.com", role = c("aut", "cre"),
5+
person("Robrecht", "Cannoodt", , "rcannood@gmail.com", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-3641-729X", github = "rcannood")),
77
person("Luke", "Zappia", , "luke@lazappi.id.au", role = "aut",
88
comment = c(ORCID = "0000-0001-7744-8565", github = "lazappi")),

NEWS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
- Bioconductor 3.23 devel
44

5+
# anndataR 1.0.1
6+
7+
- Update author email address (PR #410).
8+
- Fix linting issues (PR #412).
9+
- Fix roundtrip test; ensure that `X` is always 2-dimensional (PR #413).
10+
- Fix HDF5 write test; make sure to only pass CsparseMatrix to Seurat (PR #413).
11+
512
# anndataR 1.0.0
613

714
- Bioconductor 3.22 release (October 2025)

R/AnnDataView.R

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ AnnDataView <- R6::R6Class(
7070
result <- result[, private$.var_subset, drop = FALSE]
7171
}
7272

73-
return(result)
73+
result
74+
} else {
75+
x
7476
}
75-
76-
x
7777
},
7878

7979
# Apply subsetting to vectors
@@ -367,7 +367,6 @@ convert_to_indices <- function(
367367
"Logical subset of {context_name} must have length {max_length}"
368368
)
369369
}
370-
371370
which(subset)
372371
} else if (is.integer(subset) || is.numeric(subset)) {
373372
subset <- as.integer(subset)
@@ -376,7 +375,6 @@ convert_to_indices <- function(
376375
"Integer indices for {context_name} must be between 1 and {max_length}"
377376
)
378377
}
379-
380378
subset
381379
} else if (is.character(subset)) {
382380
if (is.null(names_vector)) {
@@ -395,7 +393,6 @@ convert_to_indices <- function(
395393
"Names of {context_name} not found: {paste(missing_names, collapse = ', ')}"
396394
)
397395
}
398-
399396
indices
400397
} else {
401398
cli_abort(

R/generate_dataset.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ generate_dataset <- function(
311311
colnames(X) <- dataset_list$obs_names
312312
rownames(X) <- dataset_list$var_names
313313

314+
# Convert to sparse matrix to avoid Seurat warning about coercing dense matrix
315+
if (!inherits(X, "sparseMatrix")) {
316+
X <- as(X, "CsparseMatrix")
317+
}
318+
314319
seurat <- SeuratObject::CreateSeuratObject(X)
315320

316321
for (layer in names(dataset_list$layers)) {

tests/testthat/test-generate_dataset.R

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,10 @@ test_that("generating dummy SingleCellExperiment works", {
2121
test_that("generating dummy Seurat works", {
2222
skip_if_not_installed("SeuratObject")
2323

24-
expect_warning(
25-
dummy <- generate_dataset(format = "Seurat"),
26-
"Data is of class matrix"
27-
)
24+
dummy <- generate_dataset(format = "Seurat")
2825
expect_s4_class(dummy, "Seurat")
2926

30-
expect_warning(
31-
dummy <- generate_dataset(format = "Seurat", example = TRUE),
32-
"Data is of class matrix"
33-
)
27+
dummy <- generate_dataset(format = "Seurat", example = TRUE)
3428
expect_s4_class(dummy, "Seurat")
3529
})
3630

tests/testthat/test-roundtrip-X.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ known_issues <- read_known_issues()
1111

1212
test_names <- names(da$matrix_generators)
1313

14+
# X must always be 2-dimensional in AnnData
15+
# -> https://github.com/scverse/anndata/blob/2a2c0e3198c298a5c80a73ac343c63203b5ca133/src/anndata/_core/anndata.py#L2164-L2172 # nolint
16+
test_names <- test_names[!grepl("_3d$", test_names)]
17+
1418
for (name in test_names) {
1519
# first generate a python h5ad
1620
adata_py <- da$generate_dataset(

0 commit comments

Comments
 (0)