bedtools_complement: bedtools_complement

View source: R/complement.R

bedtools_complementR Documentation



Finds regions of the genome that are not covered by a genomic dataset.


bedtools_complement(cmd = "--help")
R_bedtools_complement(i, g)
do_bedtools_complement(i, g)



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.


A genome file, identifier or Seqinfo object that defines the order and size of the sequences.


As with all commands, there are three interfaces to the complement 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_complement. Recommended only for demonstration and testing. It is best to integrate the compiled code into an R script, after studying it.

The generated code is subtracts, via setdiff, the ranges from the set of ranges representing the entire genome.

While it may be tempting to call gaps instead, it is very unlikely to behave as expected. The GenomicRanges set operations treat all three strand values (+, -, *) as separate spaces. gaps takes as its universe the genome on all three strands, rather than just the “*” strand, resulting in extraneous stranded ranges.


A language object containing the compiled R code, evaluating to a GRanges object with the complementary ranges.


Michael Lawrence


See Also

setops-methods for the various set operations.


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

## End(Not run)
bedtools_complement("-i a.bed -g test.genome")

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