[BioC] interoperability between IRanges/ShortRead and rtracklayer

Simon Anders anders at ebi.ac.uk
Thu Jun 4 15:37:55 CEST 2009


Dear Patrick, Hervé, Michael or Martin

I'm unclear on how to get from an IRanges Rle object to a RangedData 
object to use with rtracklayer's export function.

The use case is as follows:

Let's say I caclulate a coverage vector from some ChIP-Seq data, e.g.:

    library(IRanges)
    library(ShortRead)
    library(rtracklayer)
    library(BSgenome.Mmusculus.UCSC.mm9)

    # Load the example data from the ChIP-Seq tutorial
    load("ctcf.rda")

    # Calculate the coverage
    cvg = coverage( ctcf, width = seqlengths( Mmusculus ) )

Then, I get a GenomeData object that contains Rle objects:

    > cvg
    A GenomeData instance
    chromosomes(3): chr10 chr11 chr12
    > cvg$chr10
      'integer' Rle instance of length 129987043 with 308238 runs
      Lengths:  24 968 5 3 11 5 3 2 2 2 ...
      Values :  1 0 1 2 3 4 3 4 3 4 ...

Given that coverage data is a very typical case of something that one 
would like to display as a track in a genome browser, it would be nice 
if the rtracklayer object could deal with it. For example I might want 
to export the 'cvg' object as a wiggle file with rtracklayer's 'export' 
function or add it to a browser session with the 'track<-' function.

However, 'export' cannot deal with it

 > export( cvg, "wig" )
Error in function (classes, fdef, mtable)  :
   unable to find an inherited method for function "export.ucsc", for 
signature "GenomeData"
 > export( cvg$chr10, "wig" )
Error in function (classes, fdef, mtable)  :
   unable to find an inherited method for function "export.ucsc", for 
signature "Rle"

It seems that it expects a RangedData object, or, alternatively, a 
RangedDataList.

It seems to me that there should be a one-to-one correspondance from Rle 
to RangedData and from GenomeData to RangedDataList. How can I convert 
from one to the other? And why are there both kinds of classes?

Thanks in advance.

   Simon


+---
| Dr. Simon Anders, Dipl. Phys.
| European Bioinformatics Institute, Hinxton, Cambridgeshire, UK
| office phone +44-1223-492680, mobile phone +44-7505-841692
| preferred (permanent) e-mail: sanders at fs.tum.de



More information about the Bioconductor mailing list