# scanpy

**URL:** https://discourse.scverse.org/c/help/scanpy/37.md?page=3

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

**Page:** 4

---

## [Run scanpy.pp.neighbors and UMAP on a different layer other than X?](https://discourse.scverse.org/t/run-scanpy-pp-neighbors-and-umap-on-a-different-layer-other-than-x/1791)

<div class="topic-metadata">

**Author:** [@singhbhavya](https://discourse.scverse.org/u/singhbhavya)\
**Replies:** 2\
**Last updated:** [October 11, 2023, 6:28pm UTC](https://discourse.scverse.org/t/run-scanpy-pp-neighbors-and-umap-on-a-different-layer-other-than-x/1791 "2023-10-11T18:28:36Z")

</div>

Hi there! I apologize if my question is naive. I am new to not only Python, but also to anndata and spatial analysis in general. I had an original anndata object with 12 variables - this data pertains to spatially barco…

---

## [Specify prefix with regular expression in scanpy.read\_10x\_mtx()](https://discourse.scverse.org/t/specify-prefix-with-regular-expression-in-scanpy-read-10x-mtx/1789)

<div class="topic-metadata">

**Author:** [@hmnzo5gy](https://discourse.scverse.org/u/hmnzo5gy)\
**Replies:** 0\
**Last updated:** [October 2, 2023, 4:56pm UTC](https://discourse.scverse.org/t/specify-prefix-with-regular-expression-in-scanpy-read-10x-mtx/1789 "2023-10-02T16:56:21Z")

</div>

The input files have the following name pattern 'gsm123\_sample1\_barcodes.tsv.gz' 'gs123\_sample1\_features.tsv.gz' 'gsm123\_sample1\_matrix.mtx.gz' Is there a way for me to use regex to specify the prefix pattern ‘text\_tex…

---

## [How to ScanPy cluster already CPM normalized/log transformed data?](https://discourse.scverse.org/t/how-to-scanpy-cluster-already-cpm-normalized-log-transformed-data/468)

<div class="topic-metadata">

**Author:** [@NeuronNewton](https://discourse.scverse.org/u/NeuronNewton)\
**Replies:** 6\
**Last updated:** [October 1, 2023, 4:01pm UTC](https://discourse.scverse.org/t/how-to-scanpy-cluster-already-cpm-normalized-log-transformed-data/468 "2023-10-01T16:01:07Z")

</div>

Hello! I have a publicly available dataset from Smart Seq2 scRNA seq run that i would like to cluster in ScanPy. The file contains already CPM normalized and log(CPM+1) transformed data, not raw counts. How could i tel…

---

## [Expression\_cutoff optiion from scanpy.pl.dotplot function](https://discourse.scverse.org/t/expression-cutoff-optiion-from-scanpy-pl-dotplot-function/1786)

<div class="topic-metadata">

**Author:** [@fadhlyemen](https://discourse.scverse.org/u/fadhlyemen)\
**Replies:** 0\
**Last updated:** [September 28, 2023, 5:05pm UTC](https://discourse.scverse.org/t/expression-cutoff-optiion-from-scanpy-pl-dotplot-function/1786 "2023-09-28T17:05:16Z")

</div>

I have a question regarding the expression\_cutoff option from scanpy.pl.dotplot function. when and when not I should use this threshold? I got different results when I set a threshold. Thank you

---

## [Gene shows up in dotplot, but it's not present in var\_names](https://discourse.scverse.org/t/gene-shows-up-in-dotplot-but-its-not-present-in-var-names/1762)

<div class="topic-metadata">

**Author:** [@aindap](https://discourse.scverse.org/u/aindap)\
**Replies:** 1\
**Last updated:** [September 16, 2023, 5:54am UTC](https://discourse.scverse.org/t/gene-shows-up-in-dotplot-but-its-not-present-in-var-names/1762 "2023-09-16T05:54:45Z")

</div>

Hi I am still relatively new to scanpy. I am having trouble understanding the sc.pl.dotplot output. When I read in my h5ad file and check if a gene is present, it yields false: adata = sc.read(file.h5ad) 'CEACAM8' in …

---

## [Normalization on rpkm data](https://discourse.scverse.org/t/normalization-on-rpkm-data/1750)

<div class="topic-metadata">

**Author:** [@ngvananh2508](https://discourse.scverse.org/u/ngvananh2508)\
**Replies:** 0\
**Last updated:** [September 11, 2023, 5:49am UTC](https://discourse.scverse.org/t/normalization-on-rpkm-data/1750 "2023-09-11T05:49:38Z")

</div>

I had an rpkm data. Can I use scanpy.normalize\_total() on it? Or I just go ahead to the next step and dont need to do normalization anymore? Thank you very much for helping me!

---

## [Error when draw UMAP: object has no attribute 'get\_cmap'](https://discourse.scverse.org/t/error-when-draw-umap-object-has-no-attribute-get-cmap/1726)

<div class="topic-metadata">

**Author:** [@egoecho](https://discourse.scverse.org/u/egoecho)\
**Replies:** 4\
**Last updated:** [September 5, 2023, 7:29am UTC](https://discourse.scverse.org/t/error-when-draw-umap-object-has-no-attribute-get-cmap/1726 "2023-09-05T07:29:53Z")

</div>

Error occurs when I draw UMAP using sc.pl.umap(). Version: Python 3.9.7 scanpy 1.9.4 Run in Jupyter import scanpy as sc adata = sc.datasets.pbmc68k\_reduced() sc.pl.umap(adata) Output ------------------------------…

---

## [Set dtype to np.float32 and memory conservation](https://discourse.scverse.org/t/set-dtype-to-np-float32-and-memory-conservation/1734)

<div class="topic-metadata">

**Author:** [@malonzm1](https://discourse.scverse.org/u/malonzm1)\
**Replies:** 0\
**Last updated:** [September 1, 2023, 1:34am UTC](https://discourse.scverse.org/t/set-dtype-to-np-float32-and-memory-conservation/1734 "2023-09-01T01:34:21Z")

</div>

Hi, I am trying to analyze a huge scRNA-seq dataset. When I concatenate the datasets I get a memory low error even though I’m already using 1024Gb. As a way of conserving memory, I was wondering if I can set the datatyp…

---

## [Comparing number of differentially expressed genes (DEGs)](https://discourse.scverse.org/t/comparing-number-of-differentially-expressed-genes-degs/1730)

<div class="topic-metadata">

**Author:** [@Simon](https://discourse.scverse.org/u/Simon)\
**Replies:** 0\
**Last updated:** [August 31, 2023, 11:37am UTC](https://discourse.scverse.org/t/comparing-number-of-differentially-expressed-genes-degs/1730 "2023-08-31T11:37:08Z")

</div>

Hi, Is it valid to compare multiple cell types by looking at the number of DEGs with q\<0.05 between two conditions? Can this tell us which cell type shows the strongest effect? For example, this was done in Allen et al…

---

## [Why scanpy computes HVGs based on the data after log1p?](https://discourse.scverse.org/t/why-scanpy-computes-hvgs-based-on-the-data-after-log1p/1717)

<div class="topic-metadata">

**Author:** [@caodudu](https://discourse.scverse.org/u/caodudu)\
**Replies:** 0\
**Last updated:** [August 28, 2023, 1:16pm UTC](https://discourse.scverse.org/t/why-scanpy-computes-hvgs-based-on-the-data-after-log1p/1717 "2023-08-28T13:16:20Z")

</div>

I find that Seurat computes HVGs based on the raw count matrix though the step is designed to be implemented after NormalizeData function. The structure of Seurat object can store the raw count matrix in a fixed location…

---

## [Customizing Dendrogram and Cluster Names Placement in sc.pl.matrixplot](https://discourse.scverse.org/t/customizing-dendrogram-and-cluster-names-placement-in-sc-pl-matrixplot/1695)

<div class="topic-metadata">

**Author:** [@elj](https://discourse.scverse.org/u/elj)\
**Replies:** 0\
**Last updated:** [August 18, 2023, 12:24pm UTC](https://discourse.scverse.org/t/customizing-dendrogram-and-cluster-names-placement-in-sc-pl-matrixplot/1695 "2023-08-18T12:24:16Z")

</div>

Dear Scanpy Team, I’ve been working with the sc.pl.matrixplot function to visualize my data. I have a specific requirement regarding the placement of the dendrogram and cluster names in the matrix plot, both on the same…

---

## [How can I adjust the legend in the Scanpy dotplot?](https://discourse.scverse.org/t/how-can-i-adjust-the-legend-in-the-scanpy-dotplot/1680)

<div class="topic-metadata">

**Author:** [@minykim97](https://discourse.scverse.org/u/minykim97)\
**Replies:** 0\
**Last updated:** [August 14, 2023, 5:18am UTC](https://discourse.scverse.org/t/how-can-i-adjust-the-legend-in-the-scanpy-dotplot/1680 "2023-08-14T05:18:08Z")

</div>

In the Scanpy dotplot , the dots of the legend, which means fraction of cell in group, overlap each other. How can I fix this part?

---

## [Missing pre-processed dataset in h5ad format (scanorama tutorial)](https://discourse.scverse.org/t/missing-pre-processed-dataset-in-h5ad-format-scanorama-tutorial/1675)

<div class="topic-metadata">

**Author:** [@5primebits](https://discourse.scverse.org/u/5primebits)\
**Replies:** 0\
**Last updated:** [August 8, 2023, 10:42pm UTC](https://discourse.scverse.org/t/missing-pre-processed-dataset-in-h5ad-format-scanorama-tutorial/1675 "2023-08-08T22:42:34Z")

</div>

Does anyone have the preprocessed data available from the “Integrating spatial data with scRNA-seq using scanorama” tutorial? It’s from this section of the tutorial and this is the broken link. Thanks.

---

## [Extracting genes unique to only one cluster/cell type](https://discourse.scverse.org/t/extracting-genes-unique-to-only-one-cluster-cell-type/1669)

<div class="topic-metadata">

**Author:** [@mgelm](https://discourse.scverse.org/u/mgelm)\
**Replies:** 0\
**Last updated:** [August 7, 2023, 3:37pm UTC](https://discourse.scverse.org/t/extracting-genes-unique-to-only-one-cluster-cell-type/1669 "2023-08-07T15:37:19Z")

</div>

Hello! Is there a way to extract a list of genes that are only expressed in one cluster or one cell? I’m not interested in differentially expressed ones, but all genes which are unique to one cluster or cell. Many than…

---

## [How to retain gene only present/mapped in one of the dataset before integration?](https://discourse.scverse.org/t/how-to-retain-gene-only-present-mapped-in-one-of-the-dataset-before-integration/1653)

<div class="topic-metadata">

**Author:** [@dub2s](https://discourse.scverse.org/u/dub2s)\
**Replies:** 0\
**Last updated:** [August 1, 2023, 2:48pm UTC](https://discourse.scverse.org/t/how-to-retain-gene-only-present-mapped-in-one-of-the-dataset-before-integration/1653 "2023-08-01T14:48:58Z")

</div>

Hii all I am integrating 4-5 datasets, all belonging to mouse. One of the datasets has a gene, “eGFP”, which is not present in other datasets. By the term “not present”, I mean to say that only one of the datasets was a…

---

## [Apply sc.pp.highly\_variable\_genes to SCT-normalized residuals or counts](https://discourse.scverse.org/t/apply-sc-pp-highly-variable-genes-to-sct-normalized-residuals-or-counts/1642)

<div class="topic-metadata">

**Author:** [@Holly](https://discourse.scverse.org/u/Holly)\
**Replies:** 0\
**Last updated:** [July 27, 2023, 10:52pm UTC](https://discourse.scverse.org/t/apply-sc-pp-highly-variable-genes-to-sct-normalized-residuals-or-counts/1642 "2023-07-27T22:52:44Z")

</div>

Can the scanpy team answer this questions? To integrate multiple datasets, I have applied SCT-normalization followed by harmony using Seurat. Then, I applied scanpy for the downstream analysis. After filtering out unwan…

---

## [How to find HVG in Seurat-integrated data?](https://discourse.scverse.org/t/how-to-find-hvg-in-seurat-integrated-data/706)

<div class="topic-metadata">

**Author:** [@pavsol](https://discourse.scverse.org/u/pavsol)\
**Replies:** 1\
**Last updated:** [July 27, 2023, 10:42pm UTC](https://discourse.scverse.org/t/how-to-find-hvg-in-seurat-integrated-data/706 "2023-07-27T22:42:32Z")

</div>

Hi, I am working with the dataset integrated with Seurat using CCA integration pipeline employing SCTranform. I do downstream analysis with a python-based tool and I need to extract highly variable genes from the integr…

---

## [Error scanpy pbmc data](https://discourse.scverse.org/t/error-scanpy-pbmc-data/542)

<div class="topic-metadata">

**Author:** [@rexneal](https://discourse.scverse.org/u/rexneal)\
**Replies:** 4\
**Last updated:** [July 25, 2023, 10:40pm UTC](https://discourse.scverse.org/t/error-scanpy-pbmc-data/542 "2023-07-25T22:40:58Z")

</div>

I am a newbie to scanpy. It seems to be a wonderful program. I am working through the tutuoial:Preprocessing and clustering 3k PBMCs — Scanpy documentation I get the following error message: tl.paga(adata) pl.paga(ad…

---

## [Best pre-processing steps for sc.tl.ingest()?](https://discourse.scverse.org/t/best-pre-processing-steps-for-sc-tl-ingest/1628)

<div class="topic-metadata">

**Author:** [@JuliaChristiaanse](https://discourse.scverse.org/u/JuliaChristiaanse)\
**Replies:** 0\
**Last updated:** [July 20, 2023, 3:20pm UTC](https://discourse.scverse.org/t/best-pre-processing-steps-for-sc-tl-ingest/1628 "2023-07-20T15:20:40Z")

</div>

Hi everyone, I have two questions regarding the pre-processing for the ingest tool of scanpy. I want to use sc.tl.ingest() to map celltype labels from a reference dataset to my “query” dataset. This will be done per ce…

---

## [I am getting an error with sc.pp.neighbours()](https://discourse.scverse.org/t/i-am-getting-an-error-with-sc-pp-neighbours/1594)

<div class="topic-metadata">

**Author:** [@devilliersruan](https://discourse.scverse.org/u/devilliersruan)\
**Replies:** 0\
**Last updated:** [July 10, 2023, 9:19am UTC](https://discourse.scverse.org/t/i-am-getting-an-error-with-sc-pp-neighbours/1594 "2023-07-10T09:19:18Z")

</div>

Hi. I am very unfamiliar with python still, and just wanted to try out muon to compare the integration method with what I’ve achieved in R’s Harmony. I get an error when running sc.pp.neighbours: \>\>\> sc.pp.neighbors(rna…

---

## [Regressing out variables in pearson residual normalization](https://discourse.scverse.org/t/regressing-out-variables-in-pearson-residual-normalization/892)

<div class="topic-metadata">

**Author:** [@jay](https://discourse.scverse.org/u/jay)\
**Replies:** 2\
**Last updated:** [July 7, 2023, 3:00pm UTC](https://discourse.scverse.org/t/regressing-out-variables-in-pearson-residual-normalization/892 "2023-07-07T15:00:35Z")

</div>

Hello! I was looking into normalizing my single cell data using the Pearson Residual method in the experimental API. However, previously I regressed out mitochondrial & cell cycle differences in Seurat with SCTransform …

---

## [CITEsq loading in RNA and ADT data](https://discourse.scverse.org/t/citesq-loading-in-rna-and-adt-data/1423)

<div class="topic-metadata">

**Author:** [@pouria](https://discourse.scverse.org/u/pouria)\
**Replies:** 4\
**Last updated:** [July 6, 2023, 2:17pm UTC](https://discourse.scverse.org/t/citesq-loading-in-rna-and-adt-data/1423 "2023-07-06T14:17:40Z")

</div>

Hello everyone, I’m in to process of learning single cell analysis. Thus far I’ve within my first week made good progress in analysing single cell data by using Scanpy. However I’ve hade som trouble analysing a publicl…

---

## [Remove certain cells that look like doublets by gene expression levels](https://discourse.scverse.org/t/remove-certain-cells-that-look-like-doublets-by-gene-expression-levels/1571)

<div class="topic-metadata">

**Author:** [@Qtasnim](https://discourse.scverse.org/u/Qtasnim)\
**Replies:** 0\
**Last updated:** [July 4, 2023, 12:43pm UTC](https://discourse.scverse.org/t/remove-certain-cells-that-look-like-doublets-by-gene-expression-levels/1571 "2023-07-04T12:43:20Z")

</div>

Hello! My problem is a little bit complicated so I’m not sure if there is a solution. I have a preprocessed anndata object. After plotting some genes by UMAP it shows some cells having expression of different cell type…

---

## [How I can use big data with scanpy?](https://discourse.scverse.org/t/how-i-can-use-big-data-with-scanpy/1554)

<div class="topic-metadata">

**Author:** [@MohammadIzadi](https://discourse.scverse.org/u/MohammadIzadi)\
**Replies:** 1\
**Last updated:** [July 3, 2023, 2:29pm UTC](https://discourse.scverse.org/t/how-i-can-use-big-data-with-scanpy/1554 "2023-07-03T14:29:44Z")

</div>

Hi, Thanks for developing scanpy. I want to run scanpy on kaggle or Colab but they have 30gb and 12gb of RAM, respectively. When I read my data with “read\_h5ad()”, Colab is crash and 25gb of Keggle’s RAM is occupied an…

---

## [Problem in PerformanceWarning](https://discourse.scverse.org/t/problem-in-performancewarning/1532)

<div class="topic-metadata">

**Author:** [@wook2014](https://discourse.scverse.org/u/wook2014)\
**Replies:** 1\
**Last updated:** [June 30, 2023, 5:17pm UTC](https://discourse.scverse.org/t/problem-in-performancewarning/1532 "2023-06-30T17:17:17Z")

</div>

I have tried to get DEG in my different groups of cell clusters but there comes with ana warning: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling \`frame.insert\` many times, whi…

---

## ["ValueError: cannot specify integer \`bins\` when input data contains infinity" in multi sample data](https://discourse.scverse.org/t/valueerror-cannot-specify-integer-bins-when-input-data-contains-infinity-in-multi-sample-data/1229)

<div class="topic-metadata">

**Author:** [@Behzad](https://discourse.scverse.org/u/Behzad)\
**Replies:** 6\
**Last updated:** [June 27, 2023, 10:36pm UTC](https://discourse.scverse.org/t/valueerror-cannot-specify-integer-bins-when-input-data-contains-infinity-in-multi-sample-data/1229 "2023-06-27T22:36:44Z")

</div>

I have few samples and merged them all (so the adata has 6 samples in it) and followed the scanpy tutorial without any problem until I reached to the point where I had to extract highly variable genes using this command: …

---

## [Scanpy matrixplot dendrogram by both axes](https://discourse.scverse.org/t/scanpy-matrixplot-dendrogram-by-both-axes/1548)

<div class="topic-metadata">

**Author:** [@jamesmo](https://discourse.scverse.org/u/jamesmo)\
**Replies:** 0\
**Last updated:** [June 23, 2023, 12:52am UTC](https://discourse.scverse.org/t/scanpy-matrixplot-dendrogram-by-both-axes/1548 "2023-06-23T00:52:21Z")

</div>

Hi, Is there a workaround to apply hierarchical clustering to both axes in matrixplot? ie both adata.var\_names and adata.obs.leiden It seems groupby only accepts adata.obs columns for the dendrogram. This would be sup…

---

## [Reorder dendrogram/heatmap for pl.rank\_genes\_groups\_heatmap](https://discourse.scverse.org/t/reorder-dendrogram-heatmap-for-pl-rank-genes-groups-heatmap/1543)

<div class="topic-metadata">

**Author:** [@lilywright99](https://discourse.scverse.org/u/lilywright99)\
**Replies:** 0\
**Last updated:** [June 22, 2023, 1:06pm UTC](https://discourse.scverse.org/t/reorder-dendrogram-heatmap-for-pl-rank-genes-groups-heatmap/1543 "2023-06-22T13:06:53Z")

</div>

Hi all, For aesthetic purposes, I want to flip some arms of the initial dendrogram (sc.tl.dendrogram) used for sc.pl.rank\_genes\_groups\_heatmap and reorder some of the clusters. There are no parameters in either sc.tl.d…

---

## [Obtain pixel grid from scanpy.pl.spatial](https://discourse.scverse.org/t/obtain-pixel-grid-from-scanpy-pl-spatial/1538)

<div class="topic-metadata">

**Author:** [@Bakar](https://discourse.scverse.org/u/Bakar)\
**Replies:** 0\
**Last updated:** [June 21, 2023, 5:25pm UTC](https://discourse.scverse.org/t/obtain-pixel-grid-from-scanpy-pl-spatial/1538 "2023-06-21T17:25:26Z")

</div>

Hi, Is there a way to obtain the pixel grid coordinates from using scanpy.pl.spatial after passing in the parameters?

---

## [How to randomize plotting order of cells in sc.pl.umap](https://discourse.scverse.org/t/how-to-randomize-plotting-order-of-cells-in-sc-pl-umap/1526)

<div class="topic-metadata">

**Author:** [@kristianunger](https://discourse.scverse.org/u/kristianunger)\
**Replies:** 0\
**Last updated:** [June 17, 2023, 9:09am UTC](https://discourse.scverse.org/t/how-to-randomize-plotting-order-of-cells-in-sc-pl-umap/1526 "2023-06-17T09:09:42Z")

</div>

When displaying categories in sc.pl.umap, how can I randomize the order of the layers for every cell so that one category does not cover the cells of the other category, which then appears hidden?

[Previous page](https://discourse.scverse.org/c/help/scanpy/37.md?page=2)

[Next page](https://discourse.scverse.org/c/help/scanpy/37.md?page=4)
