This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to get raw mRNA count from Seurat converted anndata

I converted Seurat data into Ann data using-

SaveH5Seurat(object, filename = "object.h5Seurat")
Convert("object.h5Seurat", dest = "h5ad")

Now I want to access the raw mRNA count (data should be non-negative values WITHOUT log transformation and scaling) in the anndata

I know in Seurat object this data is stored at object@assays$RNA@counts This data looks like this-

MIR1302-2HG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
FAM138A     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...... 
OR4F5       . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...... 
AL627309.1  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
AL627309.3  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...... 
AL627309.2  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...... 
AL627309.5  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......

How do I access the raw mRNA count data in anndata?

Thank you for your help

anndata seurat

1 answer

I haven't worked with annData before nor do I use Python much, but it looks like the X attribute of annData stores the gene counts in sparse matrix form:

And it looks like the default assay of your seurat object is the assay that gets selected when converting an H5Seurat object:

# S3 method for h5Seurat
Convert(
  source,
  dest = "h5ad",
  assay = DefaultAssay(object = source),
  overwrite = FALSE,
  verbose = TRUE,
  ...
)

https://mojaveazure.github.io/seurat-disk/reference/Convert.html

Log in to answer this question.