bedtools_makewindows: bedtools_makewindows

View source: R/makewindows.R

bedtools_makewindowsR Documentation



Generate a partitioning/tiling or set of sliding windows over the genome or a set of ranges.


bedtools_makewindows(cmd = "--help")
R_bedtools_makewindows(b, g = NA_character_, w, s, n)
do_bedtools_makewindows(b, g = NA_character_, w, s, n)



String of bedtools command line arguments, as they would be entered at the shell. There are a few incompatibilities between the docopt parser and the bedtools style. See argument parsing.


Path to a BAM/BED/GFF/VCF/etc file, a BED stream, a file object, or a ranged data structure, such as a GRanges. Use "stdin" for input from another process (presumably while running via Rscript). For streaming from a subprocess, prefix the command string with “<”, e.g., "<grep foo file.bed". Any streamed data is assumed to be in BED format. Windows are generated with each range. Exclusive with g.


A genome file, identifier or Seqinfo object that defines the order and size of the sequences. Specifying this generates windows over the genome. Exclusive with b.


Window size, exclusive with n.


Step size (generates sliding windows).


Number of windows, exclusive with w.


As with all commands, there are three interfaces to the makewindows command:


Parses the bedtools command line and compiles it to the equivalent R code.


Accepts R arguments corresponding to the command line arguments and compiles the equivalent R code.


Evaluates the result of R_bedtools_makewindows. Recommended only for demonstration and testing. It is best to integrate the compiled code into an R script, after studying it.

We view the generation of a partitioning (or tiling) as a distinct use case from the generation of sliding windows. The two use cases correspond to the tile and slidingWindows functions, respectively.


A language object containing the compiled R code, evaluating to a a GRangesList containing the windows for each range (or chromosome).


Michael Lawrence


See Also

tile-methods for generating windows.


## Not run: 
setwd(system.file("unitTests", "data", "makewindows", package="HelloRanges"))

## End(Not run)

## tiles of width 5000
bedtools_makewindows("-b input.bed -w 5000")
## sliding windows, 5kb wide, every 2kb
bedtools_makewindows("-b input.bed -w 5000 -s 2000")
## 3 tiles in each range
bedtools_makewindows("-b input.bed -n 3")
## 3 tiles for each chromosome of the genome
bedtools_makewindows("-g test.genome -n 3")

lawremi/HelloRanges documentation built on April 20, 2022, 5:40 p.m.