discretize: Discretize a Continuous Matrix to a Discrete Matrix

View source: R/normalize.R

discretizeR Documentation

Discretize a Continuous Matrix to a Discrete Matrix

Description

Discretize a Continuous Matrix to a Discrete Matrix

Usage

discretize(mat, rule, right_closed = FALSE)

Arguments

mat

A normalize matrix from normalizeToMatrix.

rule

A list of intervals which provide mapping between continuous values to discrete values. Note the order of intervals determines the order of corresponding discrete levels.

right_closed

Is the interval right closed?

Details

Assuming we have a normalized matrix with both positive values and negative values, we only want to see the enrichment of the windows/regions showing significant positive values and negative values and we are only interested in the direction of the values while not the value itself, then we can define the rule as:

    rule = list(
        "positive" = c(0.5, Inf),
        "negative" = c(-Inf, -0.5)
    )  

And we can convert the continuous matrix to a discrete matrix and visualize it:

    mat2 = discretize(mat, rule)
    EnrichedHeatmap(mat2, col = c("positive" = "red", "negative" = "green"))  

Another example is to discretize the signals to discrete levels according to the intensities:

    rule = list(
        "very_high" = c(100, Inf),
        "high" = c(50, 100),
        "intermediate" = c(25, 50),
        "low" = c(1e-6, 25)
    )  

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

# There is no example
NULL


jokergoo/EnrichedHeatmap documentation built on Feb. 27, 2024, 6:43 p.m.