bedtools_flank {HelloRanges} | R Documentation

## bedtools_flank

### Description

Compute flanking regions.

### Usage

    bedtools_flank(cmd = "--help")
    R_bedtools_flank(i, b = 0, l = 0, r = 0, s = FALSE, pct = FALSE,
                     g = NULL, header = FALSE)
    do_bedtools_flank(i, b = 0, l = 0, r = 0, s = FALSE, pct = FALSE,
                      g = NULL, header = FALSE)

### Arguments

`cmd` | 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.
`i` | 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.
`b` | Increase the BED/GFF/VCF range by the same number base pairs in each direction. Integer.
`l` | The number of base pairs to subtract from the start coordinate. Integer.
`r` | The number of base pairs to add to the end coordinate. Integer.
`s` | Define `l` and `r` based on strand. For example. if used, `l` is 500 for a negative-stranded feature, it will add 500 bp to the end coordinate.
`pct` | Define `l` and `r` as a fraction of the feature length. E.g. if used on a 1000bp feature, and `l` is 0.50, will add 500 bp upstream..
`g` | Genome file, identifier or Seqinfo object that defines the order and size of the sequences.
`header` | Ignored.

### Details

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

`bedtools_flank`

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

`R_bedtools_flank`

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

`do_bedtools_flank`

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

We compute the flanks with `flank`, although `flank` only computes one side at a time, so we may call it multiple times.

### Value

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

### Author(s)

Michael Lawrence

### References

http://bedtools.readthedocs.io/en/latest/content/tools/flank.html

### See Also

intra-range-methods for `flank`.

### Examples

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

    ## End(Not run)
    ## 5 on both sides
    r <- bedtools_flank("-i a.bed -b 5 -g tiny.genome")
    ## 5 on left side
    bedtools_flank("-i a.bed -l 5 -r 0 -g tiny.genome")
    ## define left/right in terms of transcription direction
    bedtools_flank("-i a.bed -l 5 -r 0 -s -g tiny.genome")

[Package HelloRanges version 1.10.0 Index]