Skip to content

Commit

Permalink
Correct the previous fix to #122
Browse files Browse the repository at this point in the history
Fixes #122
  • Loading branch information
lazappi committed Oct 14, 2024
1 parent 03c28f8 commit e47c845
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

* Bioconductor 3.20, October 2024

* Fix correctly assign levels to factors in R reader with **anndata** v0.7 files (Fixes #122)

## zellkonverter 1.15.3 (2024-10-04)

* Correctly assign levels to factors in R reader (Fixes #122)
Expand Down
3 changes: 2 additions & 1 deletion R/read.R
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ readH5AD <- function(file, X_name = NULL, use_hdf5 = FALSE,
levels <- as.vector(
rhdf5::h5read(file, file.path(path, "__categories", cat_name))
)
out_cols[[cat_name]] <- factor(out_cols[[cat_name]], levels = levels)
codes <- out_cols[[cat_name]] + 1L
out_cols[[cat_name]] <- factor(levels[codes], levels = levels)
}

## rhdf5::h5readAttributes(file, "var") |> str()
Expand Down

0 comments on commit e47c845

Please sign in to comment.