bedtools_slop: bedtools_slop

View source: R/slop.R

bedtools_slopR Documentation

bedtools_slop

Description

Widen ranges on the left and/or right side.

Usage

bedtools_slop(cmd = "--help")
R_bedtools_slop(i, b = 0, l = 0, r = 0, s = FALSE, pct = FALSE,
                g = NULL, header = FALSE)
do_bedtools_slop(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

Widen the same number base pairs in each direction.

l

The number of base pairs to subtract from the start coordinate.

r

The number of base pairs to add to the end coordinate.

s

Define l and r based on strand. For example. if TRUE, l=500 for a negative-stranded feature 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 slop command:

bedtools_slop

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

R_bedtools_slop

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

do_bedtools_slop

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

This is a fairly straight-forward application of resize and the + operator on GRanges.

Value

A language object containing the compiled R code, evaluating to a GRanges, or similar, object. In principle, this is an endomorphism.

Author(s)

Michael Lawrence

References

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

See Also

intra-range-methods for resize.

Examples

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

## End(Not run)
## widen on both ends
bedtools_slop("-i a.bed -b 5 -g tiny.genome")
## widen only on the left end
bedtools_slop("-i a.bed -l 5 -r 0 -g tiny.genome")

lawremi/HelloRanges documentation built on Oct. 29, 2023, 4:08 p.m.