Convert an annotated GRanges to a data.frame.

Share:

Description

Converting a GRanges that might be annotated with some kind of results to a data.frame is useful, because it allows easier writing to file and viewing in other programs, like a spreadsheet program.

Usage

1
2
  ## S4 method for signature 'GRanges'
annoGR2DF(anno)

Arguments

anno

A GRanges, describing some genomic features.

Details

The column name seqnames is changed to chr, and if all the strands are *, then the strand column is dropped.

Value

A data.frame of the annotation.

Author(s)

Dario Strbenac

Examples

1
2
3
4
5
6
7
8
9
  require(GenomicRanges)
  chrs <- c("chr1", "chr3", "chr7", "chr22")
  starts <- seq(1000, 4000, 1000)
  ends <- seq(1500, 4500, 1000)
  t <- c(3.11, 0.93, 2.28, -0.18)
  gc <- c("High", "High", "Low", "High")
  gr <- GRanges(chrs, IRanges(starts, ends), strand = '*', t, gc)

  annoGR2DF(gr)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.