# scanpy

**URL:** https://discourse.scverse.org/c/help/scanpy/37.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

---

## [Psutil error when running sc.neighbors() in tutorial notebook](https://discourse.scverse.org/t/psutil-error-when-running-sc-neighbors-in-tutorial-notebook/3374)

<div class="topic-metadata">

**Author:** [@mesoc](https://discourse.scverse.org/u/mesoc)\
**Replies:** 0\
**Last updated:** [December 5, 2024, 7:31pm UTC](https://discourse.scverse.org/t/psutil-error-when-running-sc-neighbors-in-tutorial-notebook/3374 "2024-12-05T19:31:06Z")

</div>

In the scanpy example of the scverse best-practices book (4. Analysis frameworks and tools — Single-cell best practices, section 4.3.3) using the provided script with the provided pbmc3k dataset When running sc.pp.neig…

---

## [Difference between differentialy expressed genes and violin plot](https://discourse.scverse.org/t/difference-between-differentialy-expressed-genes-and-violin-plot/3369)

<div class="topic-metadata">

**Author:** [@LioLnr](https://discourse.scverse.org/u/LioLnr)\
**Replies:** 0\
**Last updated:** [December 3, 2024, 9:13am UTC](https://discourse.scverse.org/t/difference-between-differentialy-expressed-genes-and-violin-plot/3369 "2024-12-03T09:13:38Z")

</div>

I am currently looking at differentialy expressed genes accross cluster. In parallel, I have also looked at the expression of some specific genes accross cluster. Here for “Retnla”, the violin plot suggest that this ge…

---

## [10X data import, "No such file or directory: features.tsv.gz"](https://discourse.scverse.org/t/10x-data-import-no-such-file-or-directory-features-tsv-gz/3368)

<div class="topic-metadata">

**Author:** [@hmnzo5gy](https://discourse.scverse.org/u/hmnzo5gy)\
**Replies:** 0\
**Last updated:** [November 29, 2024, 7:42pm UTC](https://discourse.scverse.org/t/10x-data-import-no-such-file-or-directory-features-tsv-gz/3368 "2024-11-29T19:42:59Z")

</div>

I am trying to import a data generated using 10X chromium v2 chemistry with genes.tsv.gz instead of features.tsv.gz. How can I import the data with scanpy.read\_10x\_mtx? Is it okay if I change the genes.tsv.gz to features…

---

## [Use a dictionnary with heatmaps](https://discourse.scverse.org/t/use-a-dictionnary-with-heatmaps/3359)

<div class="topic-metadata">

**Author:** [@LioLnr](https://discourse.scverse.org/u/LioLnr)\
**Replies:** 0\
**Last updated:** [November 25, 2024, 1:08pm UTC](https://discourse.scverse.org/t/use-a-dictionnary-with-heatmaps/3359 "2024-11-25T13:08:35Z")

</div>

Hello, I would like to use a dictonnary to specify the genes for a heatmap. The dictionnary contains the 50 genes with the higher logfoldchange per cluster. I do not know if I should use scanpy.pl.rank\_genes\_groups\_h…

---

## [Difference between tl.rank\_genes\_groups and pl.rank\_genes\_groups\_heatmap](https://discourse.scverse.org/t/difference-between-tl-rank-genes-groups-and-pl-rank-genes-groups-heatmap/3353)

<div class="topic-metadata">

**Author:** [@LioLnr](https://discourse.scverse.org/u/LioLnr)\
**Replies:** 0\
**Last updated:** [November 20, 2024, 12:35pm UTC](https://discourse.scverse.org/t/difference-between-tl-rank-genes-groups-and-pl-rank-genes-groups-heatmap/3353 "2024-11-20T12:35:16Z")

</div>

Here is the code I ran : sc.tl.rank\_genes\_groups(sco, layer='cluster\_int', groupby='cluster\_int', method='wilcoxon', corr\_method = 'benjamini-hochberg', pts = True) pattern = r'Rik$|Rik\[0-9\]$|^Gm\[0-9\]+|^AC\[0-9\]{6}' re…

---

## [Radial shape of cluster on UMAP, why?](https://discourse.scverse.org/t/radial-shape-of-cluster-on-umap-why/3326)

<div class="topic-metadata">

**Author:** [@maisom](https://discourse.scverse.org/u/maisom)\
**Replies:** 0\
**Last updated:** [November 7, 2024, 12:37pm UTC](https://discourse.scverse.org/t/radial-shape-of-cluster-on-umap-why/3326 "2024-11-07T12:37:54Z")

</div>

Hi, Hope anyone can help me. My UMAP looks weird. I can see from the annotation, that the same cell type is found at the edges of a large radial/star-shaped “cluster”. Here, the different colors are different immune cel…

---

## [Scanpy.pl.rank\_genes\_groups\_dotplot doesn't plot gene symbols in adata.var\_names](https://discourse.scverse.org/t/scanpy-pl-rank-genes-groups-dotplot-doesnt-plot-gene-symbols-in-adata-var-names/3269)

<div class="topic-metadata">

**Author:** [@aindap](https://discourse.scverse.org/u/aindap)\
**Replies:** 0\
**Last updated:** [September 30, 2024, 8:04am UTC](https://discourse.scverse.org/t/scanpy-pl-rank-genes-groups-dotplot-doesnt-plot-gene-symbols-in-adata-var-names/3269 "2024-09-30T08:04:09Z")

</div>

Hi, I am trying to analyze data from this dataset GSE197215 The authors provided RDS Seurat objects that I sucessfully converted to h5ad. I read in the files, and concatenated them into a single object: adata\_unstimul…

---

## [Sc.pp.regress\_out() with large datasets](https://discourse.scverse.org/t/sc-pp-regress-out-with-large-datasets/2525)

<div class="topic-metadata">

**Author:** [@sabrina\_tsai](https://discourse.scverse.org/u/sabrina_tsai)\
**Replies:** 0\
**Last updated:** [September 19, 2024, 10:08pm UTC](https://discourse.scverse.org/t/sc-pp-regress-out-with-large-datasets/2525 "2024-09-19T22:08:11Z")

</div>

I’m having trouble regressing out cell cycle genes in large datasets as this is taking hours or often getting out of memory errors (with 800G). I’ve tried increasing the n\_jobs parameter but it still takes quite long. Wh…

---

## [Trouble Making a Z-Score Heatmap](https://discourse.scverse.org/t/trouble-making-a-z-score-heatmap/1227)

<div class="topic-metadata">

**Author:** [@BioinformatixDude](https://discourse.scverse.org/u/BioinformatixDude)\
**Replies:** 2\
**Last updated:** [September 11, 2024, 2:20am UTC](https://discourse.scverse.org/t/trouble-making-a-z-score-heatmap/1227 "2024-09-11T02:20:37Z")

</div>

Hello, I’m working on a single cell project and have done your typical pre-processing by log-normalizing and scaling the data. I want to generate heatmaps that depict the z-score of each differentially expressed across …

---

## [Loosing anndata .var layer when using sc.concat?](https://discourse.scverse.org/t/loosing-anndata-var-layer-when-using-sc-concat/1605)

<div class="topic-metadata">

**Author:** [@Avaptel18](https://discourse.scverse.org/u/Avaptel18)\
**Replies:** 3\
**Last updated:** [September 9, 2024, 2:37pm UTC](https://discourse.scverse.org/t/loosing-anndata-var-layer-when-using-sc-concat/1605 "2024-09-09T14:37:53Z")

</div>

Hi, I am merging my samples, after initial QC, with scanpy.concat and l am loosing my .var layer. This is my code adata = sc.concat(adatas, join=‘outer’, index\_unique=“\_”, keys=sample\_ids, label=‘sample\_ID’) Can I pro…

---

## [Changing color/size of textfont with sc.pl.umap](https://discourse.scverse.org/t/changing-color-size-of-textfont-with-sc-pl-umap/2467)

<div class="topic-metadata">

**Author:** [@LysSanzMoreta](https://discourse.scverse.org/u/LysSanzMoreta)\
**Replies:** 2\
**Last updated:** [September 4, 2024, 5:34pm UTC](https://discourse.scverse.org/t/changing-color-size-of-textfont-with-sc-pl-umap/2467 "2024-09-04T17:34:33Z")

</div>

Hi! A simple question, I am plotting the leiden clusters using sc.pl.umap in this manner: sc.pl.umap( dataset, layer = "X\_umap", use\_raw=False, …

---

## [Understanding the behaviour of sc.pp.highly\_variable\_genes with a batch\_key and different values of n\_top\_genes](https://discourse.scverse.org/t/understanding-the-behaviour-of-sc-pp-highly-variable-genes-with-a-batch-key-and-different-values-of-n-top-genes/2425)

<div class="topic-metadata">

**Author:** [@timslittle](https://discourse.scverse.org/u/timslittle)\
**Replies:** 1\
**Last updated:** [August 15, 2024, 8:23am UTC](https://discourse.scverse.org/t/understanding-the-behaviour-of-sc-pp-highly-variable-genes-with-a-batch-key-and-different-values-of-n-top-genes/2425 "2024-08-15T08:23:19Z")

</div>

Hi all, I was trying to understand how the algorithm for sc.pp.highly\_variable\_genes works when operating it in a batch-aware manner. I think that I’ve figured it out so I’m writing it down in case anyone else was confu…

---

## [Sc.pl.umap scales](https://discourse.scverse.org/t/sc-pl-umap-scales/2411)

<div class="topic-metadata">

**Author:** [@LioLnr](https://discourse.scverse.org/u/LioLnr)\
**Replies:** 1\
**Last updated:** [July 30, 2024, 9:54pm UTC](https://discourse.scverse.org/t/sc-pl-umap-scales/2411 "2024-07-30T21:54:45Z")

</div>

Hello, I just wanted to know what does the negative value in the scale, and the scale in general means, when ploting the expression of some genes on a umap ? See an example here : Thanks Lionel

---

## [P-values for scanpy.tl.rank\_genes\_groups](https://discourse.scverse.org/t/p-values-for-scanpy-tl-rank-genes-groups/2414)

<div class="topic-metadata">

**Author:** [@LioLnr](https://discourse.scverse.org/u/LioLnr)\
**Replies:** 1\
**Last updated:** [July 30, 2024, 9:52pm UTC](https://discourse.scverse.org/t/p-values-for-scanpy-tl-rank-genes-groups/2414 "2024-07-30T21:52:45Z")

</div>

Hello, I just wanted to know how the p-value is computed when using scanpy.tl.rank\_genes\_groups ? Thanks ! Lionel

---

## [Stannotation with scanpy and seaborn](https://discourse.scverse.org/t/stannotation-with-scanpy-and-seaborn/2416)

<div class="topic-metadata">

**Author:** [@LioLnr](https://discourse.scverse.org/u/LioLnr)\
**Replies:** 0\
**Last updated:** [July 30, 2024, 7:46am UTC](https://discourse.scverse.org/t/stannotation-with-scanpy-and-seaborn/2416 "2024-07-30T07:46:41Z")

</div>

Hello, I am trying to add statistical annotation on a boxplot I generated with scanpy but I get those errors : ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. …

---

## [Do I need to scale my adata before running sc.tl.score\_genes?](https://discourse.scverse.org/t/do-i-need-to-scale-my-adata-before-running-sc-tl-score-genes/2315)

<div class="topic-metadata">

**Author:** [@christophechu](https://discourse.scverse.org/u/christophechu)\
**Replies:** 1\
**Last updated:** [July 23, 2024, 11:17pm UTC](https://discourse.scverse.org/t/do-i-need-to-scale-my-adata-before-running-sc-tl-score-genes/2315 "2024-07-23T23:17:11Z")

</div>

\*\* I have always had a question: do I need to scale my adata before running sc.tl.score\_genes\*\*

---

## [Some default parameter annotations in API are confusing](https://discourse.scverse.org/t/some-default-parameter-annotations-in-api-are-confusing/2342)

<div class="topic-metadata">

**Author:** [@MSHelm](https://discourse.scverse.org/u/MSHelm)\
**Replies:** 2\
**Last updated:** [July 23, 2024, 11:15pm UTC](https://discourse.scverse.org/t/some-default-parameter-annotations-in-api-are-confusing/2342 "2024-07-23T23:15:37Z")

</div>

Hey everyone, I have been getting into the scverse lately to analyze some single cell data. When looking at the documentation online, I often was confused when parameters had None as their default parameter, even though…

---

## [Scanpy.tl.rank\_genes\_groups with wilcoxon returns same score for multiple genes](https://discourse.scverse.org/t/scanpy-tl-rank-genes-groups-with-wilcoxon-returns-same-score-for-multiple-genes/2384)

<div class="topic-metadata">

**Author:** [@osmanmerdan](https://discourse.scverse.org/u/osmanmerdan)\
**Replies:** 0\
**Last updated:** [July 15, 2024, 3:58pm UTC](https://discourse.scverse.org/t/scanpy-tl-rank-genes-groups-with-wilcoxon-returns-same-score-for-multiple-genes/2384 "2024-07-15T15:58:27Z")

</div>

Hi everyone, Just a simple question. I have run scanpy.tl.rank\_genes\_groups to find DEGs between two clusters. I have set method="wilcoxon" Using shifted log normalized values. I have set tie\_correct = False (Also, I…

---

## [UMAP plot colors problem](https://discourse.scverse.org/t/umap-plot-colors-problem/2318)

<div class="topic-metadata">

**Author:** [@quiquevb23](https://discourse.scverse.org/u/quiquevb23)\
**Replies:** 2\
**Last updated:** [June 6, 2024, 9:47am UTC](https://discourse.scverse.org/t/umap-plot-colors-problem/2318 "2024-06-06T09:47:34Z")

</div>

Hi, I am analyzing a single-cell dataset with Scanpy. Originally it was a Seurat Object and each cell had a label for the cluster it belonged to (30 clusters). I have transformed it to Anndata while preserving that class…

---

## [How to find DE genes between different datasets?](https://discourse.scverse.org/t/how-to-find-de-genes-between-different-datasets/2288)

<div class="topic-metadata">

**Author:** [@MattC7222022](https://discourse.scverse.org/u/MattC7222022)\
**Replies:** 1\
**Last updated:** [May 22, 2024, 9:59pm UTC](https://discourse.scverse.org/t/how-to-find-de-genes-between-different-datasets/2288 "2024-05-22T21:59:31Z")

</div>

Hi, I was wondering how you would compare different batches of scRNA-seq data with different celltypes, and get a DE gene list. I’ve looked through the forums and found a few similar questions but nothing exact for sca…

---

## [Var\_names\_make\_unique()](https://discourse.scverse.org/t/var-names-make-unique/2243)

<div class="topic-metadata">

**Author:** [@wangda](https://discourse.scverse.org/u/wangda)\
**Replies:** 1\
**Last updated:** [May 9, 2024, 12:54am UTC](https://discourse.scverse.org/t/var-names-make-unique/2243 "2024-05-09T00:54:48Z")

</div>

I’m new to Python, Scanpy, and Anndata, please let me know if I made any mistakes. This warning is really confusing me for a long time. Background: I have downloaded a h5ad file from a dataset, and loaded it using Scanp…

---

## [Subsetting anndata is causing error problems](https://discourse.scverse.org/t/subsetting-anndata-is-causing-error-problems/1162)

<div class="topic-metadata">

**Author:** [@navi](https://discourse.scverse.org/u/navi)\
**Replies:** 3\
**Last updated:** [May 5, 2024, 4:10am UTC](https://discourse.scverse.org/t/subsetting-anndata-is-causing-error-problems/1162 "2024-05-05T04:10:49Z")

</div>

This is my AnnData object with n\_obs × n\_vars = 227550 × 32302 , i am trying to regress out ribosomal genes by 2 methods , one by regress\_out function and other by selected the genes which start with “RPS” and subsetting…

---

## [Subsetting/Re-normalization issue](https://discourse.scverse.org/t/subsetting-re-normalization-issue/2055)

<div class="topic-metadata">

**Author:** [@Lockhaa](https://discourse.scverse.org/u/Lockhaa)\
**Replies:** 1\
**Last updated:** [April 30, 2024, 5:38pm UTC](https://discourse.scverse.org/t/subsetting-re-normalization-issue/2055 "2024-04-30T17:38:53Z")

</div>

I have an anndata object (already normalized) that I subsetted using adata\_4 = adata\_T\[adata\_T.obs\['celltype'\] == "CD4"\] The subsetting works but when I try to further process this data ie. sc.pp.normalize\_total(adata…

---

## [Computing sc.pp.neighbors without method?](https://discourse.scverse.org/t/computing-sc-pp-neighbors-without-method/1588)

<div class="topic-metadata">

**Author:** [@Noarzel](https://discourse.scverse.org/u/Noarzel)\
**Replies:** 2\
**Last updated:** [April 25, 2024, 9:22pm UTC](https://discourse.scverse.org/t/computing-sc-pp-neighbors-without-method/1588 "2024-04-25T21:22:02Z")

</div>

Hello ! I’m new here so not sure if i’m doing this correctly but here we go. I’m building a pipeline to deal with anndata objects (for analysis, visualization etc.) The input of my pipeline is actually the output of an …

---

## [How can I logarithmize the data for wilcoxon test?](https://discourse.scverse.org/t/how-can-i-logarithmize-the-data-for-wilcoxon-test/2228)

<div class="topic-metadata">

**Author:** [@SUNGKYUNGKOO](https://discourse.scverse.org/u/SUNGKYUNGKOO)\
**Replies:** 1\
**Last updated:** [April 25, 2024, 9:16pm UTC](https://discourse.scverse.org/t/how-can-i-logarithmize-the-data-for-wilcoxon-test/2228 "2024-04-25T21:16:38Z")

</div>

Hello, I have problems using “rank\_gene\_groups”. Even if I already logarithmized my data with scanpy.pp.log1p function, the following warning sign appears when I try to run wilcoxon test. WARNING: It seems you use rank…

---

## [Does processing the data always overwrite the raw counts?](https://discourse.scverse.org/t/does-processing-the-data-always-overwrite-the-raw-counts/1094)

<div class="topic-metadata">

**Author:** [@natalia.nutella](https://discourse.scverse.org/u/natalia.nutella)\
**Replies:** 3\
**Last updated:** [April 22, 2024, 6:52pm UTC](https://discourse.scverse.org/t/does-processing-the-data-always-overwrite-the-raw-counts/1094 "2024-04-22T18:52:31Z")

</div>

I’m trying to understand the expected behavior in Scanpy re: what happens to different versions of the data during processing. It’s my understanding that doing operations on the data always overwrites .X and one has to …

---

## [Question about diffusion map "gaussian" implementation](https://discourse.scverse.org/t/question-about-diffusion-map-gaussian-implementation/1316)

<div class="topic-metadata">

**Author:** [@quarkmatter](https://discourse.scverse.org/u/quarkmatter)\
**Replies:** 3\
**Last updated:** [April 22, 2024, 1:41am UTC](https://discourse.scverse.org/t/question-about-diffusion-map-gaussian-implementation/1316 "2024-04-22T01:41:27Z")

</div>

Hi, I am curious about the Gaussian implementation of diffusion maps in scanpy. The documentation claims that this reproduces the procedure laid out in Haghverdi et. al. However, the code for determining this seems to j…

---

## [How to interpret Diffusion Maps?](https://discourse.scverse.org/t/how-to-interpret-diffusion-maps/2224)

<div class="topic-metadata">

**Author:** [@jolespin](https://discourse.scverse.org/u/jolespin)\
**Replies:** 0\
**Last updated:** [April 18, 2024, 9:45pm UTC](https://discourse.scverse.org/t/how-to-interpret-diffusion-maps/2224 "2024-04-18T21:45:28Z")

</div>

I’m trying to adapt this to a very simple case which is the iris dataset: import anndata as ad import scanpy as sc from sklearn.neighbors import NearestNeighbors from scipy.sparse import csr\_matrix from sklearn import d…

---

## [How can I export list of genes and counts for each cluster from adata.raw?](https://discourse.scverse.org/t/how-can-i-export-list-of-genes-and-counts-for-each-cluster-from-adata-raw/2191)

<div class="topic-metadata">

**Author:** [@st4302](https://discourse.scverse.org/u/st4302)\
**Replies:** 1\
**Last updated:** [April 12, 2024, 10:06pm UTC](https://discourse.scverse.org/t/how-can-i-export-list-of-genes-and-counts-for-each-cluster-from-adata-raw/2191 "2024-04-12T22:06:40Z")

</div>

Hello, I have an anndata object from a sample that I am processing through scanpy. I have reached the point where I did the leiden clustering. I would like to export to a csv file all the genes expressed in each cluster…

---

## [Change the font family for scanpy.pl in linux](https://discourse.scverse.org/t/change-the-font-family-for-scanpy-pl-in-linux/2197)

<div class="topic-metadata">

**Author:** [@hmnzo5gy](https://discourse.scverse.org/u/hmnzo5gy)\
**Replies:** 1\
**Last updated:** [April 11, 2024, 12:00pm UTC](https://discourse.scverse.org/t/change-the-font-family-for-scanpy-pl-in-linux/2197 "2024-04-11T12:00:53Z")

</div>

I would like to change the fonts for scanpy plots labels into Arial or Helvetica but when I change font type using the following settings, nothing changed in the font family. import scanpy as sc import matplotlib as plt…

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

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