Use a set of continuous restriction fragments to generate windows containing a fixed number of fragments (n_frags).

makeWindowFragments(input, n_frags = 8, sliding = 1)

Arguments

input

Input object containing the restriction fragments. Should be class UMI4C (rowRanges will be extracted) or class GRanges.

n_frags

Number of fragments to use for generating the windows. This should include restriction fragments with 0 counts (Default: 8).

sliding

Numeric indicating the factor for generating sliding windows. If set to 1 (default) will use fixed windows. If set to > 0 and < 1 will use n_frags * sliding fragments to generate sliding windows.

Value

A GRanges object containing the windows of merged restriction fragments.

Examples

data("ex_ciita_umi4c") # Without sliding windows win_frags <- makeWindowFragments(ex_ciita_umi4c, n_frags=30, sliding=1) win_frags
#> GRanges object with 31 ranges and 2 metadata columns: #> seqnames ranges strand | mcols.id mcols.position #> <Rle> <IRanges> <Rle> | <character> <character> #> [1] chr16 10821764-10826076 * | window_UP_17 upstream #> [2] chr16 10826077-10834075 * | window_UP_16 upstream #> [3] chr16 10834076-10841829 * | window_UP_15 upstream #> [4] chr16 10841830-10851099 * | window_UP_14 upstream #> [5] chr16 10851100-10860015 * | window_UP_13 upstream #> ... ... ... ... . ... ... #> [27] chr16 11076798-11086315 * | window_DOWN_10 downstream #> [28] chr16 11086316-11097813 * | window_DOWN_11 downstream #> [29] chr16 11097814-11108134 * | window_DOWN_12 downstream #> [30] chr16 11108135-11117870 * | window_DOWN_13 downstream #> [31] chr16 11117871-11121833 * | window_DOWN_14 downstream #> ------- #> seqinfo: 1 sequence from an unspecified genome; no seqlengths
# With sliding windows (n_frags*sliding) win_frags <- makeWindowFragments(ex_ciita_umi4c, n_frags=30, sliding=0.5) win_frags
#> GRanges object with 60 ranges and 2 metadata columns: #> seqnames ranges strand | mcols.id mcols.position #> <Rle> <IRanges> <Rle> | <character> <character> #> [1] chr16 10821764-10826076 * | window_UP_33 upstream #> [2] chr16 10821764-10830484 * | window_UP_32 upstream #> [3] chr16 10826077-10834075 * | window_UP_31 upstream #> [4] chr16 10830485-10837321 * | window_UP_30 upstream #> [5] chr16 10834076-10841829 * | window_UP_29 upstream #> ... ... ... ... . ... ... #> [56] chr16 11097814-11108134 * | window_DOWN_23 downstream #> [57] chr16 11103787-11112382 * | window_DOWN_24 downstream #> [58] chr16 11108135-11117870 * | window_DOWN_25 downstream #> [59] chr16 11112383-11121833 * | window_DOWN_26 downstream #> [60] chr16 11117871-11121833 * | window_DOWN_27 downstream #> ------- #> seqinfo: 1 sequence from an unspecified genome; no seqlengths