data.frame2GRanges {bsseq} | R Documentation

## 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`

### Note

In case `df` has `rownames`, they will be used as `names` for the return object.

### Author(s)

Kasper Daniel Hansen khansen@jhsph.edu

### Examples

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

[Package bsseq version 1.22.0 Index]