Learn R Programming

bsseq (version 1.8.2)

data.frame2GRanges: Converts a data frame to a GRanges.

Description

Converting a data.frame to a GRanges object. The data.frame needs columns like chr, start and end (strand is optional). Additional columns may be kept in the GRanges object.

Usage

data.frame2GRanges(df, keepColumns = FALSE, ignoreStrand = FALSE)

Arguments

df
A data.frame with columns chr or seqnames, start, end and optionally a strand column.
keepColumns
In case df has additional columns, should these columns be stored as metadata columns on the return GRanges or should they be discarded.
ignoreStrand
In case df has a strand column, should this column be ignored.

Value

An object of class GRanges

Examples

Run this code
df <- data.frame(chr = "chr1", start = 1:3, end = 2:4,
                 strand = c("+","-","+"))
data.frame2GRanges(df, ignoreStrand = TRUE)

Run the code above in your browser using DataLab