getSignalsFromList: Get signals from a list

Description Usage Arguments Details Value Author(s) Examples

Description

Get signals from a list

Usage

1
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. If we assume elements in lt correspond to different samples, the user-defined function calculates e.g. mean signal for each window.

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.

1
2
3
4
    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().

1
2
    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.

1
2
    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.

1

Value

A normalizeToMatrix object which can be directly used for EnrichedHeatmap.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

1

eilslabs/EnrichedHeatmap documentation built on May 16, 2019, 1:22 a.m.