[BioC] How to convert from IRanges(List) to Rle(List)
Nicolas Delhomme
delhomme at embl.de
Sat Apr 7 14:39:08 CEST 2012
Hi all,
I'm just wondering if there would be a direct way to convert an IRanges to an Rle, as in: as(rng,"Rle"). At the moment, I can convert my IRanges into an integer vector and cast that as an Rle (Rle(as.integer(rng)), but that is not extremely efficient on a long IRangesList (with > 700,000 IRanges in it). Takes ~10 mins with an sapply.
Why I want that is for the following: I have an IRangesList of transcripts (describing exons at the genome level) and for every one, I have a bp position at the transcript level that I want to convert into a genomic bp position. Basically, I need to be able to convert a given transcript coordinate into the corresponding genomic coordinate. My IRanges contain the genomic coordinates of every transcript and by converting it into an integer vector, I can select the right genomic bp coordinate by using the transcript bp coordinate as an index (as.integer(rng)[transcript.pos]).
I considered the IRanges approach because I keep the transcript name and I'm sure that I looking up the right coord in the right transcript, but I'm open to other suggestions.
Thanks for any pointers,
Cheers,
Nico
---------------------------------------------------------------
Nicolas Delhomme
Genome Biology Computational Support
European Molecular Biology Laboratory
Tel: +49 6221 387 8310
Email: nicolas.delhomme at embl.de
Meyerhofstrasse 1 - Postfach 10.2209
69102 Heidelberg, Germany
More information about the Bioconductor
mailing list