jokergoo / EnrichedHeatmap

make enriched heatmap which visualizes the enrichment of genomic signals to specific target regions.
http://jokergoo.github.io/EnrichedHeatmap/
Other
187 stars 25 forks source link

Scale two heatmaps with EnrichedHeatmap #83

Closed noelletnw closed 9 months ago

noelletnw commented 10 months ago

Hello,

I am trying to directly compare two heatmaps to one another using EnrichedHeatmap, but am unable to figure out how to do so. My code is below.

mat1_trim = normalizeToMatrix(signal=fos_bed_ranges, 
                                  target=peaks_ranges, 
                                  value_column = "coverage",
                                  extend = c(1000, 1000), 
                                  mean_mode = "coverage", 
                                  w = 50,
                                  keep = c(0, 0.95))

 mat4_trim = normalizeToMatrix(signal=input_bed_ranges, 
                                  target=peaks_ranges, 
                                  value_column = "coverage",
                                  extend = c(1000, 1000), 
                                  mean_mode = "coverage", 
                                  w = 50, 
                                  keep = c(0, 0.95))

common_min = min(c(mat1_trim, mat4_trim))

common_max = max(c(mat1_trim, mat4_trim))

col_fun = circlize::colorRamp2(c(common_min, common_max), c("white", "red"))

EnrichedHeatmap(mat4_trim, col = c(col_fun), name = "Input", row_order = peaks$row_order, row_title="Ranked by Occupancy") + EnrichedHeatmap(mat1_trim, col = c(col_fun), name = "Fos",  row_order=peaks$row_order, row_title="Ranked by Occupancy")

When I run this, I get the error

Error: You should have at least two distinct break values.

The code works fine without the col_fun I used to set the ranges to be equal. I believe that I understand why it is throwing the error, but am unsure how to work around it.

I appreciate your help!

noelletnw commented 9 months ago

Just following up to see if anyone has any insight on this! Thanks!