Question about target_ratio in normalizeToMatrix
AstreChen opened this issue · 2 comments
Thanks to the awsome package EnrichedHeatmap.
I'm new to EnrichedHeatmap, and get used to the rules of spliting region in deeptools. I'm ploting the signal around gene body region. I want to split the gene body region by 100 windows, and upstream or downstream for 50k with 1k bin.
However, I need to compute the target_ratio first by following rules: k =(n1+n2)*r/(1-r), where r is the target_ratio and k is set to 100, n1 and n2 is set to 50. http://bioconductor.org/packages/devel/bioc/vignettes/EnrichedHeatmap/inst/doc/EnrichedHeatmap.html#toc_9
r = 0.5
mat1 = normalizeToMatrix(husignal, intg, value_column = "score",
extend = 50000, w = 1000, mean_mode = "absolute", smooth = T, target_ratio = 0.5)
However, in the figure I obtained, the gene body region is splitted into 9 bins not 10 bins. I suppose the gene body region is normalized to 100k, which makes sure the same scale of upstream and downstream. Thus, I expected the region is 10k/bin. Could author explain why?
And could author provide a convenient way to set normalized region scale? I will quite appreciate it.
First I am very sorry I missed your question!
Did you get the "9 bins" from the axis at the bottom of the heatmap? That doesn't mean anything, this axis always have 10 ticks (9 intervals) for all enriched heatmaps.
Second, the gene body are not normalized to 10k, but instead, the values corresponding to gene bodies are more like percentage values, e.g. 10% of the gene body length.
I used the dataset which is available in EnrichedHeatmap package, and with the same setting as yours:
> library(EnrichedHeatmap)
> load(system.file("extdata", "chr21_test_data.RData", package = "EnrichedHeatmap"))
> mat3 = normalizeToMatrix(meth, cgi, value_column = "meth", mean_mode = "absolute",
+ extend = 50000, w = 1000, background = NA, smooth = TRUE, target_ratio = 0.5)
> mat3
Normalize meth to cgi:
Upstream 50000 bp (50 windows)
Downstream 50000 bp (50 windows)
Include target regions (100 windows)
365 target regions
As you can see, the body is split into 100 windows.