Learn R Programming

EnrichedHeatmap (version 1.2.2)

makeWindows: Split regions into windows

Description

Split regions into windows

Usage

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

Arguments

query
a GRanges 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 splitted equally under the window size, whether to keep the windows that are smaller than the window size. See 'Details' section.

Value

  • A GRanges object with two additional columns attached:

    • .i_querywhich contains the correspondance between small windows and original regions inquery
    • .i_windowwhich contains the index of the small window on the current region.

Details

Following illustrates the meaning of direction and short.keep:

----->---- one region, split by 3bp window (">" means 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

Examples

Run this code
query = GRanges(seqnames = "chr1", ranges = IRanges(start = c(1, 11, 21), end = c(10, 20, 30)))
makeWindows(query, w = 2)
makeWindows(query, w = 0.2)
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)

Run the code above in your browser using DataLab