Learn R Programming

regioneR (version 1.4.0)

toGRanges: toGRanges

Description

Transforms a file or an object containing a region set into a GRanges object.

Usage

toGRanges(A, ...)

Arguments

A
a data.frame containing a region set, a GRanges object, a BED file or any type of file supported by rtracklayer
...
further arguments to be passed to other methods.

Value

A GRanges object with the regions in A

Details

If A is already a GRanges object, it will be returned untouched.

If A is a file name or connection to a file in any of the formats supported by rtracklayer's import function (BED, GFF...) it will be imported using rtracklayer. If A is a data frame, the function will assume the first three columns are chromosome, start and end and create a GRanges object. Any additional column will be considered metadata and stored as such in the GRanges object.

See Also

toDataframe

Examples

Run this code
A <- data.frame(chr=1, start=c(1, 15, 24), end=c(10, 20, 30),  x=c(1,2,3), y=c("a", "b", "c"))

toGRanges(A)

Run the code above in your browser using DataLab