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

Description Usage Arguments Value Note Author(s) Examples

View source: R/utils.R

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

1
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

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

bsseq documentation built on Nov. 8, 2020, 7:53 p.m.