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

Use pheatmap instead of aheatmap? #224

Open
epurdom opened this issue Sep 29, 2017 · 4 comments
Open

Use pheatmap instead of aheatmap? #224

epurdom opened this issue Sep 29, 2017 · 4 comments

Comments

@epurdom
Copy link
Owner

epurdom commented Sep 29, 2017

Look into using pheatmap which is like aheatmap but puts names on side (like my hack does, but built into the function, and also for genes).

@drisso
Copy link
Collaborator

drisso commented Sep 29, 2017 via email

@epurdom
Copy link
Owner Author

epurdom commented Feb 3, 2018

@drisso One question I had was whether pheatmap works with par(mfrow=c(1,2)) so that you can do side by side heatmaps (or other graphs) with pheatmap? I've just fixed a bug in plotHeatmap so that now it uses this feature reliably.

I think the first step would be an option to switch between them. Which would be complicated because their arguments are called different things, so all of the arguments that people just pass to aheatmap would not work with pheatmap.

@epurdom
Copy link
Owner Author

epurdom commented Feb 5, 2018

Indeed par(mfrow=c(1,2)) doesn't work with phatmap but does work with aheatmap:

test = matrix(rnorm(200), 20, 10)
test[1:10, seq(1, 10, 2)] = test[1:10, seq(1, 10, 2)] + 3
test[11:20, seq(2, 10, 2)] = test[11:20, seq(2, 10, 2)] + 2
test[15:20, seq(2, 10, 2)] = test[15:20, seq(2, 10, 2)] + 4
colnames(test) = paste("Test", 1:10, sep = "")
rownames(test) = paste("Gene", 1:20, sep = "")

par(mfrow=c(1,2))
pheatmap(test)
pheatmap(test, kmeans_k = 2)

pheatmap does use the grid graphics package, but I suspect that it clears existing grid layouts so you can't use grid to get them side-by-side (seen something suggesting that on posts). The following, based on my limited grid knowledge, should work to put pheatmap on one side and text on the right but it doesn't. So it doesn't seem easy to go outside of it to make side-by-side.

grid.newpage()
pushViewport(viewport(layout=grid.layout(ncol=2, nrow=1)))
pushViewport(viewport(layout.pos.col=2, layout.pos.row=1))
  grid.rect()
  grid.text("Right side")
popViewport(1)
pushViewport(viewport(layout.pos.col=1, layout.pos.row=1))
pheatmap(test)
popViewport(2)

Indeed aheatmap was originally a fork off of pheatmap and it sounds like side-by-side heatmaps were a big goal.

Side-by-side is a big feature for me, but I agree working within RStudio is pretty important for many.

@drisso
Copy link
Collaborator

drisso commented Feb 5, 2018

Yeah, I understand your point.

I'm using RStudio and R markdown pretty much all the time now, so I never use side-by-side graphs and having a heat map that works with RStudio is a big plus for me.

Perhaps the only way around this would be to give the option of using one or the other. But I'm not sure this is ideal either... especially because it will require some non-trivial adjustments to the plotHeatmap functions.

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

No branches or pull requests

2 participants