jokergoo / EnrichedHeatmap

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

EnrichedHeatmap() Error: You should have at least two distinct break values. #44

Closed francisfa closed 4 years ago

francisfa commented 4 years ago

Hi,

When I use EnrichedHeatmap(), If I type

> mat1_trim = normalizeToMatrix(bedFile, t1.bed, value_column = "V5", extend = 3000, mean_mode = "w0", w = 50, keep = c(0, 0.99))
> col_fun = colorRamp2(quantile(mat1_trim, c(0, 0.99)), c("white", "red"))
> EnrichedHeatmap(mat1_trim, col = col_fun, name = Name)

This is OK.

BUT, I type,

> mat1_trim = normalizeToMatrix(bedFile, t2.bed, value_column = "V5", extend = 3000, mean_mode = "w0", w = 50, keep = c(0, 0.99))
> col_fun = colorRamp2(quantile(mat1_trim, c(0, 0.99)), c("white", "red"))
> EnrichedHeatmap(mat1_trim, col = col_fun, name = Name)

Error: You should have at least two distinct break values. The only differences is target files. But I do not find that t1 and t2 have differences:

t1.bed: 1868 targets

GRanges object with 1868 ranges and 8 metadata columns:
         seqnames    ranges strand |        V4          V5              V6          V7        V8        V9       V10
            <Rle> <IRanges>  <Rle> | <integer> <character>     <character> <character> <numeric> <numeric> <numeric>
     [1]    chr17  72777173      * |       165           *  chr17_72777089           *       3.4  3.53e-12  6.97e-08
     [2]     chr1 160651443      * |       201           *  chr1_160651341           *      2.33  7.06e-12  6.97e-08
     ...      ...       ...    ... .       ...         ...             ...         ...       ...       ...       ...
  [1867]     chr9 133646455      * |       301           *  chr9_133646303           *      1.31   0.00423    0.0498
  [1868]     chr5  68660510      * |       186           *   chr5_68660416           *      1.63   0.00424    0.0499

t2.bed: just 17 targets

GRanges object with 17 ranges and 8 metadata columns:
       seqnames    ranges strand |        V4          V5             V6          V7        V8        V9       V10
          <Rle> <IRanges>  <Rle> | <integer> <character>    <character> <character> <numeric> <numeric> <numeric>
   [1]     chr6  37250360      * |       218           *  chr6_37250250           *     -5.43  5.03e-06  0.000907
   [2]     chr3 195634611      * |       344           * chr3_195634438           *     -1.59  1.59e-05   0.00209
   ...      ...       ...    ... .       ...         ...            ...         ...       ...       ...       ...
  [16]    chr17  30627031      * |       199           * chr17_30626930           *     -2.47   0.00398    0.0485
  [17]    chr14  25157395      * |       174           * chr14_25157307           *     -1.29   0.00415    0.0494

So why does it make this error? Thank you!

jokergoo commented 4 years ago

Sorry, I missed you issue here.

You should check the value of quantile(mat1_trim, c(0, 0.99)). I think all the values are zero.

francisfa commented 4 years ago

Yes, all the values are zero. It should be low, so it's surprise that all are zero, but I think it's work. I used the keep = c(0, 0.999) to resolve this issue. Thank you!

jokergoo commented 4 years ago

En.. I think I should write more informative messages for generating a color mapping from the matrix where almost all the values are zero.