toGRanges {regioneR} | R Documentation |
Transforms a file or an object containing a region set into a GRanges
object.
toGRanges(A, ...)
A |
a |
... |
further arguments to be passed to other methods. |
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.
If A is not a data.frame and there are more parameters, it will try to build a data.frame with all
parameters and use that data.frame to build the GRanges. This allows the user to call it like
toGRanges("chr1", 10, 20)
.
A GRanges
object with the regions in A
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)