Skip to content

Commit

Permalink
Use the compact method to obtain 10x HDF5's.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Jan 25, 2022
1 parent 4a230ec commit a5509bc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions zeisel-brain/generate.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sce <- ZeiselBrainData()
sub <- sce[1:1000,]
library(zellkonverter)
library(HDF5Array)
source("../_scripts/compact10x.R")

for (s in c(FALSE, TRUE)) {
if (s) {
Expand All @@ -25,10 +26,7 @@ for (s in c(FALSE, TRUE)) {
# Saving in version 3 of the 10x format.
name <- sprintf("tenx.%sh5", suffix)
unlink(name)
writeTENxMatrix(assay(x), filepath=name, group="matrix")
rhdf5::h5createGroup(name, "matrix/features")
rhdf5::h5write(rownames(x), name, "matrix/features/id")
rhdf5::h5write(rownames(x), name, "matrix/features/name")
compact10x(name, assay(x), rownames(x), rownames(x))

# Saving in H5AD format.
assay(x) <- as(assay(x), "dgCMatrix")
Expand Down

0 comments on commit a5509bc

Please sign in to comment.