# anndata

**URL:** https://discourse.scverse.org/c/help/anndata/36.md?page=1

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

**Page:** 2

---

## [Bus error when writing concatenated adata](https://discourse.scverse.org/t/bus-error-when-writing-concatenated-adata/2020)

<div class="topic-metadata">

**Author:** [@malonzm1](https://discourse.scverse.org/u/malonzm1)\
**Replies:** 1\
**Last updated:** [January 26, 2024, 2:57pm UTC](https://discourse.scverse.org/t/bus-error-when-writing-concatenated-adata/2020 "2024-01-26T14:57:45Z")

</div>

Hi, When I try to write my concatenated adata (adata.write\_h5ad(filename='10x\_outer.h5ad')), I run into Bus error. For the concatenation, I use join=‘outer’. When I use join=‘inner’, I get no problems. The dataset is n…

---

## [Var counts 0 after gene filtering](https://discourse.scverse.org/t/var-counts-0-after-gene-filtering/2024)

<div class="topic-metadata">

**Author:** [@geekoala](https://discourse.scverse.org/u/geekoala)\
**Replies:** 1\
**Last updated:** [January 25, 2024, 9:29pm UTC](https://discourse.scverse.org/t/var-counts-0-after-gene-filtering/2024 "2024-01-25T21:29:49Z")

</div>

Hello, I am pretty new to scanpy so it is probably a simple question. When I try to read data downloaded from GEO: GSE217930 . All my adata.var have the same gene\_ids and when I try to filter genes I get n\_vars=0. How c…

---

## [Converting view of a backed anndata object into non-view/non-backed](https://discourse.scverse.org/t/converting-view-of-a-backed-anndata-object-into-non-view-non-backed/1885)

<div class="topic-metadata">

**Author:** [@deto](https://discourse.scverse.org/u/deto)\
**Replies:** 2\
**Last updated:** [January 16, 2024, 4:36am UTC](https://discourse.scverse.org/t/converting-view-of-a-backed-anndata-object-into-non-view-non-backed/1885 "2024-01-16T04:36:59Z")

</div>

What is the preferred way to load only a subset of cells into an anndata in memory? The workflow I’m thinking of is: Load anndata object as backed Based on .obs table, select a subset of genes Load only that subset in…

---

## [Counts in layers is zero after ad.concat](https://discourse.scverse.org/t/counts-in-layers-is-zero-after-ad-concat/1999)

<div class="topic-metadata">

**Author:** [@malonzm1](https://discourse.scverse.org/u/malonzm1)\
**Replies:** 2\
**Last updated:** [January 15, 2024, 9:45am UTC](https://discourse.scverse.org/t/counts-in-layers-is-zero-after-ad-concat/1999 "2024-01-15T09:45:33Z")

</div>

Hi, I filter each dataset before ad.concat: sc.pp.filter\_genes(adata, min\_cells = 3) sc.pp.filter\_cells(adata, min\_genes = 200) sc.pp.filter\_cells(adata, min\_counts = 200) I also tried sc.pp.filter\_cells(adata, min\_c…

---

## [Sorting annData object by observations or variables?](https://discourse.scverse.org/t/sorting-anndata-object-by-observations-or-variables/1345)

<div class="topic-metadata">

**Author:** [@Axel](https://discourse.scverse.org/u/Axel)\
**Replies:** 1\
**Last updated:** [January 10, 2024, 10:12pm UTC](https://discourse.scverse.org/t/sorting-anndata-object-by-observations-or-variables/1345 "2024-01-10T22:12:00Z")

</div>

Hello Everybody, I’m just getting into using anndata and I wonder if there is a way to sort the rows (observations) or columns (variables) of an anndata object? I searched for it, but couldn’t find anything. Any ideas a…

---

## [Remove samples/rows from anndata](https://discourse.scverse.org/t/remove-samples-rows-from-anndata/959)

<div class="topic-metadata">

**Author:** [@jamesmo](https://discourse.scverse.org/u/jamesmo)\
**Replies:** 5\
**Last updated:** [January 9, 2024, 5:02am UTC](https://discourse.scverse.org/t/remove-samples-rows-from-anndata/959 "2024-01-09T05:02:20Z")

</div>

I can see how to remove columns from anndata ie keep = \['a','b','c'\] adata = adata \[:, keep\] How does one remove rows/sets of samples from anndata.obs and anndata.x? for example remove adata.obs\[Region='reg012'\] ada…

---

## [Error in Atlas-level-integration-of-lung-data Tutorial](https://discourse.scverse.org/t/error-in-atlas-level-integration-of-lung-data-tutorial/1849)

<div class="topic-metadata">

**Author:** [@jenny.smith](https://discourse.scverse.org/u/jenny.smith)\
**Replies:** 4\
**Last updated:** [November 1, 2023, 11:34pm UTC](https://discourse.scverse.org/t/error-in-atlas-level-integration-of-lung-data-tutorial/1849 "2023-11-01T23:34:39Z")

</div>

Hello, I am running though the tutorial in the SCANVI docs for Atlas level Lung Data. I’ve create the environment using conda/mamba and I am running this on MacOS Ventura 13.4. I downloaded the example dataset and hav…

---

## [Spliced counts scvelo](https://discourse.scverse.org/t/spliced-counts-scvelo/1707)

<div class="topic-metadata">

**Author:** [@thamsepia](https://discourse.scverse.org/u/thamsepia)\
**Replies:** 1\
**Last updated:** [August 23, 2023, 12:46pm UTC](https://discourse.scverse.org/t/spliced-counts-scvelo/1707 "2023-08-23T12:46:29Z")

</div>

I have an Anndata object as follows AnnData object with n\_obs × n\_vars = 11569 × 3000 obs: ‘barcodes’, ‘sample’, ‘species’, ‘gene\_count’, ‘tscp\_count’, ‘mread\_count’, ‘bc1\_well’, ‘bc2\_well’, ‘bc3\_well’, ‘bc1\_wind’, ‘bc…

---

## [Is it possible to add 2 or more datasets to a single anndata object?](https://discourse.scverse.org/t/is-it-possible-to-add-2-or-more-datasets-to-a-single-anndata-object/1589)

<div class="topic-metadata">

**Author:** [@Noarzel](https://discourse.scverse.org/u/Noarzel)\
**Replies:** 0\
**Last updated:** [July 6, 2023, 3:14pm UTC](https://discourse.scverse.org/t/is-it-possible-to-add-2-or-more-datasets-to-a-single-anndata-object/1589 "2023-07-06T15:14:14Z")

</div>

Hello there ! Maybe a dumb question but I’m working with 3 different datasets, a gene expression one, a methylation one and a metadata one. The thing is, there’s just like 9% of the samples that are common to both gene…

---

## [How to add additional metadata on multiple different single cell RNA files from different experiments, such as organ, sample number etc](https://discourse.scverse.org/t/how-to-add-additional-metadata-on-multiple-different-single-cell-rna-files-from-different-experiments-such-as-organ-sample-number-etc/533)

<div class="topic-metadata">

**Author:** [@Echoo-ranger](https://discourse.scverse.org/u/Echoo-ranger)\
**Replies:** 1\
**Last updated:** [June 8, 2022, 3:40pm UTC](https://discourse.scverse.org/t/how-to-add-additional-metadata-on-multiple-different-single-cell-rna-files-from-different-experiments-such-as-organ-sample-number-etc/533 "2022-06-08T15:40:49Z")

</div>

I am handling a number of cell ranger output files from different experiments and integrating them to together. I think Integration is just reading all the files in a for loop and concatenating them. But the issue I am …

---

## [How to add metadata from csv file to concatenated anndata object?](https://discourse.scverse.org/t/how-to-add-metadata-from-csv-file-to-concatenated-anndata-object/1519)

<div class="topic-metadata">

**Author:** [@martimis](https://discourse.scverse.org/u/martimis)\
**Replies:** 0\
**Last updated:** [June 15, 2023, 8:36am UTC](https://discourse.scverse.org/t/how-to-add-metadata-from-csv-file-to-concatenated-anndata-object/1519 "2023-06-15T08:36:23Z")

</div>

Hi, I have a large concatenated anndata object (15 samples) where I want to add columns of metadata. I have so far done it in a very long-written way as I show below: # list of all sample id's sampleid\_list = \['A', 'B'…

---

## [Is the AnnData summary graphic in the documentation/Fig 1A of the Virshup, et al. bioRxiv pre-print creative commons license?](https://discourse.scverse.org/t/is-the-anndata-summary-graphic-in-the-documentation-fig-1a-of-the-virshup-et-al-biorxiv-pre-print-creative-commons-license/1349)

<div class="topic-metadata">

**Author:** [@nkuehnle](https://discourse.scverse.org/u/nkuehnle)\
**Replies:** 0\
**Last updated:** [April 25, 2023, 10:54pm UTC](https://discourse.scverse.org/t/is-the-anndata-summary-graphic-in-the-documentation-fig-1a-of-the-virshup-et-al-biorxiv-pre-print-creative-commons-license/1349 "2023-04-25T22:54:16Z")

</div>

Hi, I’ve been using scverse for single cell analysis for a year or two now and I’m a huge fan of the anndata API. I’m messing around with some NLP right now and decided to employ anndata in the process and was thinking …

---

## [Removing an AnnData Object from Memory](https://discourse.scverse.org/t/removing-an-anndata-object-from-memory/1163)

<div class="topic-metadata">

**Author:** [@danamcc](https://discourse.scverse.org/u/danamcc)\
**Replies:** 1\
**Last updated:** [April 25, 2023, 10:43pm UTC](https://discourse.scverse.org/t/removing-an-anndata-object-from-memory/1163 "2023-04-25T22:43:21Z")

</div>

Hi, I am making a loop on jupyter that runs sc.rank\_genes\_groups on a subset anndata of a larger anndata object, deletes the temporary smaller object, and returns stats. Despite putting ‘del adata’, the memory allocati…

---

## [Can’t change anndata dimensions](https://discourse.scverse.org/t/can-t-change-anndata-dimensions/1146)

<div class="topic-metadata">

**Author:** [@crhodes](https://discourse.scverse.org/u/crhodes)\
**Replies:** 6\
**Last updated:** [March 9, 2023, 6:06pm UTC](https://discourse.scverse.org/t/can-t-change-anndata-dimensions/1146 "2023-03-09T18:06:38Z")

</div>

From https://scanpy.discourse.group/t/cant-change-anndata-dimensions/519/1: Hello I clustered some cells using the top 3000 genes with the highest variance, removed some cell types I am not interested in and now I wan…

---

## [Avoiding AnnData.file.\_adata self-reference?](https://discourse.scverse.org/t/avoiding-anndata-file-adata-self-reference/1097)

<div class="topic-metadata">

**Author:** [@jggatter](https://discourse.scverse.org/u/jggatter)\
**Replies:** 1\
**Last updated:** [February 6, 2023, 11:05am UTC](https://discourse.scverse.org/t/avoiding-anndata-file-adata-self-reference/1097 "2023-02-06T11:05:54Z")

</div>

Hello, I’m trying to use AnnData objects in my Prefect workflows. Prefect uses FastAPI and its jsonable\_encoder to pass Python objects to workflows and subworkflows. Unfortunately, I believe my AnnData objects are not J…

---

## [Adata.obs entries for specific layers](https://discourse.scverse.org/t/adata-obs-entries-for-specific-layers/1069)

<div class="topic-metadata">

**Author:** [@mkarikom](https://discourse.scverse.org/u/mkarikom)\
**Replies:** 2\
**Last updated:** [January 26, 2023, 5:26pm UTC](https://discourse.scverse.org/t/adata-obs-entries-for-specific-layers/1069 "2023-01-26T17:26:19Z")

</div>

Does the anndata/scanpy API provide layer-specific masking for adata.obs? Alternatively, is there something like adata.layers\['mylayer'\].obs?

---

## [Anndata.write fails with "object header message is too large"](https://discourse.scverse.org/t/anndata-write-fails-with-object-header-message-is-too-large/608)

<div class="topic-metadata">

**Author:** [@valehvpa](https://discourse.scverse.org/u/valehvpa)\
**Replies:** 3\
**Last updated:** [January 26, 2023, 9:10am UTC](https://discourse.scverse.org/t/anndata-write-fails-with-object-header-message-is-too-large/608 "2023-01-26T09:10:42Z")

</div>

Hi. I’m trying to .write() an anndata object where I have a large dataframe (8869 columns) in the obsm attribute (adata.obsm\["my\_key"\] = large\_df). The write call fails with: RuntimeError: Unable to create attribute (o…

---

## [How to create a layer over a subset of .obs or .vars?](https://discourse.scverse.org/t/how-to-create-a-layer-over-a-subset-of-obs-or-vars/1070)

<div class="topic-metadata">

**Author:** [@mkarikom](https://discourse.scverse.org/u/mkarikom)\
**Replies:** 1\
**Last updated:** [January 20, 2023, 1:06pm UTC](https://discourse.scverse.org/t/how-to-create-a-layer-over-a-subset-of-obs-or-vars/1070 "2023-01-20T13:06:32Z")

</div>

I’m using the MultiVI framework for multiomic data which defines modality as a column in adata.var. However, I need to track certain modality-specific transformations in the same multimodal anndata object. But the API …

---

## [Adata gene intersection problem](https://discourse.scverse.org/t/adata-gene-intersection-problem/1029)

<div class="topic-metadata">

**Author:** [@navyhoody](https://discourse.scverse.org/u/navyhoody)\
**Replies:** 0\
**Last updated:** [January 2, 2023, 7:49am UTC](https://discourse.scverse.org/t/adata-gene-intersection-problem/1029 "2023-01-02T07:49:34Z")

</div>

module12=pd.read\_table(‘/Users/mojaeu/Desktop/303\_length\_genes.txt’) #only gene names len(module12)=303 ya12=list(module12.Gene.values) wcc=set(data\_lung.var\_names).intersection(ya12) data\_lung\_edit = data\_lung\[:,li…

---

## [Anndata.concatenate() with two 10x multiome datasets?](https://discourse.scverse.org/t/anndata-concatenate-with-two-10x-multiome-datasets/989)

<div class="topic-metadata">

**Author:** [@mkarikom](https://discourse.scverse.org/u/mkarikom)\
**Replies:** 2\
**Last updated:** [December 29, 2022, 6:10pm UTC](https://discourse.scverse.org/t/anndata-concatenate-with-two-10x-multiome-datasets/989 "2022-12-29T18:10:33Z")

</div>

I have a 10x Multiome data set (GSE199994) and ran scvi.data.read\_10x\_multiome() on each of 10 batches (1 batch per patient). But when I try adataconcat = adata1.concatenate(adata2), the issue seems to be that there are…

---

## [How to concatenate anndata properly?](https://discourse.scverse.org/t/how-to-concatenate-anndata-properly/887)

<div class="topic-metadata">

**Author:** [@cookiemonster](https://discourse.scverse.org/u/cookiemonster)\
**Replies:** 2\
**Last updated:** [November 3, 2022, 8:13pm UTC](https://discourse.scverse.org/t/how-to-concatenate-anndata-properly/887 "2022-11-03T20:13:43Z")

</div>

I have 4 samples data trying to do batch effect cleaning but when I try to concatenate them it comes out like this sc.pp.filter\_genes(adata1, min\_cells =1) sc.pp.filter\_genes(adata2, min\_cells =1) sc.pp.filter\_genes(a…

---

## [Disable AnnData Warnings](https://discourse.scverse.org/t/disable-anndata-warnings/847)

<div class="topic-metadata">

**Author:** [@mdylan2](https://discourse.scverse.org/u/mdylan2)\
**Replies:** 1\
**Last updated:** [October 21, 2022, 8:25pm UTC](https://discourse.scverse.org/t/disable-anndata-warnings/847 "2022-10-21T20:25:50Z")

</div>

Is there any way to do this? It’s getting in the way of me developing nice progress bars using tqdm

---

## [Concatenate 4 anndata objects](https://discourse.scverse.org/t/concatenate-4-anndata-objects/792)

<div class="topic-metadata">

**Author:** [@nit29sin](https://discourse.scverse.org/u/nit29sin)\
**Replies:** 1\
**Last updated:** [October 4, 2022, 12:46pm UTC](https://discourse.scverse.org/t/concatenate-4-anndata-objects/792 "2022-10-04T12:46:40Z")

</div>

How can I concatenate 4 .loom files? I have 4 loom files converted to anndata (an1, an2, an3, an4) , how can I concatenate them?

---

## [Build a large anndata object column by colum](https://discourse.scverse.org/t/build-a-large-anndata-object-column-by-colum/785)

<div class="topic-metadata">

**Author:** [@SilasK](https://discourse.scverse.org/u/SilasK)\
**Replies:** 1\
**Last updated:** [September 29, 2022, 11:09am UTC](https://discourse.scverse.org/t/build-a-large-anndata-object-column-by-colum/785 "2022-09-29T11:09:08Z")

</div>

Hello, I have mappin results for \>1K samples and \>1B genes. when I load a pandas data frame into memory it is about 1GB per sample. Hence to load all samples into memory will not be possible. Is there a way to build a …

---

## [How to isolate individual gene expression values within a cluster?](https://discourse.scverse.org/t/how-to-isolate-individual-gene-expression-values-within-a-cluster/722)

<div class="topic-metadata">

**Author:** [@dub2s](https://discourse.scverse.org/u/dub2s)\
**Replies:** 3\
**Last updated:** [September 14, 2022, 1:48pm UTC](https://discourse.scverse.org/t/how-to-isolate-individual-gene-expression-values-within-a-cluster/722 "2022-09-14T13:48:22Z")

</div>

After clustering the data using scanpy, is it possible to extract list of genes alongwith their expression values from within a cluster ? Basically, I want to see the expression of a particular gene among the different c…

---

## [AnnData X memory layout](https://discourse.scverse.org/t/anndata-x-memory-layout/702)

<div class="topic-metadata">

**Author:** [@jeskowagner](https://discourse.scverse.org/u/jeskowagner)\
**Replies:** 6\
**Last updated:** [August 29, 2022, 5:43pm UTC](https://discourse.scverse.org/t/anndata-x-memory-layout/702 "2022-08-29T17:43:06Z")

</div>

Hi, I could imagine this is a question for @ivirshup, but happy for any answer. Specifically, I was wondering about the memory layout of data stored in the AnnData.X slot. My understanding is that, on-disk, data is sto…

---

## [Concatenate anndata with merged rows](https://discourse.scverse.org/t/concatenate-anndata-with-merged-rows/665)

<div class="topic-metadata">

**Author:** [@bcorrie](https://discourse.scverse.org/u/bcorrie)\
**Replies:** 0\
**Last updated:** [August 5, 2022, 7:56pm UTC](https://discourse.scverse.org/t/concatenate-anndata-with-merged-rows/665 "2022-08-05T19:56:15Z")

</div>

I have two anndata objects read in from two different sources: prop1 prop2 prop3 cell1 1.0 0.0 1.0 cell2 0.0 2.0 0.0 prop4 prop5 prop6 cell4 4.0 0.0 0.0 cell5 0.0 5.0 …

---

## [Subsetting Anndata based on Multiple Marker Gene Expression Thresholds](https://discourse.scverse.org/t/subsetting-anndata-based-on-multiple-marker-gene-expression-thresholds/616)

<div class="topic-metadata">

**Author:** [@kparakul](https://discourse.scverse.org/u/kparakul)\
**Replies:** 0\
**Last updated:** [July 12, 2022, 1:35pm UTC](https://discourse.scverse.org/t/subsetting-anndata-based-on-multiple-marker-gene-expression-thresholds/616 "2022-07-12T13:35:59Z")

</div>

I am currently trying to subset my anndata based on the expression of any one of multiple marker genes. However I am having two separate issues in being able to do so. Firstly, I noticed in a prior post someone mentione…

---

## [\[loom\] Why is adata.layers.matrix stored as float?](https://discourse.scverse.org/t/loom-why-is-adata-layers-matrix-stored-as-float/549)

<div class="topic-metadata">

**Author:** [@natalia.nutella](https://discourse.scverse.org/u/natalia.nutella)\
**Replies:** 1\
**Last updated:** [June 17, 2022, 12:17pm UTC](https://discourse.scverse.org/t/loom-why-is-adata-layers-matrix-stored-as-float/549 "2022-06-17T12:17:38Z")

</div>

rep1\_loom = sc.read('../velocyto\_outputs/rep1/possorted\_genome\_bam\_5NXZV.loom', cache=True) I have not normalized the raw data. However, when I try to run: sc.pp.highly\_variable\_genes(rep1\_loom, flav…

---

## [How to make and save the subset of a specific cluster of the data?](https://discourse.scverse.org/t/how-to-make-and-save-the-subset-of-a-specific-cluster-of-the-data/539)

<div class="topic-metadata">

**Author:** [@yingyuan830](https://discourse.scverse.org/u/yingyuan830)\
**Replies:** 2\
**Last updated:** [June 16, 2022, 10:25pm UTC](https://discourse.scverse.org/t/how-to-make-and-save-the-subset-of-a-specific-cluster-of-the-data/539 "2022-06-16T22:25:38Z")

</div>

I’d like to extract and save the subset of a specific cluster data from the original data, but didn’t find relevant functions, could you please help me ? Thanks

[Previous page](https://discourse.scverse.org/c/help/anndata/36.md)

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