[Bioc-devel] rtracklayer::import( as = 'NumericList' ) doesn't work with more than 1 range

Leonardo Collado Torres lcollado at jhu.edu
Tue May 19 21:10:26 CEST 2015


While playing around with importing BigWig files I found that
import.bw() fails when you use a `which` or `selection` that has more
than one range and you specify `as = 'NumericList'`. The code and
output are available at
https://gist.github.com/lcolladotor/a0eafc335a2738de42f6. From the
BigWigFile-class documentation, I suspect that this is a bug. The same
thing happens even if I use BigWigFileSelection() instead of supplying
a GRanges of length 2.

Also, what is the summary() function doing when you calculate the
mean? I would expect it to be the same mean if I import the data as an
Rle and calculate the mean there. See (after running the code in the

> x <- import(BigWigFile(bw[1]), as = 'RleList')
> mean(x)
> summary(BigWigFile(bw[1]), type = 'mean')[[1]]$score
[1] 0.9037462
> mean(x[x > 0])

It's not the mean of the non-zero positions either.


Leonardo Collado Torres, PhD Candidate
Department of Biostatistics
Johns Hopkins University
Bloomberg School of Public Health
Website: http://www.biostat.jhsph.edu/~lcollado/
Blog: http://lcolladotor.github.io/

More information about the Bioc-devel mailing list