<p>An easy way to do an enrichment analysis in scanpy is using <a href="https://scanpy.readthedocs.io/en/stable/generated/scanpy.queries.enrich.html" rel="nofollow noreferrer"><code>scanpy.queries.enrich()</code></a>. This relies on <a href="https://pypi.org/project/gprofiler-official/#description" rel="nofollow noreferrer">gprofiler</a>, which uses KEGG, GO and other ontologies</p>

CC BY-SA 4.0
2023-02-05T22:50:11.790Z
2023-02-05T22:50:11.790Z
Chris_Rands
<p>The original question was GSEApy vs KEGG. The response below is GSEApy.  The question has been edited and is now a  different question concerning options within GSEApy.</p>
<hr />
<p><em>Response to original question</em></p>
<p>If GSEApy as described in the publication provides the output you require - that is much, much simpler. KEGG will be complex and you'd need its ids.</p>
<p>However, surely GSEA will require to perform the full calculation of fold-change from scratch rather than be fed the output of scanpy? KEGG will require the output of scanpy. GSEApy primary function is fold-change rather identifying the precisely which pathways are regulating the phenotype under analysis.</p>
<p>KEGG will provide a more accurate answer - in my humble opinion. GSEApy is a lot easier because it very much an &quot;all-in-one&quot; solution. If the answer isn't satisfactory you can always switch.</p>
<hr />
<p>Just to note the GSEApy version I'm referring to is the latest <a href="https://academic.oup.com/bioinformatics/article/39/1/btac757/6847088" rel="nofollow noreferrer">publication</a>.</p>
<p><strong>NOTE</strong> There was a deleted post from the OP about an option within GSEA. This is a separate question in the SE format of questions and answers. Thats the way the site works.</p>

CC BY-SA 4.0
2023-02-03T17:36:08.093Z
2023-02-03T18:55:07.697Z
2023-02-03T18:55:07.697Z
M__
<p>I have done DE analysis using <a href="https://scanpy.readthedocs.io/en/stable/" rel="nofollow noreferrer">SCANpy</a> on my single cell data and I have compared each cluster versus all the other clusters. One cluster seems particularly interesting so I wanted to do pathway analysis.</p>
<p>I have already tried to do the pathway analysis but I got confused. I initially followed the instructions from here (<a href="https://nbisweden.github.io/workshop-scRNAseq/labs/compiled/scanpy/scanpy_05_dge.html" rel="nofollow noreferrer">https://nbisweden.github.io/workshop-scRNAseq/labs/compiled/scanpy/scanpy_05_dge.html</a>) and did the enrichment and then I also wanted to do GSEA so I used gseapy.prerank. However, then I was trying to find a way to visualize the network so I ended up going to the gseapy documentation.</p>
<p>The steps of the enrichment analysis seemed the same but then I got confused with the GSEA portion. The first tutorial I found used gseapy.prerank but the second one uses gp.gsea. I was trying to understand the difference and it seems that since I already have the DE analysis I should be using the gseapy.prerank right bit I am not sure.</p>
<p>I was wondering if doing the analysis trough KEGG would be easier.</p>
<p>Thank you</p>
<blockquote>
<p>Gene set enrichment analysis (GSEA) is a commonly used algorithm for characterizing gene expression changes. However, the currently available tools used to perform GSEA have a limited ability to analyze large datasets, which is particularly problematic for the analysis of single-cell data. To overcome this limitation, we developed a GSEA package in Python (GSEApy), which could efficiently analyze large single-cell datasets.</p>
</blockquote>

<single-cell><pathway><gsea>
How to do pathway analysis after scanpy for single cell data after DE analysis?
# How to do pathway analysis after scanpy for single cell data after DE analysis?

(Asked by: username_0 on 2023-02-03)

I have done DE analysis using [SCANpy](https://scanpy.readthedocs.io/en/stable/) on my single cell data and I have compared each cluster versus all the other clusters. One cluster seems particularly interesting so I wanted to do pathway analysis.

I have already tried to do the pathway analysis but I got confused. I initially followed the instructions from here (<https://nbisweden.github.io/workshop-scRNAseq/labs/compiled/scanpy/scanpy_05_dge.html>) and did the enrichment and then I also wanted to do GSEA so I used gseapy.prerank. However, then I was trying to find a way to visualize the network so I ended up going to the gseapy documentation.

The steps of the enrichment analysis seemed the same but then I got confused with the GSEA portion. The first tutorial I found used gseapy.prerank but the second one uses gp.gsea. I was trying to understand the difference and it seems that since I already have the DE analysis I should be using the gseapy.prerank right bit I am not sure.

I was wondering if doing the analysis trough KEGG would be easier.

Thank you

> Gene set enrichment analysis (GSEA) is a commonly used algorithm for characterizing gene expression changes. However, the currently available tools used to perform GSEA have a limited ability to analyze large datasets, which is particularly problematic for the analysis of single-cell data. To overcome this limitation, we developed a GSEA package in Python (GSEApy), which could efficiently analyze large single-cell datasets.

**Tags:** single-cell, pathway, gsea

---

## 2 answers

### Answer by username_1 on 2023-02-05. Score: 1

An easy way to do an enrichment analysis in scanpy is using [`scanpy.queries.enrich()`](https://scanpy.readthedocs.io/en/stable/generated/scanpy.queries.enrich.html). This relies on [gprofiler](https://pypi.org/project/gprofiler-official/#description), which uses KEGG, GO and other ontologies


---

### Answer by username_2 on 2023-02-03. Score: 0

The original question was GSEApy vs KEGG. The response below is GSEApy. The question has been edited and is now a different question concerning options within GSEApy.

---

*Response to original question*

If GSEApy as described in the publication provides the output you require - that is much, much simpler. KEGG will be complex and you'd need its ids.

However, surely GSEA will require to perform the full calculation of fold-change from scratch rather than be fed the output of scanpy? KEGG will require the output of scanpy. GSEApy primary function is fold-change rather identifying the precisely which pathways are regulating the phenotype under analysis.

KEGG will provide a more accurate answer - in my humble opinion. GSEApy is a lot easier because it very much an "all-in-one" solution. If the answer isn't satisfactory you can always switch.

---

Just to note the GSEApy version I'm referring to is the latest [publication](https://academic.oup.com/bioinformatics/article/39/1/btac757/6847088).

**NOTE** There was a deleted post from the OP about an option within GSEA. This is a separate question in the SE format of questions and answers. Thats the way the site works.


---

