jernst98 / ChromHMM

GNU General Public License v3.0
71 stars 18 forks source link

how to associate color and FoldEnrichment in OverlapEnrichment result #28

Closed shangguandong1996 closed 4 years ago

shangguandong1996 commented 4 years ago

Hi, Dr Ernst. I am confused about the color in FoldEnrichment. Below is the result of my OverlapEnrichment.

> chromHMM_overlap
# A tibble: 10 x 8
   `State (Emission order)` `Genome %`   Exon   Gene    TES TES_1k    TSS TSS_1k
   <chr>                         <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>
 1 1                            20.4    1.32   1.78  0.257   0.850 0.126   0.451
 2 2                            38.8    0.858  0.514 1.22    0.916 0.624   0.756
 3 3                             0.700  1.67   1.55  0.541   1.31  0.627   1.16 
 4 4                            13.4    0.852  0.953 1.05    1.22  1.10    1.22 
 5 5                             1.13   0.523  0.602 0.870   0.961 1.95    1.19 
 6 6                            12.5    0.531  0.536 2.05    1.23  2.80    1.40 
 7 7                             2.62   1.71   1.61  0.991   1.18  5.63    2.04 
 8 8                             9.66   1.46   1.76  0.348   0.976 0.575   1.93 
 9 9                             0.778  1.78   1.71  0.276   1.14  0.631   1.79 
10 Base                        100     48.2   55.5   0.0277 41.0   0.0277 44.5  

But I do not know how to associate color and Foldenrichment 图片

In my opinion, maybe you use the column scale, like

chromHMM_overlap %>% 
  mutate_at(c(-1), function(y) (y - min(y)) / (max(y)-min(y)))

# A tibble: 9 x 8
  `State (Emission order)` `Genome %`    Exon   Gene    TES TES_1k    TSS TSS_1k
  <chr>                         <dbl>   <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>
1 1                           0.517   0.638   1      0       0     0       0    
2 2                           1       0.267   0      0.538   0.141 0.0905  0.191
3 3                           0       0.917   0.822  0.158   1     0.0911  0.446
4 4                           0.333   0.262   0.348  0.441   0.798 0.176   0.482
5 5                           0.0113  0       0.0698 0.342   0.238 0.332   0.462
6 6                           0.311   0.00580 0.0174 1       0.808 0.486   0.597
7 7                           0.0503  0.947   0.870  0.409   0.716 1       1    
8 8                           0.235   0.744   0.992  0.0504  0.271 0.0815  0.929
9 9                           0.00204 1       0.950  0.0107  0.624 0.0917  0.844

And I did plot the same plot 图片

But I not know sure whether it is true.So I put a issue.

Best wishes

Guandong Shang

jernst98 commented 4 years ago

Hi Guandong,

By default, ChromHMM transform each column by (y-min(y))/max(y) White corresponds to 0, which each column has after transformation. The darkest blue corresponds to the maximum value after transformation anywhere in the heatmap. There is also an option to use a color scale without any column specific transformation.

I'll document this better in the manual for the next release.

Best, -Jason

shangguandong1996 commented 4 years ago

Thanks, I get it :)