[BioC] How to convert from IRanges(List) to Rle(List)

Martin Morgan mtmorgan at fhcrc.org
Sat Apr 7 20:12:40 CEST 2012


On 04/07/2012 05:39 AM, Nicolas Delhomme wrote:
> 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.

Hi Nico -- VariantAnnotation::refLocsToLocalLocs, 
GenomicFeatures::transcriptLocs2refLocs and IRanges::map might do this 
for you; no direct experience on my part, though. Martin

>
> 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
>
> _______________________________________________ Bioconductor mailing
> list Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor Search the
> archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor


-- 
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793



More information about the Bioconductor mailing list