makeWindows: Split Regions into Windows

Description Usage Arguments Details Value Author(s) Examples

View source: R/normalize.R

Description

Split Regions into Windows

Usage

1
2
makeWindows(query, w = NULL, k = NULL, direction = c("normal", "reverse"),
    short.keep = FALSE)

Arguments

query

A GRanges-class object.

w

Window size. A value larger than 1 means the number of base pairs and a value between 0 and 1 is the percent to the current region.

k

Number of partitions for each region. If it is set, all other arguments are ignored.

direction

Where to start the splitting? See 'Details' section.

short.keep

If the the region can not be split equally under the window size, the argument controls whether to keep the windows that are smaller than the window size. See 'Details' section.

Details

Following illustrates the meaning of direction and short.keep:

1
2
3
4
5
    -->-->-->-  one region, split by 3bp window (">" represents the direction of the sequence)
    aaabbbccc   direction = "normal",  short.keep = FALSE
    aaabbbcccd  direction = "normal",  short.keep = TRUE
     aaabbbccc  direction = "reverse", short.keep = FALSE
    abbbcccddd  direction = "reverse", short.keep = TRUE  

Value

A GRanges-class object with two additional columns attached:

Author(s)

Zuguang gu <z.gu@dkfz.de>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
query = GRanges(seqnames = "chr1", ranges = IRanges(start = c(1, 11, 21), end = c(10, 20, 30)))
makeWindows(query, w = 2)
makeWindows(query, w = 0.5)
makeWindows(query, w = 3)
makeWindows(query, w = 3, direction = "reverse")
makeWindows(query, w = 3, short.keep = TRUE)
makeWindows(query, w = 3, direction = "reverse", short.keep = TRUE)
makeWindows(query, w = 12)
makeWindows(query, w = 12, short.keep = TRUE)
makeWindows(query, k = 2)
makeWindows(query, k = 3)
query = GRanges(seqnames = "chr1", ranges = IRanges(start = c(1, 11, 31), end = c(10, 30, 70)))
makeWindows(query, w = 2)
makeWindows(query, w = 0.2)

EnrichedHeatmap documentation built on Nov. 8, 2020, 8:20 p.m.