Open Flu09 opened 3 weeks ago
also having the same issue
Hi @Flu09 @matosmr
Apologies for the delay responding! Could you both try running the function using the following code and Seurat data package:
pbmc <- pbmc3k.SeuratData::pbmc3k.final
pbmc <- UpdateSeuratObject
Then run the conversion with identical code that is failing with your own objects (just swap out the object) in code.
Will help to figure out whether it is object or object format issue vs. function issue.
Thanks! Sam
Hello Sam! Just wanted to say I'm having the same issue.
With the pbmc dataset it seems to work. The dataset where it doesn't work, however is the MOCA dataset (https://oncoscape.v3.sttrcancer.org/atlas.gs.washington.edu.mouse.rna/downloads)
Here is my code:
library(Seurat)
library(scCustomize)
data = readRDS("~/gene_count_cleaned.RDS")
metadata = read.csv("/~cell_annotate.csv")
metadata_filtered = metadata[which(metadata$sample %in% colnames(data)), ]
data_seurat = CreateSeuratObject(data, meta.data = metadata_filtered)
as.anndata(x = data_seurat, file_path = "/project/MDL_JoshKim_Data/vista_sc_240706/moca/", file_name = "gene_count_cleaned.h5ad")
The error message:
• Checking Seurat object validity & Extracting Data
Warning message:
“No layers found matching search pattern provided”
Error in `as.anndata()`:
! `main_layer` must be one of counts
Traceback:
1. as.anndata(x = data_seurat, file_path = "[~/](http://localhost:8890/lab/tree/notebooks/moca/)",
. file_name = "gene_count_cleaned.h5ad")
2. as.anndata.Seurat(x = data_seurat, file_path = "[~/](http://localhost:8890/lab/tree/notebooks/moca/)",
. file_name = "gene_count_cleaned.h5ad")
3. cli_abort(message = "{.code main_layer} must be one of {.field {main_approved_slots}}")
4. rlang::abort(message, ..., call = call, use_cli_format = TRUE,
. .frame = .frame)
5. signal_abort(cnd, .file)
Seurat version 5.1.0
When executing the following:
Layers(data_seurat, search = c("counts", "data"))
I get 'counts' as an answer.
So I see here:
That main_layer must be in the layers. But main_layer is 'data' and I only have 'counts'. And I guess this makes sense, because I am downloading/using raw count values, and not normalized data. But it would be nice to make work with raw count data as well.
Hi All (@Flu09 @marlmatos @joshuak94)
Sorry again for delays. Could you all please try updating to dev release prep version:
devtools::install_github(repo = "samuel-marsh/scCustomize", ref = "release/2.2.0")
If that doesn’t solve the issue please let me know!
Best, Sam
Not sure what is the issue here