I have a set of cells that I am performing Drop-seq on to look at cell expression. Among my heat maps for gene expression I want to be able to graph them similar to the graph below: Heat map with clusters on left, genes on bottom, and genes grouped together

Where the cells are sorted by cluster on the left axis, and have the genes across the bottom. However I also want to cluster the genes by the expression within the cluster (like how this graph does). Is that possible in Seurat?

Currently I have created a heat map that looks like this: enter image description here

It has the clusters listed on the left axis, and small sub-selection of genes on the bottom. However I want to be able to order those genes by their expression within those clusters, without having to manually order the genes when I insert them into the "feature" argument.

Here is a sample of the code I am currently using to plot the graph:

(Note: I have an object "Combined" that has the non-averaged cell expression, but for now I do want to use average expression)

png("ExpressionHeatmap%03d.png", res=600, width=14, height=7, units="in")
top10 <- Combined.markers %>% group_by(cluster) %>% top_n(n = 10, wt = avg_logFC)    
avg <- AverageExpression(Combined, features = NULL, add.ident = NULL, return.seurat = TRUE, verbose = TRUE)
Combined.markers %>% group_by(cluster) %>% top_n(2000, avg_logFC) -> top

cc.features <- readLines(con = "/home/alex/lab/drugres/DropSeqFiles/regev_lab_cell_cycle_genes.txt")
s.features <- cc.features[1:43]
g2m.features <- cc.features[44:97]
CCS <- CellCycleScoring(object = Combined, s.features = s.features, g2m.features = g2m.features, set.ident = TRUE)
DoHeatmap(avg, features = c("FTH1P3", "MET", "CYR61", "NFKBIA", "RIPK2", "IFI16", "PLK2", "TNFSF10", "CEBPD", "PNRC1"), group.by = "ident", size = 3, angle = 0, combine = TRUE, draw.lines = FALSE) + theme(axis.text.x = element_text(size = 7), axis.line = element_line(colour = "#ffffff")) + scale_fill_gradient2(low = '#1000ff', mid = "#ffffff", high = '#aa0101', space = "Lab", na.value = "#ffffff", midpoint = 0, guide = "colourbar", aesthetics = "fill") + coord_flip(expand = TRUE, clip = "on")

I tried to use the "FindAllMarkers", "group_by" and "top_n" functions to sort the gene data, and while it helped it still didn't fully sort the genes the way I wanted.

markers <- FindAllMarkers(Combined, features = c(genes-i-am-looking-for), only.pos = TRUE, min.pct = 0.25, thresh.use = 0.25, test.use = "biomod")
geneorder <- markers %>% group_by(cluster) %>% top_n(n = number-of-genes, wt = avg_logFC)

I would then replace the 'features' argument in the DoHeatMap function with the 'geneorder' object.

I know that doing a top10 <- combined.markers style function can get me the effect I'm looking for, but I want to do it, with specifically selected genes, rather than just the top 10 expressed per cluster.

Note: this is for v3.1 of Seurat; the latest version of Seurat at the time of asking.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.