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

Scaling and couple of formatting questions #14

Closed
josruirod opened this issue Aug 3, 2017 · 4 comments
Closed

Scaling and couple of formatting questions #14

josruirod opened this issue Aug 3, 2017 · 4 comments

Comments

@josruirod
Copy link

Hello and first of all thanks for the very nice package and your development, it's a real contribution and the complex modular plots approach is really interesting.

Please allow me to make you some questions I have been struggling with, after carefully reviewing the net and the vignette. I can try further pre-processing the data before plotting, but I have decided to ask to make sure the package does not have these functionalities:

  • The color scales of heatmap has confused me from the beginning. While others packages force the scale to a certain range, (-1.5, 1.5) for example, with iheatmapr I see other ranges and I'm afraid that's making the interpretation difficult when plotting data with different ranges. Is there any way of forcing the rescaling of the data to a certain range? In some cases we could see clearer patterns and better compare different plots.

  • I have performed custom clustering of the features in the rows and assigning it with add_row_clusters is working as expected. The reordering is nice, but I was wondering how each element is ordered inside the same cluster. Is there any way of controlling these? For example, within each row cluster plotting the elements sorted in decreasing or increasing order according to some column

  • I have not found any way of adding custom text annotations to the plot. Adding blocks of text, for example to annotate or add information to row/columns clusters would be a nice feature in this modular context.

Thank you for your package and your time

@AliciaSchep
Copy link
Contributor

Thanks for your questions @josruirod ! Preliminary thoughts:

  • Can you share an example of what you mean? I'm not sure I fully understand the desired behavior.
  • With add_row_clusters there is currently no option to control the ordering within clusters. That seems like a useful feature. For now, there are lower level functions that allow you to control the ordering and clustering more finely. I'll try to make an example of that to share.
  • No methods for custom text annotations (other than the add_col_labels and add_col_title). The add_col_labels type of method might be able to be adapted for this use case, although it wouldn't be straightforward (basic idea is that you can specify what columns to label (doesn't need to be all and what label you want to use, so you could just label one row per cluster).

@josruirod
Copy link
Author

josruirod commented Aug 18, 2017

Thank for your clarifications.

  • Forgive my poor explanation, I give some example now using "Indometh_patient_cor" dataset from the Vignette

iheatmap(Indometh_patient_cor,name = "Correlation",
scale = c("rows"), scale_method = c("center"))
This provides a heatmap where the values range to -0.03 to 0.029.

Using the same matrix with other typical heatmaps packages, like pheatmap, that scale changes.
pheatmap(Indometh_patient_cor, scale = c("row"))

I believe pheatmap scaling row-wise takes also into account sd, but what I find interesting is that by default provides a colorbar ranging from -1.5 to 1.5 value. And the fact that this can be changed using the breaks argument for example.

I wondered if in any way we can control the range of values in the colorbar with your function. It could be interesting for example to get the same range of positive or negative values or to force the same scale in different plots in order to compare them.

  • Thanks for your insights about the last points. Regarding the ordering, I have indeed used other functions and then provided my desired order to the plot. I'm sure an example is something nice to add, it would be useful to the ones who did not think about it at first.
    Regarding the custom text annotations, as far as I'm concerned there are no equivalent functions to text() or mtext() to use in interactive plots like these. A similar method specifying custom text and coordinates or location would be great to fine tuning the annotation, but of course it's not a big problem.

Thank you so much for answering and for your feedback!

@AliciaSchep
Copy link
Contributor

Thanks for the clarification about the scaling!

Regarding the scale issue, "center" just subtracts the mean, while "standardize" subtracts the mean and divides by the standard deviation. The "standardize" option will give results comparable to pheatmap scaling method. I realize this wasn't very clear in documentation and have updated the man page for iheatmap function.

For more control over min/max of range, using the lower level main_heatmap function gives more options -- the zmin and zmax arguments specify the max/min of the colorbar/scale. You can also pass those arguments to iheatmap as all extra arguments to iheatmap get passed along to main_heatmap. Currently no options to fine tune the exact breaks desired, but I agree that would be a nice additional feature.

@josruirod
Copy link
Author

Thank you so much for your insights, all clear now. Regards

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

2 participants