[Bioc-devel] coverage(gr, weight='score') does not work when score(gr) is an Rle

Michael Lawrence lawrence.michael at gene.com
Fri Apr 17 18:00:32 CEST 2015


Ideally it should be supported, but it would take some work as the coverage
stuff is all in C. Could you give more details on your use case? For
example, if you already have a range for every position on the chromosome,
you could just extract the score column. I'm guessing it's more complicated
than that. If the zeros are the problem, you could just subset the GRanges
to remove the ranges with zero score, and then coerce the score to numeric
before calling coverage.

Michael

2015-04-17 8:00 GMT-07:00 Philip Lijnzaad <p.lijnzaad at umcutrecht.nl>:

> Dear all,  I'm puzzled by the following behaviour:
>
> Given
>
>     n <- 10
>     gr <- GRanges(seqnames=Rle('A', n),
>                   ranges=IRanges(1:n, width=1),
>                   score=Rle(5,n))
> If I do
>
>     coverage(gr,weight='score')
>
> I get
>
>     Error in .normarg_shift_or_weight(weight, "weight", x) :
>       'weight' must be a numeric vector, a single string, or a list-like
> object
>
> Surely 'score' should be allowed to be an Rle? Especially given the
> fact that the return value of coverage(x,weight="score") when score is
> plain numeric vector is always an Rle ! Is this the expected behaviour?
> If so, I would argue that violates the principle of least suprise :-)
>
> The background to this is that I do numerical analysis on derived
> numerical data along my chromosomes. It contains many
> contiguous zeroes so it would be wasteful to cast
> everything down using as.numeric().
>
> This is R version 3.01 on x86_64 Linux, Bioconductor version 2.13,
>
> > package.version("IRanges")
> [1] "1.20.7"
> > package.version("GenomicRanges")
> [1] "1.14.4"
>
> Regards,
>
>
> 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 68464
>
>
> ------------------------------------------------------------------------------
>
> 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 ...{{dropped:10}}



More information about the Bioc-devel mailing list