lvulliard / BioCircos.R

Htmlwidgets binding R commands to the BioCircos.js library
GNU General Public License v2.0
36 stars 9 forks source link

Non-linear color interpolation in heatmap tracks #9

Open koalive opened 4 years ago

koalive commented 4 years ago

Hello Loan,

I've started using the BioCircos package you and your collaborators created for R, it's very handy for easily creating visualizations with genomic data! I thought I would email to see whether it might be possible to implement a new feature in a future version of the package.

I'm specifically interested in the BioCircosHeatmapTrack function. It does not currently seem possible to specify more than two colors, as well as breakpoints in the range of values for which these colors should be used (e.g. range of values for color1, range of values for color2, range of values for color3, etc.). This functionality would be really useful in instances where a linear interpolation of two colors is not capable of highlighting specific relationships within your data. For example, it may be that for a range of 0.0-1.0, values ranging from 0.2 to 1.0 are of equal importance and should be highlighted with the same color. Alternatively, it could be that values ranging from 0.0-0.2 require a specific color, 0.21-0.80 another color, and 0.81 to 1.0 a third color. I'm wondering if something like this might be easy to implement in the package?

Again, the package itself is quite useful, and really user-friendly...the documentation, vignettes, etc. are all really great! I just came across this particular problem with my own data and thought it might not hurt to get in touch, perhaps other users might also find this functionality useful!

Hello X,

Glad you're interested in the BioCircos package. Would you mind if I add your suggestion as a potential enhancement to the GitHub repository? I unfortunately don't have time to add this feature myself right now but it could be documented for later, or in case someone external wants to contribute to the package. In the meantime, did you consider rescaling the data so that all the entries that should share the same color have the same values (e.g. something like sapply(yourData, function(x) min(x, 0.2)) in your first example)? That is however not a perfect solution, as the value displayed in the tooltip when you hover the heatmap would not much the original data anymore... Best regards,

Loan