# anndata

**URL:** https://discourse.scverse.org/c/help/anndata/36.md

[Latest](https://discourse.scverse.org/latest.md) · [Categories](https://discourse.scverse.org/categories.md) · [Tags](https://discourse.scverse.org/tags.md)

---

## [About the anndata category](https://discourse.scverse.org/t/about-the-anndata-category/330)

<div class="topic-metadata">

**Author:** [@adamgayoso](https://discourse.scverse.org/u/adamgayoso)\
**Replies:** 0

</div>

---

## [Scanpy: use of layers](https://discourse.scverse.org/t/scanpy-use-of-layers/4030)

<div class="topic-metadata">

**Author:** [@albi](https://discourse.scverse.org/u/albi)\
**Replies:** 3\
**Last updated:** [July 17, 2026, 7:28am UTC](https://discourse.scverse.org/t/scanpy-use-of-layers/4030 "2026-07-17T07:28:17Z")

</div>

Current behavior When working with AnnData.layers, applying a preprocessing transformation and storing the result in a new layer currently requires copying the source layer first and then modifying that copy in place. F…

---

## [Seeking guidance and reviewers for AnnData HTML representation PR (#2236)](https://discourse.scverse.org/t/seeking-guidance-and-reviewers-for-anndata-html-representation-pr-2236/3884)

<div class="topic-metadata">

**Author:** [@katosh](https://discourse.scverse.org/u/katosh)\
**Replies:** 2\
**Last updated:** [December 1, 2025, 11:21pm UTC](https://discourse.scverse.org/t/seeking-guidance-and-reviewers-for-anndata-html-representation-pr-2236/3884 "2025-12-01T23:21:20Z")

</div>

Hi all, I just opened a PR to AnnData that adds a full HTML representation for AnnData objects ( Add HTML representation by katosh · Pull Request #2236 · scverse/anndata · GitHub ). It’s a fairly extensive implementatio…

---

## [.raw. car\_names reassignation](https://discourse.scverse.org/t/raw-car-names-reassignation/3872)

<div class="topic-metadata">

**Author:** [@bontix-77](https://discourse.scverse.org/u/bontix-77)\
**Replies:** 2\
**Last updated:** [November 20, 2025, 4:34pm UTC](https://discourse.scverse.org/t/raw-car-names-reassignation/3872 "2025-11-20T16:34:24Z")

</div>

After SeuratDisk the raw.var\_names contain the numeric index while raw.var\[‘\_index’\] contain the gene symbols. I need to swap the two but raw data are no mutable, is all locked. Suggestions?

---

## [Convert Scanpy (h5ad) to Seurat (rds)](https://discourse.scverse.org/t/convert-scanpy-h5ad-to-seurat-rds/457)

<div class="topic-metadata">

**Author:** [@PEB](https://discourse.scverse.org/u/PEB)\
**Replies:** 10\
**Last updated:** [November 6, 2025, 11:14am UTC](https://discourse.scverse.org/t/convert-scanpy-h5ad-to-seurat-rds/457 "2025-11-06T11:14:51Z")

</div>

Hi Everyone, I am trying to convert my h5ad to a Seurat rds to run R-based pseudo time algorithms (monocle, slingshot, etc). However I keep running into errors on the commonly posted methods. Does anyone have any advice…

---

## [Changing the order of the anndata objects in anndata.concat changes the leiden clustering](https://discourse.scverse.org/t/changing-the-order-of-the-anndata-objects-in-anndata-concat-changes-the-leiden-clustering/3802)

<div class="topic-metadata">

**Author:** [@osmanmerdan](https://discourse.scverse.org/u/osmanmerdan)\
**Replies:** 6\
**Last updated:** [October 9, 2025, 7:45am UTC](https://discourse.scverse.org/t/changing-the-order-of-the-anndata-objects-in-anndata-concat-changes-the-leiden-clustering/3802 "2025-10-09T07:45:09Z")

</div>

Hi everyone, When I change the order of anndata objects in anndata concat, like the following: adata1 = ad.concat(\[day1\_data, day2\_data, day3\_data\], join='outer') adata2 = ad.concat(\[day2\_data, day1\_data, day3\_data\], j…

---

## [Memory Usage in multiple New Formats](https://discourse.scverse.org/t/memory-usage-in-multiple-new-formats/3605)

<div class="topic-metadata">

**Author:** [@Mariano](https://discourse.scverse.org/u/Mariano)\
**Replies:** 2\
**Last updated:** [September 2, 2025, 10:20am UTC](https://discourse.scverse.org/t/memory-usage-in-multiple-new-formats/3605 "2025-09-02T10:20:21Z")

</div>

Hi, there are now, multiple ways of loading an anndata object. I will list some: read\_h5ad, read\_h5ad(backed=‘r’), read\_zarr, read\_lazy (in the experimental branch). I am having a difficult time to understand the differ…

---

## [How can I operate on view of Anndata object when the Object itself is large to load to memory?](https://discourse.scverse.org/t/how-can-i-operate-on-view-of-anndata-object-when-the-object-itself-is-large-to-load-to-memory/3788)

<div class="topic-metadata">

**Author:** [@MooseGoblin89](https://discourse.scverse.org/u/MooseGoblin89)\
**Replies:** 1\
**Last updated:** [September 2, 2025, 10:14am UTC](https://discourse.scverse.org/t/how-can-i-operate-on-view-of-anndata-object-when-the-object-itself-is-large-to-load-to-memory/3788 "2025-09-02T10:14:07Z")

</div>

Hi All, I am new to using AnnData, and seem to be struggling with some basic usage– I am using large (\>10GB) snRNA-seq files from Allen Brain in .h5ad format. I can only load these as backed Anndata objects (backed=’r’)…

---

## [Lazy Loading Anndata backed in Zarr Arrays from Disk](https://discourse.scverse.org/t/lazy-loading-anndata-backed-in-zarr-arrays-from-disk/3586)

<div class="topic-metadata">

**Author:** [@Mariano](https://discourse.scverse.org/u/Mariano)\
**Replies:** 5\
**Last updated:** [May 28, 2025, 12:12pm UTC](https://discourse.scverse.org/t/lazy-loading-anndata-backed-in-zarr-arrays-from-disk/3586 "2025-05-28T12:12:05Z")

</div>

Hi, I am trying to understand the Zarr format and its interplay with anndata. Can you help me with these questions? Let’s say that I have a Zarr anndata that is saved in disk with certain chunks and shard. When a Zarr…

---

## [Efficient pseudobulking](https://discourse.scverse.org/t/efficient-pseudobulking/3515)

<div class="topic-metadata">

**Author:** [@emdann](https://discourse.scverse.org/u/emdann)\
**Replies:** 4\
**Last updated:** [May 28, 2025, 12:08pm UTC](https://discourse.scverse.org/t/efficient-pseudobulking/3515 "2025-05-28T12:08:32Z")

</div>

With the newest anndata/scanpy releases, what is the recommended scverse workflow to pseudobulk efficiently a large anndata object? I.e. summing the counts for each var for groups of cells, based on some column in obs. I…

---

## [Convert anndata to seurat (spatial)](https://discourse.scverse.org/t/convert-anndata-to-seurat-spatial/3644)

<div class="topic-metadata">

**Author:** [@npont](https://discourse.scverse.org/u/npont)\
**Replies:** 1\
**Last updated:** [May 9, 2025, 4:08pm UTC](https://discourse.scverse.org/t/convert-anndata-to-seurat-spatial/3644 "2025-05-09T16:08:19Z")

</div>

Hi there, I am struggling to convert my anndata object to Seurat properly. I made a StarDist segmentation using scanpy, creating a anndata object (which is basically a segmented visium HD object) and I now want to use …

---

## [How to transfer annotation from cell subset to original object?](https://discourse.scverse.org/t/how-to-transfer-annotation-from-cell-subset-to-original-object/3494)

<div class="topic-metadata">

**Author:** [@maisom](https://discourse.scverse.org/u/maisom)\
**Replies:** 1\
**Last updated:** [April 10, 2025, 9:29pm UTC](https://discourse.scverse.org/t/how-to-transfer-annotation-from-cell-subset-to-original-object/3494 "2025-04-10T21:29:05Z")

</div>

Hi, I can not find an answer to this anywhere, so I create a post, hope you can help me. I am a beginner in bioinformatics and single cell analysis. I have a large dataset of immune cells from two types of tissues tha…

---

## [Lazy loading of Zarr from S3](https://discourse.scverse.org/t/lazy-loading-of-zarr-from-s3/3442)

<div class="topic-metadata">

**Author:** [@josh-gree](https://discourse.scverse.org/u/josh-gree)\
**Replies:** 3\
**Last updated:** [January 30, 2025, 5:03pm UTC](https://discourse.scverse.org/t/lazy-loading-of-zarr-from-s3/3442 "2025-01-30T17:03:43Z")

</div>

Hi wonder if anyone could help me to understand if this is possible; ad = anndata.read\_zarr('s3://foo/bar/baz.zarr') qux = ad.varm\['qux'\] Such that only qux is ever pulled from s3 - and the rest of the data is never mo…

---

## [Error reading HDF5 file in MuData/AnnData](https://discourse.scverse.org/t/error-reading-hdf5-file-in-mudata-anndata/3272)

<div class="topic-metadata">

**Author:** [@ors](https://discourse.scverse.org/u/ors)\
**Replies:** 2\
**Last updated:** [October 6, 2024, 9:20am UTC](https://discourse.scverse.org/t/error-reading-hdf5-file-in-mudata-anndata/3272 "2024-10-06T09:20:28Z")

</div>

Hi, I’m attempting to read the following CITE-seq dataset from an HDF5 file (the raw feature / cell matrix hdf5 file), but encounter an error when reading it with anndata.read\_h5ad and mudata.read\_h5mu both complaining …

---

## [How can I process anndata using multiprocessing?](https://discourse.scverse.org/t/how-can-i-process-anndata-using-multiprocessing/2537)

<div class="topic-metadata">

**Author:** [@nanu](https://discourse.scverse.org/u/nanu)\
**Replies:** 2\
**Last updated:** [September 27, 2024, 8:23am UTC](https://discourse.scverse.org/t/how-can-i-process-anndata-using-multiprocessing/2537 "2024-09-27T08:23:20Z")

</div>

I am encountering an issue when attempting to process an .h5ad file using multiprocessing. I read the .h5ad file as follows: adata=anndata.read\_h5ad("/public/home/hhl/perturb\_weak/K562\_gwps\_normalized\_singlecell\_01.h5a…

---

## [CNV scores in infercnvpy](https://discourse.scverse.org/t/cnv-scores-in-infercnvpy/2497)

<div class="topic-metadata">

**Author:** [@Ilarius](https://discourse.scverse.org/u/Ilarius)\
**Replies:** 0\
**Last updated:** [September 6, 2024, 12:57pm UTC](https://discourse.scverse.org/t/cnv-scores-in-infercnvpy/2497 "2024-09-06T12:57:54Z")

</div>

Hello, first of all I wante dto ask if the matrix in data.obsm\[”X\_cnv”\] corresponds to the slot in R: infercnv\_obj@expr.data. Secondly how are cnv scores calculated starting from this matrix by the function infercnvpy.t…

---

## [Anndata.concat(\[a,b\], join="inner") does not behave as a.concat(b)](https://discourse.scverse.org/t/anndata-concat-a-b-join-inner-does-not-behave-as-a-concat-b/2202)

<div class="topic-metadata">

**Author:** [@Fougere87](https://discourse.scverse.org/u/Fougere87)\
**Replies:** 1\
**Last updated:** [September 4, 2024, 4:31am UTC](https://discourse.scverse.org/t/anndata-concat-a-b-join-inner-does-not-behave-as-a-concat-b/2202 "2024-09-04T04:31:04Z")

</div>

Hi, I used to concatenate datasets to a reference one using the bound method a.concat(b). It was fairly handy because var were merged in an intersect fashion while obs were merged in an outer fashion, with NA added when…

---

## [Filtering out a subset of genes in adata](https://discourse.scverse.org/t/filtering-out-a-subset-of-genes-in-adata/2419)

<div class="topic-metadata">

**Author:** [@AlejandraRodelaRo](https://discourse.scverse.org/u/AlejandraRodelaRo)\
**Replies:** 3\
**Last updated:** [July 31, 2024, 10:54pm UTC](https://discourse.scverse.org/t/filtering-out-a-subset-of-genes-in-adata/2419 "2024-07-31T22:54:32Z")

</div>

Hello, I am trying to filter out a particular set of genes from a Anndata object. So far I tried: # Assuming 'adata' is your AnnData object # List of genes to remove genes\_to\_remove # Convert genes\_to\_remove to a set…

---

## [How can I load an anndata object when 'raw' was saved as a dictionary](https://discourse.scverse.org/t/how-can-i-load-an-anndata-object-when-raw-was-saved-as-a-dictionary/2356)

<div class="topic-metadata">

**Author:** [@sudoGui](https://discourse.scverse.org/u/sudoGui)\
**Replies:** 1\
**Last updated:** [July 23, 2024, 11:34pm UTC](https://discourse.scverse.org/t/how-can-i-load-an-anndata-object-when-raw-was-saved-as-a-dictionary/2356 "2024-07-23T23:34:24Z")

</div>

Pretty much what it says on the title. I saved an anndata object after integration and cell type labelling without any issues whatsoever and now when I try to load it I always get the following error: AttributeError: ‘d…

---

## [How to subset anndata variables, but still store the removed variables elsewhere for downstream analysis?](https://discourse.scverse.org/t/how-to-subset-anndata-variables-but-still-store-the-removed-variables-elsewhere-for-downstream-analysis/2398)

<div class="topic-metadata">

**Author:** [@bhavyasingh](https://discourse.scverse.org/u/bhavyasingh)\
**Replies:** 1\
**Last updated:** [July 23, 2024, 11:25pm UTC](https://discourse.scverse.org/t/how-to-subset-anndata-variables-but-still-store-the-removed-variables-elsewhere-for-downstream-analysis/2398 "2024-07-23T23:25:14Z")

</div>

Hi there! I’m analyzing single-cell and single-nucleus data. My matrix has both genes and repeat elements (TEs, such as LINEs, HERVs, etc). I want to do the QC, normalization, and scaling all together, but for the purpos…

---

## [Differences between .X, .raw.X, and .raw in anndata object](https://discourse.scverse.org/t/differences-between-x-raw-x-and-raw-in-anndata-object/1192)

<div class="topic-metadata">

**Author:** [@pmarzano97](https://discourse.scverse.org/u/pmarzano97)\
**Replies:** 6\
**Last updated:** [May 10, 2024, 5:19pm UTC](https://discourse.scverse.org/t/differences-between-x-raw-x-and-raw-in-anndata-object/1192 "2024-05-10T17:19:11Z")

</div>

Hello!!! I have a question about the different layers of an anndata object (==adata). What is the difference between .X, .raw.X, and .raw? .raw.X and .raw are the same? After the QC step, I create the layer of raw raw…

---

## [Subset on adata.uns\["X"\].var - help please!](https://discourse.scverse.org/t/subset-on-adata-uns-x-var-help-please/2262)

<div class="topic-metadata">

**Author:** [@spatts14](https://discourse.scverse.org/u/spatts14)\
**Replies:** 1\
**Last updated:** [May 8, 2024, 10:44pm UTC](https://discourse.scverse.org/t/subset-on-adata-uns-x-var-help-please/2262 "2024-05-08T22:44:18Z")

</div>

Hi, I am using an AnnData object with lots of layers. In one of the uns. layers, it has another AnnData called “drug2cell”. This drug2cell then has a .var that contains a list of drugs. I would like to subset the list o…

---

## [Subsetting anndata using genelist](https://discourse.scverse.org/t/subsetting-anndata-using-genelist/962)

<div class="topic-metadata">

**Author:** [@skoturan](https://discourse.scverse.org/u/skoturan)\
**Replies:** 4\
**Last updated:** [May 5, 2024, 4:11am UTC](https://discourse.scverse.org/t/subsetting-anndata-using-genelist/962 "2024-05-05T04:11:30Z")

</div>

Hi there, I want to subset my anndata using a list of gene names. I have about 2000 genes to extract from the original anndata. Is there a way to do this? Any suggestions/help would be much appreciated! Thanks

---

## [Help with concat](https://discourse.scverse.org/t/help-with-concat/676)

<div class="topic-metadata">

**Author:** [@johnkerl](https://discourse.scverse.org/u/johnkerl)\
**Replies:** 2\
**Last updated:** [May 1, 2024, 4:41pm UTC](https://discourse.scverse.org/t/help-with-concat/676 "2024-05-01T16:41:49Z")

</div>

The obs-wise merge is not doing what I would expect – curious how to get the desired result. Script: #!/usr/bin/env python import pandas as pd import numpy as np import anndata as ad # -------------------------------…

---

## [Managing anndata with multiple features from each gene](https://discourse.scverse.org/t/managing-anndata-with-multiple-features-from-each-gene/2223)

<div class="topic-metadata">

**Author:** [@Calibarn](https://discourse.scverse.org/u/Calibarn)\
**Replies:** 4\
**Last updated:** [April 17, 2024, 5:56pm UTC](https://discourse.scverse.org/t/managing-anndata-with-multiple-features-from-each-gene/2223 "2024-04-17T17:56:03Z")

</div>

I am working on analysis where one variable (gene) contains N number of properties. If I want any additional analysis (pca, neighbor, leiden…) to be able to factor in all values from each gene, should I: Create multipl…

---

## [Is anndata limited to 2d data?](https://discourse.scverse.org/t/is-anndata-limited-to-2d-data/1250)

<div class="topic-metadata">

**Author:** [@AlexHenderson](https://discourse.scverse.org/u/AlexHenderson)\
**Replies:** 3\
**Last updated:** [April 5, 2024, 11:38am UTC](https://discourse.scverse.org/t/is-anndata-limited-to-2d-data/1250 "2024-04-05T11:38:05Z")

</div>

Hi, Noob question, but is anndata limited to 2D data? The docs say “The group MAY contain an entry X, which MUST be either a dense or sparse array and whose shape MUST be (n\_obs, n\_var)” which is 2D. Although this is MA…

---

## [Issues setting up anndata for SCVI](https://discourse.scverse.org/t/issues-setting-up-anndata-for-scvi/2175)

<div class="topic-metadata">

**Author:** [@sallyseullee](https://discourse.scverse.org/u/sallyseullee)\
**Replies:** 2\
**Last updated:** [April 2, 2024, 11:05pm UTC](https://discourse.scverse.org/t/issues-setting-up-anndata-for-scvi/2175 "2024-04-02T23:05:48Z")

</div>

Hello scvi team, I am trying to integrate datasets using scvi in Rstudio. I used SCTransformation instead of log normalization to normalize my Seurat object. So, I extracted the RNA counts, variable features, and metada…

---

## [Merging identical genes from 10x fixed scRNA](https://discourse.scverse.org/t/merging-identical-genes-from-10x-fixed-scrna/2142)

<div class="topic-metadata">

**Author:** [@pakiessling](https://discourse.scverse.org/u/pakiessling)\
**Replies:** 3\
**Last updated:** [March 6, 2024, 6:24pm UTC](https://discourse.scverse.org/t/merging-identical-genes-from-10x-fixed-scrna/2142 "2024-03-06T18:24:21Z")

</div>

Hi, I have a perhaps unusual use-case. I am working with the ouput of cellranger multi for the new probe-based fixed single cell kit. The unfiltered raw\_feature\_bc\_matrix.h5 which I want to utilize with Cellbender and…

---

## [How to reorder adata according to sorted indices?](https://discourse.scverse.org/t/how-to-reorder-adata-according-to-sorted-indices/2109)

<div class="topic-metadata">

**Author:** [@malonzm1](https://discourse.scverse.org/u/malonzm1)\
**Replies:** 4\
**Last updated:** [February 27, 2024, 6:24pm UTC](https://discourse.scverse.org/t/how-to-reorder-adata-according-to-sorted-indices/2109 "2024-02-27T18:24:05Z")

</div>

Hi, I would like to sort the indices of my adata and reorder the adata according to the sorted indices then save it as a scanpy object. I tried the following: adata = sc.read\_h5ad(filename='result.h5ad') nindex = adata…

---

## [Cannot modify AnnData object](https://discourse.scverse.org/t/cannot-modify-anndata-object/2073)

<div class="topic-metadata">

**Author:** [@mduvina](https://discourse.scverse.org/u/mduvina)\
**Replies:** 2\
**Last updated:** [February 16, 2024, 3:42pm UTC](https://discourse.scverse.org/t/cannot-modify-anndata-object/2073 "2024-02-16T15:42:02Z")

</div>

Hi, I have a strange problem with the AnnData object. I can’t seem to modify any of the fields. adata = sc.read\_10x\_h5(file) adata.var\_names\_make\_unique() AnnData object with n\_obs × n\_vars = 6185 × 32285 var: ‘g…

[Next page](https://discourse.scverse.org/c/help/anndata/36.md?page=1)
