Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorder cells by expression value in DoHeatmap & Dendogram #3036

Closed
summerrfair opened this issue May 19, 2020 · 5 comments
Closed

Reorder cells by expression value in DoHeatmap & Dendogram #3036

summerrfair opened this issue May 19, 2020 · 5 comments

Comments

@summerrfair
Copy link

Two questions RE: DoHeatmap

  1. Is there a straight-forward way to re-order the cells by their level of feature expression (e.g. re-order the plot below by decreasing GFAP expression left-to-right? If so, can someone provide an example?

  2. I subsetted my object to create another object that includes a single cluster. Instead of clustering this new object, I'd like to find out how the cells group based on their expression of markers of interest (e.g. with a heatmap dendogram). Is this functionality possible with DoHeatmap?

image

@mxposed
Copy link
Contributor

mxposed commented May 23, 2020

Hope this helps
https://stackoverflow.com/questions/52136211/how-to-reorder-cells-in-doheatmap-plot-in-seurat-ggplot2

@andrewwbutler
Copy link
Collaborator

Re point 2, DoHeatmap doesn't support these kinds of dendrogram plots. However, it's worth noting that in order to draw those dendrograms, the cells would still need to be clustered in some way so I'd just recommend re-clustering the new object in that scenario.

@Elo-mars
Copy link

Elo-mars commented Feb 6, 2024

Hi @summerrfair ,
could you manage to do it?
the link provided by @mxposed doesn't help me ...

I also have a DoHeatmap that I want to order from low to high expression on 1 gene (multiple genes on my heatmap, but we care about one in particular)

any help would be greatly appreciated :)

@Eomesodermin
Copy link

Eomesodermin commented Feb 9, 2024

not very nice, and not particularly efficient but something like this might work and might help you get to where you want to be.

extract data for gene of interest
x <- temp.seurat@assays$originalexp@data["Ifng", ]

x <- t(x)
x <- as.data.frame(x)
order.index <- order(x$V1, decreasing = T)
cell.order <- rownames(x)[order.index]

DoHeatmap(temp.seurat,
cells = cell.order,
features = c("Ifng", "Tnf"))

@Elo-mars
Copy link

Elo-mars commented Feb 9, 2024

not very nice, and not particularly efficient but something like this might work and might help you get to where you want to be.

extract data for gene of interest x <- temp.seurat@assays$originalexp@data["Ifng", ]

x <- t(x) x <- as.data.frame(x) order.index <- order(x$V1, decreasing = T) cell.order <- rownames(x)[order.index]

DoHeatmap(temp.seurat, cells = cell.order, features = c("Ifng", "Tnf"))

thanks @Eomesodermin ,

the 1st line was not working for me, so I did:

x<- FetchData(SAMPLE, vars = "Gene", use.scaled = TRUE) 
x <- as.data.frame(x)
head(x)
order.index <- order(x$Gene, decreasing = FALSE)
cell.order <- rownames(x)[order.index]
head(cell.order)
  
  DoHeatmap(object = SAMPLE, cells = cell.order,features=c(Gene,"xxx","yyy","zzz"), group.by = "Pain_score", label = TRUE, angle=45) 

and it worked :)
thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants