ranged.to.data.frame: Convert RangedData/GRanges to a data.frame

Description Usage Arguments Value See Also Examples

View source: R/humarray.R

Description

Convert a RangedData/GRanges object to a data.frame with columns chr, start and end. Default is to only translate the chromosome and position information, which is faster. Using 'include.cols'=TRUE allows all the columns from 'ranged' to be taken across to the resulting data.frame.

Usage

1
ranged.to.data.frame(ranged, include.cols = FALSE, use.names = TRUE)

Arguments

ranged

A RangedData or GRanges object

include.cols

logical, whether to also bring across non-positional columns to the resulting data.frame

use.names

logical, whether to keep the rownames from the original object for the output. Only has an effect when include.cols=FALSE, otherwise original rownames are always kept.

Value

A data.frame with columns chr, start and end, and depending on chosen parameters, the same rownames as the input, and optionally the same additional columns.

See Also

df.to.ranged, df.to.GRanges

Examples

1
2
3
4
5
6
7
rd <- rranges(9,GRanges=FALSE, fakeids=TRUE)
rd[["fakecol"]] <- sample(nrow(rd))
rd[["rs.id"]] <- paste0("rs",sample(10000,9))
ranged.to.data.frame(rd)
ranged.to.data.frame(rd,,FALSE)
ranged.to.data.frame(rd,TRUE) # keep all the columns
df.to.GRanges(ranged.to.data.frame(rd,TRUE)) # inverse returns original

humarray documentation built on Nov. 20, 2017, 1:05 a.m.