Get Signals from a List

getSignalsFromList(lt, fun = function(x) mean(x, na.rm = TRUE))

Arguments

lt

A list of normalized matrices which are returned by normalizeToMatrix. Matrices in the list should be generated with same settings (e.g. they should use same target regions, same extension to targets and same number of windows).

fun

A user-defined function to summarize signals.

Details

Let's assume you have a list of histone modification signals for different samples and you want to visualize the mean pattern across samples. You can first normalize histone mark signals for each sample and then calculate means values across all samples. In following example code, 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")
    }  

If we compress the list of matrices as a three-dimension array where the first dimension corresponds to genes, the second dimension corresponds to windows and the third dimension corresponds to samples, the mean signal across all sample can be calculated on the third dimension. Here getSignalsFromList simplifies this job.

Applying getSignalsFromList() to mat_list, it gives a new normalized matrix which contains mean signals across all samples and can be directly used in EnrichedHeatmap().

    mat_mean = getSignalsFromList(mat_list)
    EnrichedHeatmap(mat_mean)  

The correlation between histone modification and gene expression can also be calculated on the third dimension of the array. In the user-defined function fun, x is the vector for gene i and window j in the array, and i is the index of current gene.

    mat_corr = getSignalsFromList(mat_list, 
        fun = function(x, i) cor(x, expr[i, ], method = "spearman"))  

Then mat_corr here can be used to visualize how gene expression is correlated to histone modification around TSS.

    EnrichedHeatmap(mat_corr)  

Value

A normalizeToMatrix object which can be directly used for EnrichedHeatmap.

Examples

NULL
#> NULL