Plotting heatmap of Marker genes in each celltypes in Seurat
1
2
Entering edit mode
4.2 years ago
David_emir ▴ 500

Hi,

I am working on single-cell data, I have identified cell types in each cluster by using marker genes expression using Seurat. I want to Plot a Heatmap which shows gene scores for the marker genes (rows) in each expression module identified by clustering. Example figure is as follows. Please let me know how best i can plot this type of image using Seurat or any other pipeline.

Thanks a lot for your kind help,

Regards, Dave

HeatMap for marker genes in each cell type

seurat singlecell heatmap celltypes • 28k views
ADD COMMENT
0
Entering edit mode

Seurat has a function DoHeatmap that will make a heatmap based on the given features and clusters.

ADD REPLY
1
Entering edit mode

Thanks a lot for such a fast reply, I tried with DoHeatmap, but i couldn't add Tissue/Donor/Sample Info to the Heatmap. I couldn't produce heatmap wth all the cell type markers, my graph will become very cluttery and it's difficult to read.

ADD REPLY
1
Entering edit mode

If you want to add extra information like tissue and donor, you'll need to extract the metadata and UMI counts from the seurat object, and then construct the heatmap using the ComplexHeatmap library. You can get the counts using the GetAssayData function, and the metadata can be accessed with two opened and closed square brackets seurat_object[[]].

ADD REPLY
0
Entering edit mode

Can you please share any script for this, i am a biologist, my hold on R is very Limited.

ADD REPLY
1
Entering edit mode

ComplexHeatmap has a long but detailed vignette that you can go through.

Your can prepare your count matrix with this code. Put the genes you want to include the the genes vector.

library("Seurat")

counts <- GetAssyData(seurat_obj, assay="RNA", slot="data")
genes <- c(...)
counts <- as.matrix(counts[rownames(counts) %in% genes, ])

You can then prepare your metadata using this code.

metadata <- seurat_obj[[]]
metadata <- metadata[rownames(metadata) %in% colnames(counts), ]

These can then be used as input to ComplexHeatmap.

ADD REPLY
0
Entering edit mode

Thanks a lot for your kind help, i am trying this code.

ADD REPLY
9
Entering edit mode
4.2 years ago

This can be done very simply with the dittoHeatmap command from dittoSeq. It will allow you to add any other annotations you'd like very simply via the annot.by parameter. It will work on your default Seurat object with no changes or conversions.

ADD COMMENT
0
Entering edit mode

That's a really handy wrapper for pheatmap, thanks for sharing!

ADD REPLY
1
Entering edit mode

Thanks. We will probably change the underlying code to utilize ComplexHeatmap eventually, as it's an easy switch and will allow us to use some of the rasterization features that will really help reduce the plot file size and make plots easier to edit in Illustrator, etc.

ADD REPLY
1
Entering edit mode

I find that the scRNA-seq dim plots will sometimes melt illustrator as well. I found a handy library, ggraster, that will let you rasterize the points but keep the labels and such as vectors. I figured I would pass this along in case you haven't seen it.

ADD REPLY
2
Entering edit mode

To keep this up to date, dittoHeatmap supports rasterization now by using ComplexHeatmap.

ADD REPLY

Login before adding your answer.

Traffic: 1395 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6