This is a test version of Biostars. For the public version, visit https://www.biostars.org.
DoHeatmap with GSEA gene set?

Hello,

I'm trying to create heatmaps based on genes within this GSEA gene set. There are a lot of genes in this set and I'm not expecting to have all of them on the heatmap.

When I run this code:

DoHeatmap(avgexp, features = alphavec, group.by = "ptorigin", angle = 90)

In which alphavec is the string vector of all genes in that gene set, I'm confronted with this error:

Error in DoHeatmap(avgexp, features = alphavec, group.by = "ptorigin", : No requested features found in the scale.data slot for the RNA assay.

I'm assuming this means that some genes were not found in my seurat object. However, how do I go about actually determining which genes are not present so I can remove them from the vector?

scrnaseq singlecell gsea

1 answer

First, you can have a view of how many genes of alphavec are present in your Seurat object :

intersect(avgexp@assays[["RNA"]]@var.features, alphavec)

Then, if there are more than 1 gene overlapping, you can run this code to draw the heatmap :

DoHeatmap(avgexp[alphavec,], features = alphavec, group.by = "ptorigin", angle = 90)

Log in to answer this question.