This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to handle duplicate genes in DoHeatmap() for top DEGs across clusters (seurat single cell)

Hi,

I would like to create a heatmap of the top 20 DEGs for each of my 5 clusters. However, there are duplicates among these 100 genes, and the DoHeatmap() function only plots unique genes.

I have a Seurat v5 object.

Is there a solution to this issue?

seurat

Why are there duplicates? What do you mean? Add code and plots to illustrate a problem.

Example:

cluster1 <- c("A", "B", "C", "D")
cluster2 <- c("A", "E", "F", "G")
...
cluster5 <- c("B", "H", "I", "J")

marker_all <- c(cluster1, cluster2, ..., cluster5)

For instance the gene A is expressed in cluster1 and cluster2 but after doing:

seurat <- ScaleData(seurat, features = marker_all, assay = "RNA")

Only one A is retained for the heatmap:

DoHeatmap(subset(seurat, downsample = 1500), features = marker_all), 
          group.by = "Cluster_name")

I would like both A to be retained.

I bet you ran FindAllMarkers on your dataset and ended up with the same genes found as DE in multiple clusters

Yes, right

Finding DEGs is not a finality, what do you want to show on the heatmap ? Expression of these genes in each cluster I presume. Then, calculate the expression of each gene in each cluster to plot a heatmap of gene expression.

What you get in the output of FindAllMarkers is a logFC between one cluster to the rest of the cells, indeed some genes can be makers in different clusters. But you cannot plot the output of FindAllMarkers as it is on an heatmap

I would like both A to be retained

This is not possible the way you describe it, it does not make sense. Or please reexplain your problem.

If you want to keep "unique" genes, the output of FindAllMarkers has a column gene that you can call the function unique on.

0 answers

No answers yet.

Log in to answer this question.