[BioC] selecting score(GRanges_object) based on coordinates

Philip Lijnzaad p.lijnzaad at umcutrecht.nl
Mon Feb 3 13:07:10 CET 2014


Dear all,

I can't seem to select a run of scores from GRanges object, using the
coordinates from another GRanges object.

An example:

coverage <- GRanges(seqnames="chrI",

              ranges=IRanges(start=c(1,11,21), width=10),

              score=c(0, 42, 0)

              )

feature <- GRanges(seqnames="chrI", ranges=IRanges(start=5, end=25))

In ascii this looks like:

coverage: ...__________----------__________...

feature:  .......xxxxxxxxxxxxxxxxxxxxx........

wanted:          _____----------______

I tried using

    score(subsetByOverlaps(coverage, feature))

which I hope  would give me back

    0  0  0  0  0 42 42 42 42 42 42 42 42 42 42  0  0  0  0  0

or maybe

   numeric-Rle of length 20 with 3 runs

     Lengths:  5 10  5

     Values :  0 42  0

But instead I get back 0 42 0, i.e. the score of the full original coverage
object. However, the widths are wrong.  What function(s) should I use to
achieve this? I would expect this to be a trivial operation, but could
not find any example of this (e.g. it would be really nice if I could
just write coverage[feature]). The problem seems to be that the 'score'
metadata does not 'know' the width of the IRange they are located on
(this was read with rtracklayer::import.bw).

Any help appreciated.

Philip


-- Philip Lijnzaad, PhD Molecular Cancer Research University Medical 
Center (UMC), Utrecht Stratenum room 2.211 IM: plijnzaad at jabber.org , 
philip.lijnzaad at gmail.com P.O. Box 85060, 3508 AB Utrecht 
(Universiteitsweg 100, 3584 CG Utrecht) The Netherlands tel: +31 (0)8875 
68348 fax: +31 (0)8875 68479

------------------------------------------------------------------------------

De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is
uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht
ontvangt, wordt u verzocht de inhoud niet te gebruiken en de afzender direct
te informeren door het bericht te retourneren. Het Universitair Medisch
Centrum Utrecht is een publiekrechtelijke rechtspersoon in de zin van de W.H.W.
(Wet Hoger Onderwijs en Wetenschappelijk Onderzoek) en staat geregistreerd bij
de Kamer van Koophandel voor Midden-Nederland onder nr. 30244197.

Denk s.v.p aan het milieu voor u deze e-mail afdrukt.

------------------------------------------------------------------------------

This message may contain confidential information and is...{{dropped:8}}



More information about the Bioconductor mailing list