bedtools_unionbedg: bedtools_unionbedg

View source: R/unionbedg.R

bedtools_unionbedgR Documentation

bedtools_unionbedg

Description

Summarize the ranges according to disjoin and construct a matrix of scores (disjoint range by sample/file). Empty cells are filled with NA.

Usage

    bedtools_unionbedg(cmd = "--help")
    R_bedtools_unionbedg(i, header=FALSE, names=NULL, g=NA_character_,
                          empty=FALSE)
    do_bedtools_unionbedg(i, header=FALSE, names=NULL, g=NA_character_,
                           empty=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

Paths to BAM/BED/GFF/VCF/etc files (vector or comma-separated), or a list of objects.

header

Ignored.

names

Provide an alias for each to use for each i instead of their integer index. If a single string, can be comma-separated.

g

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

empty

Report empty regions (i.e., regions not covered in any of the files). This essentially yields a partitioning of the genome (and thus requires g to be specified).

Details

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

bedtools_unionbedg

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

R_bedtools_unionbedg

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

do_bedtools_unionbedg

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

This is essentially the same operation as bedtools_multiinter, except we build a score matrix and embed it into a SummarizedExperiment. This is a bit tricky and relies on the as.matrix,AtomicList-method coercion.

Value

A language object containing the compiled R code, evaluating to a RangedSummarizedExperiment with an assay called “score”.

Author(s)

Michael Lawrence

References

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

See Also

disjoin for forming disjoint ranges, RangedSummarizedExperiment-class for SummarizedExperiment objects.

Examples

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

## End(Not run)

## combine three samples
bedtools_unionbedg("-i a.bedGraph,b.bedGraph,c.bedGraph -names A,B,C")
## include empty ranges (filled with NAs)
bedtools_unionbedg("-i a.bedGraph,b.bedGraph,c.bedGraph -names A,B,C -empty -g test.genome")

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