getSignalsFromList(lt, fun = function(x) mean(x, na.rm = TRUE))
normalizeToMatrix
. Objects in the list should come from same settings.normalizeToMatrix
object which can be directly used for EnrichedHeatmap
.hm_gr_list
is a list of GRanges
objects
which contain positions of histone modifications, tss
is a GRanges
object containing positions of gene TSS.mat_list = NULL for(i in seq_along(hm_gr_list)) { mat_list[[i]] = normalizeToMatrix(hm_gr_list[[i]], tss, value_column = "density") }
Applying getSignalsFromList()
to mat_list
, it gives a new normalized matrix which contains mean signals and can
be directly used in EnrichedHeatmap()
.
mat = getSignalsFromList(mat_list) EnrichedHeatmap(mat)
Next let's consider a second scenario: we want to see the correlation between histone modification and gene expression.
In this case, fun
can have a second argument so that users can correspond histone signals to the expression of the
associated gene. In following code, expr
is a matrix of expression, columns in expr
correspond to elements in hm_gr_list
,
rows in expr
are same as tss
.
mat = getSignalsFromList(mat_list, fun = function(x, i) cor(x, expr[i, ], method = "spearman"))
Then mat
here can be used to visualize how gene expression is correlated to histone modification around TSS.
EnrichedHeatmap(mat)