seurat-wrappers icon indicating copy to clipboard operation
seurat-wrappers copied to clipboard

Read .loom file in R (Ubuntu) for velocity analysis

Open juhjeong opened this issue 3 years ago • 6 comments

Hello, seurat-wrappers team! I try to import loom file with ReadVelocity function. But the error said there is no CellID in my loom file. Here are the codes I run:

library(Seurat) Attaching SeuratObject library(velocyto.R) Loading required package: Matrix library(SeuratWrappers) Bioconductor version 3.12 (BiocManager 1.30.12), ?BiocManager::install for help Bioconductor version '3.12' is out-of-date; the current release version '3.13' is available with R version '4.1'; see https://bioconductor.org/install sample.data<-ReadVelocity("sample_test.loom") reading loom file via hdf5r... Error in [[.H5File(f, "col_attrs/CellID") : An object with name col_attrs/CellID does not exist in this group

Instead, I loaded my loom file with loomR package, and I confirmed that my col_attrs and row_attrs do not have CellID and gene, respectively.

library(loomR) Loading required package: R6 Loading required package: hdf5r lfile<-connect(filename="sample_test.loom", mode="r") lfile Class: loom Filename: /home/username/try002/sample_test.loom Access type: H5F_ACC_RDONLY Attributes: CreationDate, LOOM_SPEC_VERSION, last_modified Listing: name obj_type dataset.dims dataset.type_class col_attrs H5I_GROUP <NA> <NA> col_graphs H5I_GROUP <NA> <NA> layers H5I_GROUP <NA> <NA> matrix H5I_DATASET 8533 x 60662 H5T_FLOAT row_attrs H5I_GROUP <NA> <NA> row_graphs H5I_GROUP <NA> <NA> lfile[["col_attrs/cell_names"]] Error in [[.H5File(lfile, "col_attrs/cell_names") : An object with name col_attrs/cell_names does not exist in this group lfile[["col_attrs"]] Class: H5Group Filename: /home/username/try002/sample_test.loom Group: /col_attrs Attributes: last_modified Listing: name obj_type dataset.dims dataset.type_class TotalUMIs H5I_DATASET 8533 H5T_INTEGER obs_names H5I_DATASET 8533 H5T_STRING

How can I revolve this problem? I need a help...!

Thank you so much in advance.

Juhee

juhjeong avatar Oct 05 '21 07:10 juhjeong

Hello, seurat-wrappers team! I've got the same issue on macos m1. Could you propose any solutions? Thank you in advance. Igor

Igor0411 avatar Oct 05 '22 17:10 Igor0411

I have the same problem as well running pyScenic with an error message saying that loom file doesn't have attributes which I confirmed as mentioned above. The loom file is coming from converting Seurat object to loom using as.loom function.

Sa753 avatar Dec 01 '22 13:12 Sa753

I found a solution for my case, maybe it will be helpfull for someone else. I had errors with kallisto-bustools generated loom file. But with velocyto generated loom file both scvelo and velocyto.r seurat-wrappers protocols worked smooth and easy. It looks like kb generated loom file lacks some information and thats cause errors. Maybe this information could be added somehow, but I wasn't able to do it.

Igor0411 avatar Dec 01 '22 22:12 Igor0411

Hi @Igor0411

I found a solution for my case, maybe it will be helpfull for someone else. I had errors with kallisto-bustools generated loom file. But with velocyto generated loom file both scvelo and velocyto.r seurat-wrappers protocols worked smooth and easy. It looks like kb generated loom file lacks some information and thats cause errors. Maybe this information could be added somehow, but I wasn't able to do it.

I am also having the same error (Error in [[.H5File(f, "col_attrs/CellID") : An object with name col_attrs/CellID does not exist in this group) when I try to read the kb count generated loom file using ReadVelocity (SeuratWrapper) or read.loom.matrices (Velocyte.R).

Were you able to read the kallisto-bustools generated loom file for SeuratWrapper or Velocyte.R? I would be grateful if you could kindly provide a solution for that problem.

Thank you very much,

stanaka6 avatar Dec 19 '22 19:12 stanaka6

Hi @stanaka6 I wasn't able to read kallisto-bustools generated loom file in any R package. As it said in the error this file lack some vital information. So, I made loom file with velocyto tool (https://velocyto.org/). Hope this information will be helpfull.

Igor0411 avatar Dec 19 '22 23:12 Igor0411

Hi @stanaka6 I wasn't able to read kallisto-bustools generated loom file in any R package. As it said in the error this file lack some vital information. So, I made loom file with velocyto tool (https://velocyto.org/). Hope this information will be helpfull.

Hi @Igor0411, thank you very much for your kind reply. I ended up using BUSpaRse R package read_velocity_output function to read spliced/unspliced count matrices, which are kb count output, without a loom file to perform RunVelocity. Thanks for sharing your solution!

Best

stanaka6 avatar Dec 28 '22 00:12 stanaka6