PMBio/MuDataSeurat

WriteH5MU fails with NULL as varm_key after running Seurat workflow

fhausmann opened this issue · 4 comments

Saving an Seurat objects after normal Seurat workflow fails due to NULL value a varm_key.
I'm not sure why and if it is occuring here or here but wrapping this lines in if (!is.null(varm_key)){} solved it for me and no keys where obviously missing in the h5mu object.

R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS

Packages:
hdf5r_1.3.4
SeuratObject_4.0.2
Seurat_4.0.4
MuDataSeurat_0.0.0.9000

Thanks for developing this package. It helps a lot in switching between Seurat and scanpy!

gtca commented

Hey, I'm curious if that still fails with the current main branch?
Here, varm_key is defined to be the same as the embedding name if it's not one of the default ones such as PCs for X_pca1.

If it still fails, it might be useful to understand what exactly is happening there...
But I think a5c8251 should finally fix it.

Footnotes

  1. I guess this issue is not the right place for me to complain about this weird part of the convention to store the loadings...

I tried with the most recent commit 0f16065, and this issue is not occurring (yet) because it fails when writing X_pca.

Added .var['highly_variable'] with highly variable features

Error in obsm$create_dataset(paste0("X_", red_name), emb): Can't create dataset X_pca - already exists!
Traceback:

1. WriteH5MU(data, "test.h5mu")
2. WriteH5MU(data, "test.h5mu")
3. obsm$create_dataset(paste0("X_", red_name), emb)
4. stop(paste("Can't create dataset", name, "- already exists!")
gtca commented

Thanks a lot, @fhausmann, for testing it so quickly!

I wasn't able to reproduce it on a bunch of files... but I overhauled a few things so I'm wondering if this might be fixed now in the latest main?
There might be rough edges still with there new changes so feel free to continue here or open new issues if you stumble upon them.

Thanks a lot, @gtca. The latest main branch fixes it for me.