rlbarter / superheat

An r package for generating beautiful and customizable heatmaps
https://rlbarter.github.io/superheat/
235 stars 29 forks source link

Order of columns when setting membership.cols #26

Closed FloWuenne closed 7 years ago

FloWuenne commented 7 years ago

Hi Rebecca,

I am having a issue with setting the order of user supplied column memberships. When I set the columns using membership.cols or even when I just want to reorder my columns in the heatmap, I always get an error with order.cols:

Error in (function (X, X.text = NULL, yt = NULL, yr = NULL, heat.lim = NULL, : 'order.cols' must be a vector containing the column indexes of 'X'.

As a simple example for reproducibility and to see whether my understanding of how the order.cols should work here a quick example that produces this error for me:

test_df <- data.frame("S1"=c(1,2,3,4),"S2"=c(2,3,4,5),"S3"=c(2,2,2,2))
superheat(test_df,
          order.cols = c(2,3,1))

I am supplying a vector of column indexes that has the same length as ncol of my matrix. I could not find an example for this sort of reordering in your otherwise excellent vignette. Could you please help me with this issue?

Thank you so much and keep up the great work with superheat!

Best,

Florian

rlbarter commented 7 years ago

Hi Florian,

Thanks for getting in touch! Turns out this was a minor bug in my error message function that was comparing an integer vector to a numeric vector and claiming that they were not identical (when they really should be). It should be fixed now. Please reinstall the package from github:

devtools::install_github("rlbarter/superheat")

and let me know if you are still getting the error message :)

Rebecca

FloWuenne commented 7 years ago

Works well now. Had to restart R after updating due to dplyr issue, if anybody runs into the same problem but worked well after a simple RStudio restart!

You can close the issue! :+1: