bnprks / BPCells

Scaling Single Cell Analysis to Millions of Cells
https://bnprks.github.io/BPCells
Other
166 stars 17 forks source link

Rename row names of 10x HDF5 feature matrix cannot be stored on disk #8

Closed yuhanH closed 1 year ago

yuhanH commented 1 year ago

I altered the row names of a 10x HDF5 feature matrix and used write_matrix_dir to save as BPCells directory. However, the newly loaded matrix's row names remain unchanged. Example:

> brain.data <- open_matrix_10x_hdf5(path = "/brahms/haoy/seurat5/object/mouse_brain_1M/1M_neurons_filtered_gene_bc_matrices_h5.h5")
> head(rownames(brain.data))
[1] "ENSMUSG00000051951" "ENSMUSG00000089699" "ENSMUSG00000102343" "ENSMUSG00000025900" "ENSMUSG00000109048" "ENSMUSG00000025902"
> rownames(brain.data) <- paste0('a', 1:nrow(brain.data))
> head(rownames(brain.data))
[1] "a1" "a2" "a3" "a4" "a5" "a6"
> write_matrix_dir(mat = brain.data, dir = "~/test/bp_mat_rename", overwrite = T)
> mat2 <- open_matrix_dir("~/test/bp_mat_rename")
> head(rownames(mat2))
[1] "ENSMUSG00000051951" "ENSMUSG00000089699" "ENSMUSG00000102343" "ENSMUSG00000025900" "ENSMUSG00000109048" "ENSMUSG00000025902"
bnprks commented 1 year ago

Thanks for the bug report Yuhan, I think I have now fixed this with commit f2d4df7d0805bd71d73c569e09f19433c306269c.

Please let me know if this error persists for you or something new pops up